Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: runtime/vm/parser.cc

Issue 2812323002: Fix look-ahead parsing code in the VM (fixes #29243). (Closed)
Patch Set: update status files Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/language/language_analyzer2.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 8230 matching lines...) Expand 10 before | Expand all | Expand 10 after
8241 int nesting_level = 0; 8241 int nesting_level = 0;
8242 do { 8242 do {
8243 Token::Kind ct = CurrentToken(); 8243 Token::Kind ct = CurrentToken();
8244 if (ct == Token::kLT) { 8244 if (ct == Token::kLT) {
8245 nesting_level++; 8245 nesting_level++;
8246 } else if (ct == Token::kGT) { 8246 } else if (ct == Token::kGT) {
8247 nesting_level--; 8247 nesting_level--;
8248 } else if (ct == Token::kSHR) { 8248 } else if (ct == Token::kSHR) {
8249 nesting_level -= 2; 8249 nesting_level -= 2;
8250 } else if (ct == Token::kIDENT) { 8250 } else if (ct == Token::kIDENT) {
8251 // Check to see if it is a qualified identifier. 8251 if (IsFunctionTypeSymbol()) {
8252 if (LookaheadToken(1) == Token::kPERIOD) { 8252 if (!TryParseType(false)) {
8253 // Consume the identifier, the period will be consumed below. 8253 return false;
8254 ConsumeToken(); 8254 }
8255 continue;
8256 } else {
8257 // Check to see if it is a qualified identifier.
8258 if (LookaheadToken(1) == Token::kPERIOD) {
8259 // Consume the identifier, the period will be consumed below.
8260 ConsumeToken();
8261 }
8255 } 8262 }
8256 } else if (ct != Token::kCOMMA) { 8263 } else if (ct != Token::kCOMMA) {
8257 return false; 8264 return false;
8258 } 8265 }
8259 ConsumeToken(); 8266 ConsumeToken();
8260 } while (nesting_level > 0); 8267 } while (nesting_level > 0);
8261 if (nesting_level < 0) { 8268 if (nesting_level < 0) {
8262 return false; 8269 return false;
8263 } 8270 }
8264 return true; 8271 return true;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
8377 if (allow_void) { 8384 if (allow_void) {
8378 found = true; 8385 found = true;
8379 } else if (!IsFunctionTypeSymbol()) { 8386 } else if (!IsFunctionTypeSymbol()) {
8380 return false; 8387 return false;
8381 } 8388 }
8382 } else if ((CurrentToken() == Token::kIDENT) && !IsFunctionTypeSymbol()) { 8389 } else if ((CurrentToken() == Token::kIDENT) && !IsFunctionTypeSymbol()) {
8383 // 'Function' not followed by '(' or '<' means the Function class. 8390 // 'Function' not followed by '(' or '<' means the Function class.
8384 if (!TryParseQualIdent()) { 8391 if (!TryParseQualIdent()) {
8385 return false; 8392 return false;
8386 } 8393 }
8387 if ((CurrentToken() == Token::kLT) && !TryParseTypeParameters()) { 8394 if ((CurrentToken() == Token::kLT) && !TryParseTypeArguments()) {
8388 return false; 8395 return false;
8389 } 8396 }
8390 found = true; 8397 found = true;
8391 } 8398 }
8392 while (IsFunctionTypeSymbol()) { 8399 while (IsFunctionTypeSymbol()) {
8393 ConsumeToken(); 8400 ConsumeToken();
8394 if ((CurrentToken() == Token::kLT) && !TryParseTypeParameters()) { 8401 if ((CurrentToken() == Token::kLT) && !TryParseTypeParameters()) {
8395 return false; 8402 return false;
8396 } 8403 }
8397 if (CurrentToken() == Token::kLPAREN) { 8404 if (CurrentToken() == Token::kLPAREN) {
(...skipping 6794 matching lines...) Expand 10 before | Expand all | Expand 10 after
15192 const ArgumentListNode& function_args, 15199 const ArgumentListNode& function_args,
15193 const LocalVariable* temp_for_last_arg, 15200 const LocalVariable* temp_for_last_arg,
15194 bool is_super_invocation) { 15201 bool is_super_invocation) {
15195 UNREACHABLE(); 15202 UNREACHABLE();
15196 return NULL; 15203 return NULL;
15197 } 15204 }
15198 15205
15199 } // namespace dart 15206 } // namespace dart
15200 15207
15201 #endif // DART_PRECOMPILED_RUNTIME 15208 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « no previous file | tests/language/language_analyzer2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698