]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Delay expansion of iterator specification in preanalysis
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 12 Sep 2022 16:10:59 +0000 (18:10 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 26 Sep 2022 09:02:30 +0000 (11:02 +0200)
When preanalysing spec expression (e.g. expression of an expression
function), the name of iterator specification should not be expanded.

This patch simplifies a complicated condition for delaying expansion
within quantified expressions and iterated component associations.

gcc/ada/

* sem_ch5.adb (Analyze_Iterator_Specification): Delay expansion
based on Full_Analysis flag.

gcc/ada/sem_ch5.adb

index 6d07f3d09e581fd9fea42dd38b83e89bb8513e3f..d0f00b31161a5ff1bde1533dc3d2bde8fe34c631 100644 (file)
@@ -2429,14 +2429,9 @@ package body Sem_Ch5 is
 
       if not Is_Entity_Name (Iter_Name)
 
-        --  When the context is a quantified expression or iterated component
-        --  association, the renaming declaration is delayed until the
-        --  expansion phase if we are doing expansion.
-
-        and then (Nkind (Parent (N)) not in N_Quantified_Expression
-                                          | N_Iterated_Component_Association
-                   or else (Operating_Mode = Check_Semantics
-                            and then not GNATprove_Mode))
+        --  Do not perform this expansion in preanalysis
+
+        and then Full_Analysis
 
         --  Do not perform this expansion when expansion is disabled, where the
         --  temporary may hide the transformation of a selected component into