[Ada] Fix interference between iterated element-and-component association
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 9 Sep 2020 20:55:36 +0000 (22:55 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 26 Oct 2020 08:59:02 +0000 (04:59 -0400)
gcc/ada/

* par-ch4.adb (P_Iterated_Component_Association): Move code for
iterated_element_association to
Build_Iterated_Element_Association.

gcc/ada/par-ch4.adb

index df438424fbf7e674ee6bf39e66eab92ed544e328..a14690239b6151d442fe8a37696d866a58109a0f 100644 (file)
@@ -3438,6 +3438,12 @@ package body Ch4 is
 
       procedure Build_Iterated_Element_Association is
       begin
+         --  Build loop_parameter_specification
+
+         Loop_Spec :=
+           New_Node (N_Loop_Parameter_Specification, Prev_Token_Ptr);
+         Set_Defining_Identifier (Loop_Spec, Id);
+
          Choice :=  First (Discrete_Choices (Assoc_Node));
          Assoc_Node :=
            New_Node (N_Iterated_Element_Association, Prev_Token_Ptr);
@@ -3488,12 +3494,6 @@ package body Ch4 is
             Filter := P_Condition;
          end if;
 
-         --  Build loop_parameter_specification
-
-         Loop_Spec :=
-           New_Node (N_Loop_Parameter_Specification, Prev_Token_Ptr);
-         Set_Defining_Identifier (Loop_Spec, Id);
-
          if Token = Tok_Use then
 
             --  Ada_2020 Key-expression is present, rewrite node as an