]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Simplify folding of selected components with qualified prefixes
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 9 Dec 2020 16:02:26 +0000 (17:02 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 28 Apr 2021 09:38:10 +0000 (05:38 -0400)
gcc/ada/

* sem_eval.adb (Eval_Selected_Component): Simplify with
Unqualify.

gcc/ada/sem_eval.adb

index 263b9fdd530b13f54dca8b675c2a836a262640df..7b1e48d8ded6aa697bb6a30a6112e40a0ccef79c 100644 (file)
@@ -3847,11 +3847,7 @@ package body Sem_Eval is
          --  Simplify a selected_component on an aggregate by extracting
          --  the field directly.
 
-         Node := Prefix (N);
-
-         while Nkind (Node) = N_Qualified_Expression loop
-            Node := Expression (Node);
-         end loop;
+         Node := Unqualify (Prefix (N));
 
          if Nkind (Node) = N_Aggregate then
             Comp := First (Component_Associations (Node));