2004-09-15 Marek Safar <marek.safar@seznam.cz>
authorMarek Safar <marek.safar@gmail.com>
Wed, 15 Sep 2004 14:21:50 +0000 (14:21 -0000)
committerMarek Safar <marek.safar@gmail.com>
Wed, 15 Sep 2004 14:21:50 +0000 (14:21 -0000)
Fixed bug #64226
* cs-parser.jay: Add error 1017 report.

svn path=/trunk/mcs/; revision=33936

mcs/mcs/ChangeLog
mcs/mcs/cs-parser.jay

index b9342f10dd494c9699eca5478b661739f453edb4..e7404ab60ffb81028273fe9edfda6e412207e0f5 100755 (executable)
@@ -1,3 +1,8 @@
+2004-09-15  Marek Safar  <marek.safar@seznam.cz>
+
+       Fixed bug #64226
+       * cs-parser.jay: Add error 1017 report.
+
 2004-09-15  Marek Safar  <marek.safar@seznam.cz>
 
        Fixed bug #59980, #64224
index c11750ee1cdacd8fc3ea3a49d3f83579d5b8b382..4c89814e1f0eaf6899e413e18d91d4ed9b505e75 100755 (executable)
@@ -3770,19 +3770,23 @@ try_statement
        : TRY block catch_clauses 
        {
                Catch g = null;
-               ArrayList s = new ArrayList (4);
                
-               foreach (Catch cc in (ArrayList) $3) {
-                       if (cc.IsGeneral)
+               ArrayList c = (ArrayList)$3;
+               for (int i = 0; i < c.Count; ++i) {
+                       Catch cc = (Catch) c [i];
+                       if (cc.IsGeneral) {
+                               if (i != c.Count - 1)
+                                       Report.Error (1017, cc.loc, "Empty catch block must be the last in a series of catch blocks");
                                g = cc;
-                       else
-                               s.Add (cc);
+                               c.RemoveAt (i);
+                               i--;
+                       }
                }
 
                // Now s contains the list of specific catch clauses
                // and g contains the general one.
                
-               $$ = new Try ((Block) $2, s, g, null, lexer.Location);
+               $$ = new Try ((Block) $2, c, g, null, lexer.Location);
        }
        | TRY block opt_catch_clauses FINALLY block
          {