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

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

Issue 2797303003: Fix for parsing annotations before variables in for-loop with Fasta. (Closed)
Patch Set: 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 | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | no next file » | 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 library fasta.parser.parser; 5 library fasta.parser.parser;
6 6
7 import '../fasta_codes.dart' 7 import '../fasta_codes.dart'
8 show 8 show
9 FastaCode, 9 FastaCode,
10 FastaMessage, 10 FastaMessage,
(...skipping 3361 matching lines...) Expand 10 before | Expand all | Expand 10 after
3372 } 3372 }
3373 return parseForRest(forKeyword, leftParenthesis, token); 3373 return parseForRest(forKeyword, leftParenthesis, token);
3374 } 3374 }
3375 } 3375 }
3376 3376
3377 Token parseVariablesDeclarationOrExpressionOpt(Token token) { 3377 Token parseVariablesDeclarationOrExpressionOpt(Token token) {
3378 final String value = token.stringValue; 3378 final String value = token.stringValue;
3379 if (identical(value, ';')) { 3379 if (identical(value, ';')) {
3380 listener.handleNoExpression(token); 3380 listener.handleNoExpression(token);
3381 return token; 3381 return token;
3382 } else if (isOneOf3(token, 'var', 'final', 'const')) { 3382 } else if (isOneOf4(token, '@', 'var', 'final', 'const')) {
3383 return parseVariablesDeclarationNoSemicolon(token); 3383 return parseVariablesDeclarationNoSemicolon(token);
3384 } 3384 }
3385 Token identifier = peekIdentifierAfterType(token); 3385 Token identifier = peekIdentifierAfterType(token);
3386 if (identifier != null) { 3386 if (identifier != null) {
3387 assert(identifier.isIdentifier()); 3387 assert(identifier.isIdentifier());
3388 if (isOneOf4(identifier.next, '=', ';', ',', 'in')) { 3388 if (isOneOf4(identifier.next, '=', ';', ',', 'in')) {
3389 return parseVariablesDeclarationNoSemicolon(token); 3389 return parseVariablesDeclarationNoSemicolon(token);
3390 } 3390 }
3391 } 3391 }
3392 return parseExpression(token); 3392 return parseExpression(token);
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
3855 previous.setNext(firstToken); 3855 previous.setNext(firstToken);
3856 beforeToken = firstToken; 3856 beforeToken = firstToken;
3857 } 3857 }
3858 } 3858 }
3859 3859
3860 typedef FastaMessage NoArgument(Uri uri, int charOffset); 3860 typedef FastaMessage NoArgument(Uri uri, int charOffset);
3861 3861
3862 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token); 3862 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token);
3863 3863
3864 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string); 3864 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string);
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698