Formal : Entity_Id;
Is_Default : Boolean := False)
is
- Actual_Obj : constant Entity_Id := Get_Enclosing_Ghost_Object (Actual);
+ Actual_Obj : constant Entity_Id := Get_Enclosing_Ghost_Entity (Actual);
begin
if not Is_Ghost_Entity (Formal) then
return;
-- entity.
if Nkind (N) = N_Assignment_Statement then
- Id := Get_Enclosing_Ghost_Object (Name (N));
+ Id := Get_Enclosing_Ghost_Entity (Name (N));
return Present (Id) and then Is_Ghost_Entity (Id);
end if;
-- A procedure call is Ghost when it invokes a Ghost procedure
if Nkind (N) = N_Procedure_Call_Statement then
- Id := Get_Enclosing_Ghost_Object (Name (N));
+ Id := Get_Enclosing_Ghost_Entity (Name (N));
return Present (Id) and then Is_Ghost_Entity (Id);
end if;
end if;
declare
- Id : constant Entity_Id := Get_Enclosing_Ghost_Object (Lhs);
+ Id : constant Entity_Id := Get_Enclosing_Ghost_Entity (Lhs);
begin
if Present (Id) then
-- Left-hand side denotes a Checked ghost entity, so install
-- A procedure call becomes Ghost when the procedure being invoked is
-- Ghost. Install the Ghost mode of the procedure.
- Id := Get_Enclosing_Ghost_Object (Name (N));
+ Id := Get_Enclosing_Ghost_Entity (Name (N));
if Present (Id) then
if Is_Checked_Ghost_Entity (Id) then
-- of the target.
if Nkind (N) = N_Assignment_Statement then
- Id := Get_Enclosing_Ghost_Object (Name (N));
+ Id := Get_Enclosing_Ghost_Entity (Name (N));
if Present (Id) then
Set_Ghost_Mode_From_Entity (Id);
-- procedure being invoked.
elsif Nkind (N) = N_Procedure_Call_Statement then
- Id := Get_Enclosing_Ghost_Object (Name (N));
+ Id := Get_Enclosing_Ghost_Entity (Name (N));
if Present (Id) then
Set_Ghost_Mode_From_Entity (Id);
Strval => String_From_Name_Buffer);
end Get_Default_External_Name;
- --------------------------
- -- Get_Enclosing_Object --
- --------------------------
-
- function Get_Enclosing_Object (N : Node_Id) return Entity_Id is
- begin
- if Is_Entity_Name (N) then
- return Entity (N);
- else
- case Nkind (N) is
- when N_Indexed_Component
- | N_Selected_Component
- | N_Slice
- =>
- return Get_Enclosing_Object (Prefix (N));
-
- when N_Type_Conversion =>
- return Get_Enclosing_Object (Expression (N));
-
- when others =>
- return Empty;
- end case;
- end if;
- end Get_Enclosing_Object;
-
--------------------------------
- -- Get_Enclosing_Ghost_Object --
+ -- Get_Enclosing_Ghost_Entity --
--------------------------------
- function Get_Enclosing_Ghost_Object (N : Node_Id) return Entity_Id is
+ function Get_Enclosing_Ghost_Entity (N : Node_Id) return Entity_Id is
begin
if Is_Entity_Name (N) then
return Entity (N);
| N_Selected_Component
| N_Slice
=>
- return Get_Enclosing_Ghost_Object (Prefix (N));
+ return Get_Enclosing_Ghost_Entity (Prefix (N));
when N_Function_Call =>
return Get_Called_Entity (N);
return Empty;
end case;
end if;
- end Get_Enclosing_Ghost_Object;
+ end Get_Enclosing_Ghost_Entity;
+
+ --------------------------
+ -- Get_Enclosing_Object --
+ --------------------------
+
+ function Get_Enclosing_Object (N : Node_Id) return Entity_Id is
+ begin
+ if Is_Entity_Name (N) then
+ return Entity (N);
+ else
+ case Nkind (N) is
+ when N_Indexed_Component
+ | N_Selected_Component
+ | N_Slice
+ =>
+ return Get_Enclosing_Object (Prefix (N));
+
+ when N_Type_Conversion =>
+ return Get_Enclosing_Object (Expression (N));
+
+ when others =>
+ return Empty;
+ end case;
+ end if;
+ end Get_Enclosing_Object;
---------------------------
-- Get_Enum_Lit_From_Pos --
-- If expression N references a part of an object, return this object.
-- Otherwise return Empty. Expression N should have been resolved already.
- function Get_Enclosing_Ghost_Object (N : Node_Id) return Entity_Id;
- -- If expression N references a reachable part of an object (as defined in
- -- SPARK RM 6.9), return this object. Otherwise return Empty. It is similar
- -- to Get_Enclosing_Object, but treats pointer dereference like component
- -- selection. Also, it handles function results and type conversions like
- -- objects. Expression N should have been resolved already.
+ function Get_Enclosing_Ghost_Entity (N : Node_Id) return Entity_Id;
+ -- If expression N references a name of either an object or of a
+ -- subprogram, then return its outermost entity that determines
+ -- whether this name denotes a ghost object.
function Get_Generic_Entity (N : Node_Id) return Entity_Id;
-- Returns the true generic entity in an instantiation. If the name in the