-- Create a label for the block in case the block needs to manage the
-- secondary stack. A label allows for flag Uses_Sec_Stack to be set.
- Add_Block_Identifier (Block_Nod, Block_Id);
+ Add_Block_Identifier (Block_Nod, Block_Id, Scop);
-- When wrapping the statements of an iterator loop, check whether
-- the loop requires secondary stack management and if so, propagate
-- Add_Block_Identifier --
--------------------------
- procedure Add_Block_Identifier (N : Node_Id; Id : out Entity_Id) is
+ procedure Add_Block_Identifier
+ (N : Node_Id;
+ Id : out Entity_Id;
+ Scope : Entity_Id := Current_Scope)
+ is
Loc : constant Source_Ptr := Sloc (N);
begin
pragma Assert (Nkind (N) = N_Block_Statement);
-- Create a new block label and set its attributes
else
- Id := New_Internal_Entity (E_Block, Current_Scope, Loc, 'B');
+ Id := New_Internal_Entity (E_Block, Scope, Loc, 'B');
Set_Etype (Id, Standard_Void_Type);
Set_Parent (Id, N);
-- Add A to the list of access types to process when expanding the
-- freeze node of E.
- procedure Add_Block_Identifier (N : Node_Id; Id : out Entity_Id);
- -- Given a block statement N, generate an internal E_Block label and make
- -- it the identifier of the block. Id denotes the generated entity. If the
- -- block already has an identifier, Id returns the entity of its label.
-
procedure Add_Global_Declaration (N : Node_Id);
-- These procedures adds a declaration N at the library level, to be
-- elaborated before any other code in the unit. It is used for example
function Current_Scope return Entity_Id;
-- Get entity representing current scope
+ procedure Add_Block_Identifier
+ (N : Node_Id;
+ Id : out Entity_Id;
+ Scope : Entity_Id := Current_Scope);
+ -- Given a block statement N, generate an internal E_Block label and make
+ -- it the identifier of the block. Scope denotes the scope in which the
+ -- generated entity Id is created and defaults to the current scope. If the
+ -- block already has an identifier, Id returns the entity of its label.
+
function Current_Scope_No_Loops return Entity_Id;
-- Return the current scope ignoring internally generated loops