]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 20 Jan 2014 16:02:58 +0000 (17:02 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 20 Jan 2014 16:02:58 +0000 (17:02 +0100)
2014-01-20  Ed Schonberg  <schonberg@adacore.com>

* sem_ch4.adb (Analyze_Quantified_Expression): If after
pre-analysis  the loop parameter specification has been
rewritten as a iterator specification, propagate the change to
the quantified expression, for ASIS navigtion needs.

2014-01-20  Vincent Celier  <celier@adacore.com>

* par-ch10.adb: Minor error message change: escape [ and ].

From-SVN: r206842

gcc/ada/ChangeLog
gcc/ada/par-ch10.adb
gcc/ada/sem_ch4.adb

index fec727aab4f3f589753aa34721a3f1eb9695aada..3d73ee33d58c696fa85021c0d1b12490e12e7de1 100644 (file)
@@ -1,3 +1,14 @@
+2014-01-20  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch4.adb (Analyze_Quantified_Expression): If after
+       pre-analysis  the loop parameter specification has been
+       rewritten as a iterator specification, propagate the change to
+       the quantified expression, for ASIS navigtion needs.
+
+2014-01-20  Vincent Celier  <celier@adacore.com>
+
+       * par-ch10.adb: Minor error message change: escape [ and ].
+
 2014-01-20  Robert Dewar  <dewar@adacore.com>
 
        * checks.adb: Make warnings on exceptions into errors in GNATprove mode.
index ddd88b3eea3fa2bae8f90447925f31b614d00cfa..00b294b1eddab8f9b2cd137124c72a705475d9de 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2012, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2013, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -360,7 +360,7 @@ package body Ch10 is
                (File_Name (Current_Source_File)) = Expect_Body
          then
             Error_Msg_BC -- CODEFIX
-              ("keyword BODY expected here [see file name]");
+              ("keyword BODY expected here '[see file name']");
             Restore_Scan_State (Scan_State);
             Set_Unit (Comp_Unit_Node, P_Package (Pf_Pbod_Pexp));
          else
index a95aea9e47073cdffd5ecfe6a6620145e7bc6ceb..fcf6c75f18f49ea6101ee24b2f5f8feb28ffadb9 100644 (file)
@@ -3667,7 +3667,28 @@ package body Sem_Ch4 is
          end if;
 
       else pragma Assert (Present (Loop_Parameter_Specification (N)));
-         Preanalyze (Loop_Parameter_Specification (N));
+         declare
+            Loop_Par : constant Node_Id := Loop_Parameter_Specification (N);
+
+         begin
+            Preanalyze (Loop_Par);
+
+            if Nkind (Discrete_Subtype_Definition (Loop_Par)) =
+              N_Function_Call
+              and then Parent (Loop_Par) /= N
+            then
+               --  The parser cannot distinguish between a loop specification
+               --  and an iterator specification. If after pre-analysis the
+               --  proper form has been recognized, rewrite the expression to
+               --  reflect the right kind. The analysis of the loop has been
+               --  performed on a copy that has the proper iterator form. This
+               --  is needed in particular for ASIS navigation.
+
+               Set_Loop_Parameter_Specification (N, Empty);
+               Set_Iterator_Specification (N,
+                 New_Copy_Tree (Iterator_Specification (Parent (Loop_Par))));
+            end if;
+         end;
       end if;
 
       Preanalyze_And_Resolve (Cond, Standard_Boolean);