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

Side by Side Diff: pkg/compiler/lib/src/scanner/parser.dart

Issue 796363003: dart2js: accept const map literals as expression statements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/co19/co19-dart2dart.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 part of scanner; 5 part of scanner;
6 6
7 class FormalParameterType { 7 class FormalParameterType {
8 final String type; 8 final String type;
9 const FormalParameterType(this.type); 9 const FormalParameterType(this.type);
10 bool get isRequired => this == REQUIRED; 10 bool get isRequired => this == REQUIRED;
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 } 1624 }
1625 } 1625 }
1626 return parseExpressionStatement(token); 1626 return parseExpressionStatement(token);
1627 } 1627 }
1628 1628
1629 Token parseExpressionStatementOrConstDeclaration(Token token) { 1629 Token parseExpressionStatementOrConstDeclaration(Token token) {
1630 assert(identical(token.stringValue, 'const')); 1630 assert(identical(token.stringValue, 'const'));
1631 if (isModifier(token.next)) { 1631 if (isModifier(token.next)) {
1632 return parseVariablesDeclaration(token); 1632 return parseVariablesDeclaration(token);
1633 } 1633 }
1634 Token identifier = peekIdentifierAfterOptionalType(token.next); 1634
ahe 2014/12/12 14:32:41 peekIdentifierAfterOptionalType is only called onc
floitsch 2014/12/12 14:38:47 Done.
1635 Token identifier;
1636 if (optional('void', token.next) || token.next.isIdentifier()) {
1637 identifier = peekIdentifierAfterOptionalType(token.next);
1638 }
1635 if (identifier != null) { 1639 if (identifier != null) {
1636 assert(identifier.isIdentifier()); 1640 assert(identifier.isIdentifier());
1637 Token afterId = identifier.next; 1641 Token afterId = identifier.next;
1638 int afterIdKind = afterId.kind; 1642 int afterIdKind = afterId.kind;
1639 if (identical(afterIdKind, EQ_TOKEN) || 1643 if (identical(afterIdKind, EQ_TOKEN) ||
1640 identical(afterIdKind, SEMICOLON_TOKEN) || 1644 identical(afterIdKind, SEMICOLON_TOKEN) ||
1641 identical(afterIdKind, COMMA_TOKEN)) { 1645 identical(afterIdKind, COMMA_TOKEN)) {
1642 // We are looking at "const type identifier" followed by '=', ';', or 1646 // We are looking at "const type identifier" followed by '=', ';', or
1643 // ','. 1647 // ','.
1644 return parseVariablesDeclaration(token); 1648 return parseVariablesDeclaration(token);
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
2593 } 2597 }
2594 listener.handleContinueStatement(hasTarget, continueKeyword, token); 2598 listener.handleContinueStatement(hasTarget, continueKeyword, token);
2595 return expectSemicolon(token); 2599 return expectSemicolon(token);
2596 } 2600 }
2597 2601
2598 Token parseEmptyStatement(Token token) { 2602 Token parseEmptyStatement(Token token) {
2599 listener.handleEmptyStatement(token); 2603 listener.handleEmptyStatement(token);
2600 return expectSemicolon(token); 2604 return expectSemicolon(token);
2601 } 2605 }
2602 } 2606 }
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698