(Variant : Node_Id) return Boolean
is
Clist : constant Node_Id := Component_List (Variant);
+ Comp : Node_Id := First (Component_Items (Clist));
begin
- if Is_Empty_List (Component_Items (Clist)) then
- return False;
- end if;
-
-- We only need to test one component
- declare
- Comp : Node_Id := First (Component_Items (Clist));
-
- begin
- while Present (Comp) loop
- if Component_Is_Unconstrained_UU (Comp) then
- return True;
- end if;
+ while Present (Comp) loop
+ if Component_Is_Unconstrained_UU (Comp) then
+ return True;
+ end if;
- Next (Comp);
- end loop;
- end;
+ Next (Comp);
+ end loop;
-- None of the components withing the variant were of
-- unconstrained Unchecked_Union type.
----------------------
function Find_Entry_Index (E : Entity_Id) return Uint is
- Index : Uint := Uint_1;
- Subp_Decl : Entity_Id;
+ Index : Uint := Uint_0;
+ Subp_Decl : Node_Id;
begin
- if Present (Decls)
- and then not Is_Empty_List (Decls)
- then
- Subp_Decl := First (Decls);
- while Present (Subp_Decl) loop
- if Nkind (Subp_Decl) = N_Entry_Declaration then
- if Defining_Identifier (Subp_Decl) = E then
- return Index;
- end if;
+ Subp_Decl := First (Decls);
+ while Present (Subp_Decl) loop
+ if Nkind (Subp_Decl) = N_Entry_Declaration then
+ Index := Index + 1;
- Index := Index + 1;
+ if Defining_Identifier (Subp_Decl) = E then
+ exit;
end if;
- Next (Subp_Decl);
- end loop;
- end if;
+ end if;
+
+ Next (Subp_Decl);
+ end loop;
- return Uint_0;
+ return Index;
end Find_Entry_Index;
-- Local variables
pragma Assert (D /= Union_Id (No_List));
-- Because No_List = Empty, which is in Node_Range above
- if Is_Empty_List (List_Id (D)) then
- null;
-
- else
- N1 := First (List_Id (D));
- while Present (N1) loop
- Save_References (N1);
- Next (N1);
- end loop;
- end if;
+ N1 := First (List_Id (D));
+ while Present (N1) loop
+ Save_References (N1);
+ Next (N1);
+ end loop;
-- Element list or other non-node field, nothing to do