[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.
This commit is contained in:
Piotr Trojanek 2020-09-09 23:55:55 +02:00 committed by Pierre-Marie de Rodat
parent acdd1bd4c6
commit 9fdbcec694

View File

@ -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);