--------------------------------
function Simple_Init_Defaulted_Type return Node_Id is
- Subtyp : constant Entity_Id := First_Subtype (Typ);
+ Subtyp : Entity_Id := First_Subtype (Typ);
begin
- -- Use the Sloc of the context node when constructing the initial
- -- value because the expression of Default_Value may come from a
- -- different unit. Updating the Sloc will result in accurate error
- -- diagnostics.
-
-- When the first subtype is private, retrieve the expression of the
-- Default_Value from the underlying type.
if Is_Private_Type (Subtyp) then
- return
- Unchecked_Convert_To
- (Typ => Typ,
- Expr =>
- New_Copy_Tree
- (Source => Default_Aspect_Value (Full_View (Subtyp)),
- New_Sloc => Loc));
-
- else
- return
- Convert_To
- (Typ => Typ,
- Expr =>
- New_Copy_Tree
- (Source => Default_Aspect_Value (Subtyp),
- New_Sloc => Loc));
+ Subtyp := Full_View (Subtyp);
end if;
+
+ -- Use the Sloc of the context node when constructing the initial
+ -- value because the expression of Default_Value may come from a
+ -- different unit. Updating the Sloc will result in accurate error
+ -- diagnostics.
+
+ return
+ OK_Convert_To
+ (Typ => Typ,
+ Expr =>
+ New_Copy_Tree
+ (Source => Default_Aspect_Value (Subtyp),
+ New_Sloc => Loc));
end Simple_Init_Defaulted_Type;
-----------------------------------------