Propagete hoisted this also from state machines. Fixes #6687
[mono.git] / mcs / mcs / cs-tokenizer.cs
index e57257ddf75ba3ab0151e38983bf1f3035242c22..7475a3055fabcd00e8a69901c526ec90f8046212 100644 (file)
@@ -827,11 +827,13 @@ namespace Mono.CSharp
                                                PushPosition ();
                                                xtoken ();
                                                if (xtoken () != Token.ARROW)
-                                                       res = -1;
+                                                       goto default;
 
                                                PopPosition ();
                                                break;
                                        default:
+                                               // peek_token could overwrite id_buffer
+                                               id_builder [0] = 'a'; id_builder [1] = 's'; id_builder [2] = 'y'; id_builder [3] = 'n'; id_builder [4] = 'c';
                                                res = -1;
                                                break;
                                        }
@@ -1103,9 +1105,14 @@ namespace Mono.CSharp
                start:
                        int the_token = token ();
                        if (the_token == Token.OPEN_BRACKET) {
-                               do {
+                               while (true) {
                                        the_token = token ();
-                               } while (the_token != Token.CLOSE_BRACKET);
+                                       if (the_token == Token.EOF)
+                                               return true;
+
+                                       if (the_token == Token.CLOSE_BRACKET)
+                                               break;
+                               }
                                the_token = token ();
                        } else if (the_token == Token.IN || the_token == Token.OUT) {
                                the_token = token ();