]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Cleanup analysis of iterated component association
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 4 May 2023 15:35:51 +0000 (17:35 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 15 Jun 2023 07:59:32 +0000 (09:59 +0200)
Cleanups related to analysis of iterated component association for
GNATprove.

gcc/ada/

* sem_aggr.adb
(Resolve_Array_Aggregate): Simplify comment.
(Resolve_Iterated_Component_Association): Tune comment; change variable
to constant.

gcc/ada/sem_aggr.adb

index c6063c78bf63e415018039bdd10f195d5cb8645c..39189463871e02c50d06348f2f0f291733ce6ade 100644 (file)
@@ -1331,9 +1331,9 @@ package body Sem_Aggr is
       --  In this event we do not resolve Expr unless expansion is disabled.
       --  To know why, see the DELAYED COMPONENT RESOLUTION note above.
       --
-      --  NOTE: In the case of "... => <>", we pass the in the
-      --  N_Component_Association node as Expr, since there is no Expression in
-      --  that case, and we need a Sloc for the error message.
+      --  NOTE: In the case of "... => <>", we pass the N_Component_Association
+      --  node as Expr, since there is no Expression and we need a Sloc for the
+      --  error message.
 
       procedure Resolve_Iterated_Component_Association
         (N         : Node_Id;
@@ -1790,7 +1790,7 @@ package body Sem_Aggr is
          Choice : Node_Id;
          Dummy  : Boolean;
          Scop   : Entity_Id;
-         Expr   : Node_Id;
+         Expr   : constant Node_Id := Expression (N);
 
       --  Start of processing for Resolve_Iterated_Component_Association
 
@@ -1854,14 +1854,12 @@ package body Sem_Aggr is
             Set_Scope (Id, Scop);
          end if;
 
-         --  Analyze  expression without expansion, to verify legality.
+         --  Analyze expression without expansion, to verify legality.
          --  When generating code, we then remove references to the index
          --  variable, because the expression will be analyzed anew after
          --  rewritting as a loop with a new index variable; when not
          --  generating code we leave the analyzed expression as it is.
 
-         Expr := Expression (N);
-
          Dummy := Resolve_Aggr_Expr (Expr, Single_Elmt => False);
 
          if Operating_Mode /= Check_Semantics then