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

Side by Side Diff: pkg/front_end/lib/src/fasta/parser/parser.dart

Issue 2769113004: Setup type and modifiers of local variables on creation. (Closed)
Patch Set: Created 3 years, 9 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
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 library fasta.parser.parser; 5 library fasta.parser.parser;
6 6
7 import '../scanner.dart' show ErrorToken; 7 import '../scanner.dart' show ErrorToken;
8 8
9 import '../scanner/recover.dart' show closeBraceFor, skipToEof; 9 import '../scanner/recover.dart' show closeBraceFor, skipToEof;
10 10
(...skipping 3232 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 } 3243 }
3244 3244
3245 Token parseVariablesDeclarationNoSemicolon(Token token) { 3245 Token parseVariablesDeclarationNoSemicolon(Token token) {
3246 // Only called when parsing a for loop, so this is for parsing locals. 3246 // Only called when parsing a for loop, so this is for parsing locals.
3247 return parseVariablesDeclarationMaybeSemicolon(token, false); 3247 return parseVariablesDeclarationMaybeSemicolon(token, false);
3248 } 3248 }
3249 3249
3250 Token parseVariablesDeclarationMaybeSemicolon( 3250 Token parseVariablesDeclarationMaybeSemicolon(
3251 Token token, bool endWithSemicolon) { 3251 Token token, bool endWithSemicolon) {
3252 int count = 1; 3252 int count = 1;
3253 listener.beginVariablesDeclaration(token);
3254 token = parseModifiers(token); 3253 token = parseModifiers(token);
3255 token = parseTypeOpt(token); 3254 token = parseTypeOpt(token);
3255 listener.beginVariablesDeclaration(token);
3256 token = parseOptionallyInitializedIdentifier(token); 3256 token = parseOptionallyInitializedIdentifier(token);
3257 while (optional(',', token)) { 3257 while (optional(',', token)) {
3258 token = parseOptionallyInitializedIdentifier(token.next); 3258 token = parseOptionallyInitializedIdentifier(token.next);
3259 ++count; 3259 ++count;
3260 } 3260 }
3261 if (endWithSemicolon) { 3261 if (endWithSemicolon) {
3262 Token semicolon = token; 3262 Token semicolon = token;
3263 token = expectSemicolon(semicolon); 3263 token = expectSemicolon(semicolon);
3264 listener.endVariablesDeclaration(count, semicolon); 3264 listener.endVariablesDeclaration(count, semicolon);
3265 return token; 3265 return token;
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
3701 break; 3701 break;
3702 } 3702 }
3703 if (isRecoverable) { 3703 if (isRecoverable) {
3704 listener.handleRecoverableError(token, kind, arguments); 3704 listener.handleRecoverableError(token, kind, arguments);
3705 return null; 3705 return null;
3706 } else { 3706 } else {
3707 return listener.handleUnrecoverableError(token, kind, arguments); 3707 return listener.handleUnrecoverableError(token, kind, arguments);
3708 } 3708 }
3709 } 3709 }
3710 } 3710 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698