[Ada] Remove SPARK-specific expansion of array aggregates
[gcc.git] / gcc / ada / exp_spark.adb
index 5e1fac210b7d16e3f961b47784f82c336436e92d..883a819ec7997b7f6da6af0ecffc2d3700c1410a 100644 (file)
@@ -52,9 +52,6 @@ package body Exp_SPARK is
    -- Local Subprograms --
    -----------------------
 
-   procedure Expand_SPARK_N_Aggregate (N : Node_Id);
-   --  Perform aggregate-specific expansion
-
    procedure Expand_SPARK_N_Attribute_Reference (N : Node_Id);
    --  Perform attribute-reference-specific expansion
 
@@ -105,9 +102,6 @@ package body Exp_SPARK is
          =>
             Qualify_Entity_Names (N);
 
-         when N_Aggregate =>
-            Expand_SPARK_N_Aggregate (N);
-
          --  Replace occurrences of System'To_Address by calls to
          --  System.Storage_Elements.To_Address.
 
@@ -227,6 +221,7 @@ package body Exp_SPARK is
 
                if Nkind (Assoc) = N_Iterated_Component_Association then
                   Push_Scope (Scope (Defining_Identifier (Assoc)));
+                  Enter_Name (Defining_Identifier (Assoc));
                   Analyze_And_Resolve (Expr, Comp_Type);
                end if;
 
@@ -366,74 +361,6 @@ package body Exp_SPARK is
       end if;
    end Expand_SPARK_N_Freeze_Type;
 
-   ------------------------------
-   -- Expand_SPARK_N_Aggregate --
-   ------------------------------
-
-   procedure Expand_SPARK_N_Aggregate (N : Node_Id) is
-      Assoc : Node_Id := First (Component_Associations (N));
-   begin
-      --  For compilation, frontend analyses a copy of the
-      --  iterated_component_association's expression for legality checking;
-      --  (then the expression is copied again when expanding association into
-      --  assignments for the individual choices). For SPARK we analyze the
-      --  original expression and apply range checks, if required.
-
-      while Present (Assoc) loop
-         if Nkind (Assoc) = N_Iterated_Component_Association then
-            declare
-               Typ : constant Entity_Id := Etype (N);
-
-               Comp_Type : constant Entity_Id := Component_Type (Typ);
-               Expr      : constant Node_Id := Expression (Assoc);
-               Index_Typ : constant Entity_Id := First_Index (Typ);
-
-               Index : Node_Id;
-
-            begin
-               --  Analyze expression with index parameter in scope
-
-               Push_Scope (Scope (Defining_Identifier (Assoc)));
-               Enter_Name (Defining_Identifier (Assoc));
-               Analyze_And_Resolve (Expr, Comp_Type);
-
-               if Is_Scalar_Type (Comp_Type) then
-                  Apply_Scalar_Range_Check (Expr, Comp_Type);
-               end if;
-
-               End_Scope;
-
-               --  Analyze discrete choices
-
-               Index := First (Discrete_Choices (Assoc));
-
-               while Present (Index) loop
-
-                  --  The index denotes a range of elements where range checks
-                  --  have been already applied.
-
-                  if Nkind (Index) in N_Others_Choice
-                                    | N_Range
-                                    | N_Subtype_Indication
-                  then
-                     null;
-
-                  --  Otherwise the index denotes a single element (or a
-                  --  subtype name which doesn't require range checks).
-
-                  else pragma Assert (Nkind (Index) in N_Subexpr);
-                     Apply_Scalar_Range_Check (Index, Etype (Index_Typ));
-                  end if;
-
-                  Next (Index);
-               end loop;
-            end;
-         end if;
-
-         Next (Assoc);
-      end loop;
-   end Expand_SPARK_N_Aggregate;
-
    ----------------------------------------
    -- Expand_SPARK_N_Attribute_Reference --
    ----------------------------------------