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

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

Issue 1325843003: Add optional message to assert in Dart2js. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 3 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 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 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after
2632 if (token.isIdentifier()) { 2632 if (token.isIdentifier()) {
2633 token = parseIdentifier(token); 2633 token = parseIdentifier(token);
2634 hasTarget = true; 2634 hasTarget = true;
2635 } 2635 }
2636 listener.handleBreakStatement(hasTarget, breakKeyword, token); 2636 listener.handleBreakStatement(hasTarget, breakKeyword, token);
2637 return expectSemicolon(token); 2637 return expectSemicolon(token);
2638 } 2638 }
2639 2639
2640 Token parseAssertStatement(Token token) { 2640 Token parseAssertStatement(Token token) {
2641 Token assertKeyword = token; 2641 Token assertKeyword = token;
2642 Token commaToken = null;
2642 token = expect('assert', token); 2643 token = expect('assert', token);
2643 expect('(', token); 2644 token = expect('(', token);
2644 token = parseArguments(token); 2645 bool old = mayParseFunctionExpressions;
2645 listener.handleAssertStatement(assertKeyword, token); 2646 mayParseFunctionExpressions = true;
2647 token = parseExpression(token);
2648 if (optional(',', token)) {
2649 commaToken = token;
2650 token = token.next;
2651 token = parseExpression(token);
2652 }
2653 token = expect(')', token);
2654 mayParseFunctionExpressions = old;
2655 listener.handleAssertStatement(assertKeyword, commaToken, token);
2646 return expectSemicolon(token); 2656 return expectSemicolon(token);
2647 } 2657 }
2648 2658
2649 Token parseContinueStatement(Token token) { 2659 Token parseContinueStatement(Token token) {
2650 assert(optional('continue', token)); 2660 assert(optional('continue', token));
2651 Token continueKeyword = token; 2661 Token continueKeyword = token;
2652 token = token.next; 2662 token = token.next;
2653 bool hasTarget = false; 2663 bool hasTarget = false;
2654 if (token.isIdentifier()) { 2664 if (token.isIdentifier()) {
2655 token = parseIdentifier(token); 2665 token = parseIdentifier(token);
2656 hasTarget = true; 2666 hasTarget = true;
2657 } 2667 }
2658 listener.handleContinueStatement(hasTarget, continueKeyword, token); 2668 listener.handleContinueStatement(hasTarget, continueKeyword, token);
2659 return expectSemicolon(token); 2669 return expectSemicolon(token);
2660 } 2670 }
2661 2671
2662 Token parseEmptyStatement(Token token) { 2672 Token parseEmptyStatement(Token token) {
2663 listener.handleEmptyStatement(token); 2673 listener.handleEmptyStatement(token);
2664 return expectSemicolon(token); 2674 return expectSemicolon(token);
2665 } 2675 }
2666 } 2676 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698