return Scope_Depth (Standard_Standard);
end if;
- -- It is possible that the current scope is an aliased subprogram -
- -- this can happen when an abstract primitive from a root type is not
- -- not visible.
-
- if Is_Subprogram (Enclosing_Dynamic_Scope (Btyp))
- and then Present (Alias (Enclosing_Dynamic_Scope (Btyp)))
- then
- return Scope_Depth (Ultimate_Alias (Enclosing_Dynamic_Scope (Btyp)));
-
- -- Otherwise, simply use the enclosing dynamic scope
-
- else
- return Scope_Depth (Enclosing_Dynamic_Scope (Btyp));
- end if;
+ return Scope_Depth (Enclosing_Dynamic_Scope (Btyp));
end Type_Access_Level;
end Accessibility;
procedure Replace_Type (Id, New_Id : Entity_Id) is
Id_Type : constant Entity_Id := Etype (Id);
- Par : constant Node_Id := Parent (Derived_Type);
+ Par : constant Node_Id := Parent (Derived_Type);
begin
-- When the type is an anonymous access type, create a new access
then
Acc_Type := New_Copy (Id_Type);
Set_Etype (Acc_Type, Acc_Type);
- Set_Scope (Acc_Type, New_Subp);
+ Set_Scope (Acc_Type, Scope (Derived_Type));
-- Set size of anonymous access type. If we have an access
- -- to an unconstrained array, this is a fat pointer, so it
- -- is sizes at twice addtress size.
+ -- to an unconstrained array, this is a fat pointer, so its
+ -- size is twice the address size.
if Is_Array_Type (Desig_Typ)
and then not Is_Constrained (Desig_Typ)
Init_Size (Acc_Type, System_Address_Size);
end if;
- -- Set remaining characterstics of anonymous access type
+ -- Set remaining characteristics of anonymous access type
Reinit_Alignment (Acc_Type);
Set_Directly_Designated_Type (Acc_Type, Derived_Type);
Set_Etype (New_Id, Acc_Type);
- Set_Scope (New_Id, New_Subp);
-- Create a reference to it
- Build_Itype_Reference (Acc_Type, Parent (Derived_Type));
+ Build_Itype_Reference (Acc_Type, Par);
else
Set_Etype (New_Id, Id_Type);