From: Piotr Trojanek Date: Wed, 9 Sep 2020 21:55:55 +0000 (+0200) Subject: [Ada] Cleanup SPARK expansion of aggregates with iterated_component_assoc X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9fdbcec69455b783f6d4d14f9abe2d33d6376be8;p=gcc.git [Ada] Cleanup SPARK expansion of aggregates with iterated_component_assoc gcc/ada/ * exp_spark.adb (Expand_SPARK_Delta_Or_Update): Reuse local constant Expr and the Choice_List routine. (Expand_SPARK_N_Aggregate): Reuse local constant Expr. --- diff --git a/gcc/ada/exp_spark.adb b/gcc/ada/exp_spark.adb index f6ef8652986..5e1fac210b7 100644 --- a/gcc/ada/exp_spark.adb +++ b/gcc/ada/exp_spark.adb @@ -227,7 +227,7 @@ package body Exp_SPARK is if Nkind (Assoc) = N_Iterated_Component_Association then Push_Scope (Scope (Defining_Identifier (Assoc))); - Analyze_And_Resolve (Expression (Assoc), Comp_Type); + Analyze_And_Resolve (Expr, Comp_Type); end if; if Is_Scalar_Type (Comp_Type) then @@ -240,11 +240,7 @@ package body Exp_SPARK is End_Scope; end if; - Index := - First - (if Nkind (Assoc) = N_Iterated_Component_Association - then Discrete_Choices (Assoc) - else Choices (Assoc)); + Index := First (Choice_List (Assoc)); Index_Typ := First_Index (Typ); while Present (Index) loop @@ -399,7 +395,7 @@ package body Exp_SPARK is Push_Scope (Scope (Defining_Identifier (Assoc))); Enter_Name (Defining_Identifier (Assoc)); - Analyze_And_Resolve (Expression (Assoc), Comp_Type); + Analyze_And_Resolve (Expr, Comp_Type); if Is_Scalar_Type (Comp_Type) then Apply_Scalar_Range_Check (Expr, Comp_Type);