Commit 719aaf4d by Arnaud Charlet

[multiple changes]

2010-06-22  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch8.adb (Add_Implicit_Operator): If the context of the expanded
	name is a call, use the number of actuals to determine whether this is
	a binary or unary operator, rather than relying on later information
	to resolve the overload.

2010-06-22  Robert Dewar  <dewar@adacore.com>

	* sem_ch10.adb, sem_aggr.adb: Minor reformatting.

From-SVN: r161142
parent 946db1e2
2010-06-22 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Add_Implicit_Operator): If the context of the expanded
name is a call, use the number of actuals to determine whether this is
a binary or unary operator, rather than relying on later information
to resolve the overload.
2010-06-22 Robert Dewar <dewar@adacore.com>
* sem_ch10.adb, sem_aggr.adb: Minor reformatting.
2010-06-22 Robert Dewar <dewar@adacore.com> 2010-06-22 Robert Dewar <dewar@adacore.com>
* sem_ch3.adb, sem_disp.adb: Minor code fixes. * sem_ch3.adb, sem_disp.adb: Minor code fixes.
......
...@@ -3503,8 +3503,8 @@ package body Sem_Aggr is ...@@ -3503,8 +3503,8 @@ package body Sem_Aggr is
-- subaggregate is needed. -- subaggregate is needed.
Capture_Discriminants : declare Capture_Discriminants : declare
Loc : constant Source_Ptr := Sloc (N); Loc : constant Source_Ptr := Sloc (N);
Expr : Node_Id; Expr : Node_Id;
procedure Add_Discriminant_Values procedure Add_Discriminant_Values
(New_Aggr : Node_Id; (New_Aggr : Node_Id;
...@@ -3610,7 +3610,6 @@ package body Sem_Aggr is ...@@ -3610,7 +3610,6 @@ package body Sem_Aggr is
New_Aggr : Node_Id; New_Aggr : Node_Id;
begin begin
Inner_Comp := First_Component (Etype (Comp)); Inner_Comp := First_Component (Etype (Comp));
while Present (Inner_Comp) loop while Present (Inner_Comp) loop
Comp_Type := Etype (Inner_Comp); Comp_Type := Etype (Inner_Comp);
...@@ -3623,7 +3622,7 @@ package body Sem_Aggr is ...@@ -3623,7 +3622,7 @@ package body Sem_Aggr is
Set_Etype (New_Aggr, Comp_Type); Set_Etype (New_Aggr, Comp_Type);
Add_Association Add_Association
(Inner_Comp, New_Aggr, (Inner_Comp, New_Aggr,
Component_Associations (Aggr)); Component_Associations (Aggr));
-- Collect discriminant values and recurse -- Collect discriminant values and recurse
...@@ -3673,7 +3672,7 @@ package body Sem_Aggr is ...@@ -3673,7 +3672,7 @@ package body Sem_Aggr is
else else
declare declare
Comp : Entity_Id; Comp : Entity_Id;
begin begin
-- If the type has additional components, create -- If the type has additional components, create
......
...@@ -2208,7 +2208,6 @@ package body Sem_Ch10 is ...@@ -2208,7 +2208,6 @@ package body Sem_Ch10 is
if Present (Enclosing_Child) then if Present (Enclosing_Child) then
Install_Siblings (Enclosing_Child, N); Install_Siblings (Enclosing_Child, N);
end if; end if;
end if; end if;
Analyze (Proper_Body (Unit (N))); Analyze (Proper_Body (Unit (N)));
......
...@@ -6029,12 +6029,43 @@ package body Sem_Ch8 is ...@@ -6029,12 +6029,43 @@ package body Sem_Ch8 is
Change_Selected_Component_To_Expanded_Name (N); Change_Selected_Component_To_Expanded_Name (N);
end if; end if;
Add_One_Interp (N, Predef_Op, T); -- If the context is an unanalyzed function call, determine whether
-- a binary or unary interpretation is required.
-- For operators with unary and binary interpretations, add both if Nkind (Parent (N)) = N_Indexed_Component then
declare
Is_Binary_Call : constant Boolean
:= Present (Next (First (Expressions (Parent (N)))));
Is_Binary_Op : constant Boolean
:= First_Entity (Predef_Op) /= Last_Entity (Predef_Op);
Predef_Op2 : constant Entity_Id := Homonym (Predef_Op);
begin
if Is_Binary_Call then
if Is_Binary_Op then
Add_One_Interp (N, Predef_Op, T);
else
Add_One_Interp (N, Predef_Op2, T);
end if;
if Present (Homonym (Predef_Op)) then else
Add_One_Interp (N, Homonym (Predef_Op), T); if not Is_Binary_Op then
Add_One_Interp (N, Predef_Op, T);
else
Add_One_Interp (N, Predef_Op2, T);
end if;
end if;
end;
else
Add_One_Interp (N, Predef_Op, T);
-- For operators with unary and binary interpretations, if
-- context is not a call, add both
if Present (Homonym (Predef_Op)) then
Add_One_Interp (N, Homonym (Predef_Op), T);
end if;
end if; end if;
-- The node is a reference to a predefined operator, and -- The node is a reference to a predefined operator, and
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment