Exp : Node_Id;
begin
- -- Loop through entities of record or protected type
+ -- Loop through components and discriminants of record or protected
+ -- type.
- Ent := E;
+ Ent := First_Component_Or_Discriminant (E);
while Present (Ent) loop
- -- We are interested only in components and discriminants
-
- Exp := Empty;
-
case Ekind (Ent) is
when E_Component =>
if Present (Declaration_Node (Ent)) then
Exp := Expression (Declaration_Node (Ent));
+ else
+ Exp := Empty;
end if;
when E_Discriminant =>
Exp := Discriminant_Default_Value (Ent);
when others =>
- goto Check_Next_Entity;
+ raise Program_Error;
end case;
-- A component has PI if it has no default expression and the
exit;
end if;
- <<Check_Next_Entity>>
- Next_Entity (Ent);
+ Next_Component_Or_Discriminant (Ent);
end loop;
end Check_Components;
-- If OK, check extension components (if any)
if Has_PE and then Is_Record_Type (E) then
- Check_Components (First_Entity (E));
+ Check_Components (E);
end if;
-- Check specifically for 10.2.1(11.4/2) exception: a controlled type
elsif Is_Record_Type (E) then
Has_PE := True;
- Check_Components (First_Entity (E));
+ Check_Components (E);
-- Protected types must not have entries, and components must meet
-- same set of rules as for record components.
Has_PE := False;
else
Has_PE := True;
- Check_Components (First_Entity (E));
- Check_Components (First_Private_Entity (E));
+ Check_Components (E);
end if;
-- Type System.Address always has preelaborable initialization
Is_Object (Id)
and then (Is_Independent (Id)
or else
- Is_Independent (Etype (Id)));
+ Is_Independent (Etype (Id)));
end Is_Independent_Object_Entity;
-------------------------------------