-- handled during full traversal. Note that if the
-- nominal subtype of the prefix is unconstrained,
-- the bound must be obtained from the object, not
- -- from the (possibly) uplevel reference.
+ -- from the (possibly) uplevel reference. We call
+ -- Get_Referenced_Object to deal with prefixes that
+ -- are object renamings (prefixes that are types
+ -- can be passed and will simply be returned).
- if Is_Constrained (Etype (Prefix (N))) then
+ if Is_Constrained
+ (Etype (Get_Referenced_Object (Prefix (N))))
+ then
declare
DT : Boolean := False;
begin
Check_Static_Type
- (Etype (Prefix (N)), Empty, DT);
+ (Etype (Get_Referenced_Object (Prefix (N))),
+ Empty,
+ DT);
end;
return OK;
begin
R := N;
while Is_Entity_Name (R)
+ and then Is_Object (Entity (R))
and then Present (Renamed_Object (Entity (R)))
loop
R := Renamed_Object (Entity (R));
-- corresponding aspect.
function Get_Referenced_Object (N : Node_Id) return Node_Id;
- -- Given a node, return the renamed object if the node represents a renamed
- -- object, otherwise return the node unchanged. The node may represent an
- -- arbitrary expression.
+ -- Given an arbitrary node, return the renamed object if the node
+ -- represents a renamed object; otherwise return the node unchanged.
+ -- The node can represent an arbitrary expression or any other kind of
+ -- node (such as the name of a type).
function Get_Renamed_Entity (E : Entity_Id) return Entity_Id;
-- Given an entity for an exception, package, subprogram or generic unit,