Commit 1cb17b78 by Arnaud Charlet

sem_ch4.adb (Analyze_One_Call): Handle complex overloading of a procedure call…

sem_ch4.adb (Analyze_One_Call): Handle complex overloading of a procedure call whose prefix is a parameterless...

2008-08-01  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch4.adb (Analyze_One_Call): Handle complex overloading of a
	procedure call whose prefix
	is a parameterless function call that returns an access_to_procedure.

From-SVN: r138491
parent d54c4e31
2008-08-01 Robert Dewar <dewar@adacore.com>
* sem_ch6.adb (Process_PPCs): Don't copy spec PPC to body if not
generating code
2008-08-01 Ed Schonberg <schonberg@adacore.com>
* checks.adb (Apply_Float_Conversion_Check): If the expression to be
converted is a real literal and the target type has static bounds,
perform the conversion exactly to prevent floating-point anomalies on
some targets.
2008-08-01 Vincent Celier <celier@adacore.com>
* prj-attr.adb: New attribute Compiler'Name_Syntax (<lang>)
* prj-nmsc.adb (Process_Compiler): Recognize attribute Name_Syntax
* prj.adb (Object_Exist_For): Use Object_Generated, not
Objects_Generated that is removed and was never modified anyway.
* prj.ads:
(Path_Syntax_Kind): New enumeration type
(Language_Config): New component Path_Syntax, defaulted to Host.
Components PIC_Option and Objects_Generated removed, as they are not
used.
* snames.adb: New standard name Path_Syntax
* snames.ads: New standard name Path_Syntax
2008-08-01 Vincent Celier <celier@adacore.com>
* mlib-utl.adb:
(Adalib_Path): New variable to store the path of the adalib directory
when procedure Specify_Adalib_Dir is called.
(Lib_Directory): If Adalib_Path is not null, return its value
(Specify_Adalib_Dir): New procedure
* mlib-utl.ads (Specify_Adalib_Dir): New procedure
2008-08-01 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb:
(Check_Precondition_Postcondition): If not generating code, analyze the
expression in a postcondition that appears in a subprogram body, so that
it is properly decorated for ASIS use.
2008-08-01 Gary Dismukes <dismukes@adacore.com>
* exp_ch6.adb (Expand_Call): Remove ugly special-case code that resets
Orig_Prev to Prev in the case where the actual is N_Function_Call or
N_Identifier. This was interfering with other cases that are rewritten
as N_Identifier, such as allocators, resulting in passing of the wrong
accessibility level, and based on testing this code is apparently no
longer needed at all.
2008-08-01 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb (Analyze_One_Call): Handle complex overloading of a
procedure call whose prefix
is a parameterless function call that returns an access_to_procedure.
2008-08-01 Jose Ruiz <ruiz@adacore.com>
* adaint.c (__gnat_tmp_name): Refine the generation of temporary names
......@@ -688,6 +688,9 @@ package body Sem_Ch4 is
X : Interp_Index;
It : Interp;
Nam_Ent : Entity_Id;
Deref : Boolean := False;
-- Flag indicates whether an interpretation of the prefix is a
-- parameterless call that returns an access_to_subprogram.
Success : Boolean := False;
function Name_Denotes_Function return Boolean;
......@@ -874,6 +877,7 @@ package body Sem_Ch4 is
while Present (It.Nam) loop
Nam_Ent := It.Nam;
Deref := False;
-- Name may be call that returns an access to subprogram, or more
-- generally an overloaded expression one of whose interpretations
......@@ -888,11 +892,17 @@ package body Sem_Ch4 is
Nam_Ent := Designated_Type (Nam_Ent);
elsif Is_Access_Type (Etype (Nam_Ent))
and then not Is_Entity_Name (Nam)
and then
(not Is_Entity_Name (Nam)
or else Nkind (N) = N_Procedure_Call_Statement)
and then Ekind (Designated_Type (Etype (Nam_Ent)))
= E_Subprogram_Type
then
Nam_Ent := Designated_Type (Etype (Nam_Ent));
if Is_Entity_Name (Nam) then
Deref := True;
end if;
end if;
Analyze_One_Call (N, Nam_Ent, False, Success);
......@@ -904,7 +914,16 @@ package body Sem_Ch4 is
-- guation is done directly in Resolve.
if Success then
Set_Etype (Nam, It.Typ);
if Deref
and then Nkind (Parent (N)) /= N_Explicit_Dereference
then
Set_Entity (Nam, It.Nam);
Insert_Explicit_Dereference (Nam);
Set_Etype (Nam, Nam_Ent);
else
Set_Etype (Nam, It.Typ);
end if;
elsif Nkind_In (Name (N), N_Selected_Component,
N_Function_Call)
......@@ -1480,14 +1499,15 @@ package body Sem_Ch4 is
and then Is_Overloaded (N)
then
-- The prefix may include access to subprograms and other access
-- types. If the context selects the interpretation that is a call,
-- we cannot rewrite the node yet, but we include the result of
-- the call interpretation.
-- types. If the context selects the interpretation that is a
-- function call (not a procedure call) we cannot rewrite the
-- node yet, but we include the result of the call interpretation.
Get_First_Interp (N, I, It);
while Present (It.Nam) loop
if Ekind (Base_Type (It.Typ)) = E_Subprogram_Type
and then Etype (Base_Type (It.Typ)) /= Standard_Void_Type
and then Nkind (Parent (N)) /= N_Procedure_Call_Statement
then
Add_One_Interp (N, Etype (It.Typ), Etype (It.Typ));
end if;
......
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