New_Spec : Node_Id;
Orig_N : Node_Id;
Ret : Node_Id;
+ Typ : Entity_Id;
Def_Id : Entity_Id := Empty;
Prev : Entity_Id;
Def_Id := Analyze_Subprogram_Specification (Spec);
Prev := Find_Corresponding_Spec (N);
+ Typ := Etype (Def_Id);
+
-- The previous entity may be an expression function as well, in
-- which case the redeclaration is illegal.
if not Inside_A_Generic then
Freeze_Expr_Types
(Def_Id => Def_Id,
- Typ => Etype (Def_Id),
+ Typ => Typ,
Expr => Expr,
N => N);
end if;
Def_Id := Defining_Entity (N);
Set_Is_Inlined (Def_Id);
+ Typ := Etype (Def_Id);
+
-- Establish the linkages between the spec and the body. These are
-- used when the expression function acts as the prefix of attribute
-- 'Access in order to freeze the original expression which has been
Set_Has_Completion (Def_Id, not Is_Ignored_Ghost_Entity (Def_Id));
Push_Scope (Def_Id);
Install_Formals (Def_Id);
- Preanalyze_Spec_Expression (Expr, Etype (Def_Id));
+ Preanalyze_Spec_Expression (Expr, Typ);
End_Scope;
end if;
-- place at the point of declaration.
declare
- Decls : List_Id := List_Containing (N);
- Par : constant Node_Id := Parent (Decls);
- Typ : constant Entity_Id := Etype (Def_Id);
+ Decls : List_Id := List_Containing (N);
+ Par : constant Node_Id := Parent (Decls);
begin
-- If this is a wrapper created in an instance for a formal
-- nodes that don't come from source.
if Present (Def_Id)
- and then Nkind (Def_Id) in N_Has_Etype
- and then Is_Tagged_Type (Etype (Def_Id))
+ and then Is_Tagged_Type (Typ)
then
Check_Dynamically_Tagged_Expression
(Expr => Expr,
- Typ => Etype (Def_Id),
+ Typ => Typ,
Related_Nod => Orig_N);
end if;