-- is internally generated code that manipulates addresses,
-- e.g. when building interface tables. No check should
-- occur in this case, and the discriminated object is not
- -- directly a hand.
+ -- directly at hand.
if not Comes_From_Source (Actual)
and then Nkind (Actual) = N_Unchecked_Type_Conversion
-- the corresponding semantic routine
if Present (Access_To_Subprogram_Definition (N)) then
-
- -- Compiler runtime units are compiled in Ada 2005 mode when building
- -- the runtime library but must also be compilable in Ada 95 mode
- -- (when bootstrapping the compiler).
-
- Check_Compiler_Unit ("anonymous access to subprogram", N);
-
Access_Subprogram_Declaration
(T_Name => Anon_Type,
T_Def => Access_To_Subprogram_Definition (N));
Set_Can_Never_Be_Null (T_Name, Null_Exclusion_Present (T_Def));
Check_Restriction (No_Access_Subprograms, T_Def);
+
+ Create_Extra_Formals (Desig_Type);
end Access_Subprogram_Declaration;
----------------------------
-----------------------------
procedure Eval_Selected_Component (N : Node_Id) is
+ Node : Node_Id;
+ Comp : Node_Id;
+ C : Node_Id;
+ Nam : Name_Id;
+
begin
-- If an attribute reference or a LHS, nothing to do.
-- Also do not fold if N is an [in] out subprogram parameter.
and then Is_LHS (N) = No
and then not Is_Actual_Out_Or_In_Out_Parameter (N)
then
- Fold (N);
+ -- Simplify a selected_component on an aggregate by extracting
+ -- the field directly.
+
+ Node := Prefix (N);
+
+ while Nkind (Node) = N_Qualified_Expression loop
+ Node := Expression (Node);
+ end loop;
+
+ if Nkind (Node) = N_Aggregate then
+ Comp := First (Component_Associations (Node));
+ Nam := Chars (Selector_Name (N));
+
+ while Present (Comp) loop
+ C := First (Choices (Comp));
+
+ while Present (C) loop
+ if Chars (C) = Nam then
+ Rewrite (N, Relocate_Node (Expression (Comp)));
+ return;
+ end if;
+
+ Next (C);
+ end loop;
+
+ Next (Comp);
+ end loop;
+ else
+ Fold (N);
+ end if;
end if;
end Eval_Selected_Component;