function Is_Dynamic_Scope (Id : E) return B is
begin
- return
- Ekind (Id) = E_Block
- or else
- Ekind (Id) = E_Function
- or else
- Ekind (Id) = E_Procedure
- or else
- Ekind (Id) = E_Subprogram_Body
- or else
- Ekind (Id) = E_Task_Type
- or else
- (Ekind (Id) = E_Limited_Private_Type
- and then Present (Full_View (Id))
- and then Ekind (Full_View (Id)) = E_Task_Type)
- or else
- Ekind (Id) = E_Entry
- or else
- Ekind (Id) = E_Entry_Family
+ return Ekind (Id) in E_Block
+ -- Including an E_Block that came from an N_Expression_With_Actions
+ | E_Entry
+ | E_Entry_Family
+ | E_Function
+ | E_Procedure
+ | E_Return_Statement
+ | E_Subprogram_Body
+ | E_Task_Type
or else
- Ekind (Id) = E_Return_Statement;
+ (Ekind (Id) = E_Limited_Private_Type
+ and then Present (Full_View (Id))
+ and then Ekind (Full_View (Id)) = E_Task_Type);
end Is_Dynamic_Scope;
--------------------
if Is_Formal (E) then
return False;
+
+ -- If we somehow got an empty value for Scope, the tree must be
+ -- malformed. Rather than blow up we return True in this case.
+
+ elsif No (Scope (E)) then
+ return True;
+
+ -- Handle loops since Enclosing_Dynamic_Scope skips them; required to
+ -- properly handle entities local to quantified expressions in library
+ -- level specifications.
+
+ elsif Ekind (Scope (E)) = E_Loop then
+ return False;
end if;
-- Normal test is simply that the enclosing dynamic scope is Standard