Comp_Elmt := First_Elmt (Components);
while Present (Comp_Elmt) loop
- if
- Ekind (Node (Comp_Elmt)) /= E_Discriminant
+ if Ekind (Node (Comp_Elmt)) /=
+ E_Discriminant
then
Process_Component (Node (Comp_Elmt));
end if;
elsif Others_Box = 1 and then Warn_On_Redundant_Constructs then
Error_Msg_N ("others choice is redundant?", Box_Node);
- Error_Msg_N ("\previous choices cover all components?",
- Box_Node);
+ Error_Msg_N
+ ("\previous choices cover all components?", Box_Node);
end if;
exit Verification;
-- conformant. If the parent node is not analyzed yet it may be an
-- indexed component rather than a function call.
+ function Has_Dereference (Nod : Node_Id) return Boolean;
+ -- Check whether prefix includes a dereference at any level
+
--------------------------------
-- Find_Component_In_Instance --
--------------------------------
return True;
end Has_Mode_Conformant_Spec;
+ ---------------------
+ -- Has_Dereference --
+ ---------------------
+
+ function Has_Dereference (Nod : Node_Id) return Boolean is
+ begin
+ if Nkind (Nod) = N_Explicit_Dereference then
+ return True;
+
+ elsif Nkind_In (Nod, N_Indexed_Component, N_Selected_Component) then
+ return Has_Dereference (Prefix (Nod));
+
+ else
+ return False;
+ end if;
+ end Has_Dereference;
+
-- Start of processing for Analyze_Selected_Component
begin
-- This is legal if prefix is an access to such type and there is
-- a dereference, or is a component with a dereferenced prefix.
- if In_Scope and then not Is_Entity_Name (Name) then
- declare
-
- function Has_Dereference (N : Node_Id) return Boolean;
- -- Check whether prefix includes a dereference at any level.
-
- ---------------------
- -- Has_Dereference --
- ---------------------
-
- function Has_Dereference (N : Node_Id) return Boolean is
- begin
- if Nkind (N) = N_Explicit_Dereference then
- return True;
- elsif
- Nkind_In (N, N_Selected_Component, N_Indexed_Component)
- then
- return Has_Dereference (Prefix (N));
- else
- return False;
- end if;
- end Has_Dereference;
-
- begin
- if not Has_Dereference (Name) then
- Error_Msg_NE ("invalid reference to internal operation "
- & "of some object of type &", N, Type_To_Use);
- Set_Entity (Sel, Any_Id);
- Set_Etype (Sel, Any_Type);
- return;
- end if;
- end;
+ if In_Scope
+ and then not Is_Entity_Name (Name)
+ and then not Has_Dereference (Name)
+ then
+ Error_Msg_NE
+ ("invalid reference to internal operation of some object of "
+ & "type &", N, Type_To_Use);
+ Set_Entity (Sel, Any_Id);
+ Set_Etype (Sel, Any_Type);
+ return;
end if;
-- If there is no visible entity with the given name or none of the
and then not Is_Imported (E1)
then
Error_Msg_N
- ("?k?& is not modified, " &
- "consider pragma Export for volatile variable!",
- E1);
+ ("?k?& is not modified, consider pragma Export for "
+ & "volatile variable!", E1);
-- Another special case, Exception_Occurrence, this catches
-- the case of exception choice (and a bit more too, but not