Commit 2c28c7a7 by Arnaud Charlet

[multiple changes]

2013-01-02  Thomas Quinot  <quinot@adacore.com>

	* par_sco.adb: Generate X SCOs for default expressions in
	subprogram body stubs.	Do not generate any SCO for package,
	task, or protected body stubs.

2013-01-02  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb: Further improvement to ASIS mode for anonymous
	access to protected subprograms.

From-SVN: r194796
parent 9b23b7de
2013-01-02 Thomas Quinot <quinot@adacore.com>
* par_sco.adb: Generate X SCOs for default expressions in
subprogram body stubs. Do not generate any SCO for package,
task, or protected body stubs.
2013-01-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb: Further improvement to ASIS mode for anonymous
access to protected subprograms.
2013-01-02 Robert Dewar <dewar@adacore.com>
* par_sco.adb, vms_data.ads: Minor reformatting.
......
......@@ -1048,10 +1048,15 @@ package body Par_SCO is
Index := Condition_Pragma_Hash_Table.Get (Loc);
-- The test here for zero is to deal with possible previous errors
-- A zero index here indicates that semantic analysis found an
-- activated pragma at Loc which does not have a corresponding pragma
-- or aspect at the syntax level. This may occur in legitimate cases
-- because of expanded code (such are Pre/Post conditions generated for
-- formal parameter validity checks), or as a consequence of a previous
-- error.
if Index = 0 then
Check_Error_Detected;
return;
else
declare
......@@ -1533,7 +1538,7 @@ package body Par_SCO is
-- Subprogram declaration
when N_Subprogram_Declaration =>
when N_Subprogram_Declaration | N_Subprogram_Body_Stub =>
Process_Decisions_Defer
(Parameter_Specifications (Specification (N)), 'X');
......@@ -2041,7 +2046,10 @@ package body Par_SCO is
when N_Representation_Clause |
N_Use_Package_Clause |
N_Use_Type_Clause =>
N_Use_Type_Clause |
N_Package_Body_Stub |
N_Task_Body_Stub |
N_Protected_Body_Stub =>
Typ := ASCII.NUL;
when others =>
......
......@@ -5049,10 +5049,45 @@ package body Sem_Ch3 is
Decl :=
Make_Full_Type_Declaration (Loc,
Defining_Identifier => Anon,
Type_Definition => Relocate_Node (Spec));
Type_Definition => Copy_Separate_Tree (Spec));
Mark_Rewrite_Insertion (Decl);
-- In ASIS mode, analyze the profile on the original node, because
-- the separate copy does not provide enough links to recover the
-- original tree. Analysis is limited to type annotations, within
-- a temporary scope that serves as an anonnymous subprogram to
-- collect otherwise useless temporaries and itypes.
if ASIS_Mode then
declare
Typ : constant Entity_Id := Make_Temporary (Loc, 'S');
begin
if Nkind (Spec) = N_Access_Function_Definition then
Set_Ekind (Typ, E_Function);
else
Set_Ekind (Typ, E_Procedure);
end if;
Set_Parent (Typ, N);
Set_Scope (Typ, Current_Scope);
Push_Scope (Typ);
Process_Formals (Parameter_Specifications (Spec), Spec);
if Nkind (Spec) = N_Access_Function_Definition then
if Nkind (Result_Definition (Spec)) = N_Access_Definition then
Find_Type (Subtype_Mark (Result_Definition (Spec)));
else
Find_Type (Result_Definition (Spec));
end if;
end if;
End_Scope;
end;
end if;
-- Insert the new declaration in the nearest enclosing scope. If the
-- node is a body and N is its return type, the declaration belongs in
-- the enclosing scope.
......
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