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

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

Issue 1325843003: Add optional message to assert in Dart2js. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Reintroduce assertHelper for asserts without messages. 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 library dart2js.parser; 5 library dart2js.parser;
6 6
7 import '../diagnostics/messages.dart' show 7 import '../diagnostics/messages.dart' show
8 MessageKind; 8 MessageKind;
9 import '../tokens/keyword.dart' show 9 import '../tokens/keyword.dart' show
10 Keyword; 10 Keyword;
(...skipping 2679 matching lines...) Expand 10 before | Expand all | Expand 10 after
2690 if (token.isIdentifier()) { 2690 if (token.isIdentifier()) {
2691 token = parseIdentifier(token); 2691 token = parseIdentifier(token);
2692 hasTarget = true; 2692 hasTarget = true;
2693 } 2693 }
2694 listener.handleBreakStatement(hasTarget, breakKeyword, token); 2694 listener.handleBreakStatement(hasTarget, breakKeyword, token);
2695 return expectSemicolon(token); 2695 return expectSemicolon(token);
2696 } 2696 }
2697 2697
2698 Token parseAssertStatement(Token token) { 2698 Token parseAssertStatement(Token token) {
2699 Token assertKeyword = token; 2699 Token assertKeyword = token;
2700 Token commaToken = null;
2700 token = expect('assert', token); 2701 token = expect('assert', token);
2701 expect('(', token); 2702 token = expect('(', token);
2702 token = parseArguments(token); 2703 bool old = mayParseFunctionExpressions;
2703 listener.handleAssertStatement(assertKeyword, token); 2704 mayParseFunctionExpressions = true;
2705 token = parseExpression(token);
2706 if (optional(',', token)) {
2707 commaToken = token;
2708 token = token.next;
2709 token = parseExpression(token);
2710 }
2711 token = expect(')', token);
2712 mayParseFunctionExpressions = old;
2713 listener.handleAssertStatement(assertKeyword, commaToken, token);
2704 return expectSemicolon(token); 2714 return expectSemicolon(token);
2705 } 2715 }
2706 2716
2707 Token parseContinueStatement(Token token) { 2717 Token parseContinueStatement(Token token) {
2708 assert(optional('continue', token)); 2718 assert(optional('continue', token));
2709 Token continueKeyword = token; 2719 Token continueKeyword = token;
2710 token = token.next; 2720 token = token.next;
2711 bool hasTarget = false; 2721 bool hasTarget = false;
2712 if (token.isIdentifier()) { 2722 if (token.isIdentifier()) {
2713 token = parseIdentifier(token); 2723 token = parseIdentifier(token);
2714 hasTarget = true; 2724 hasTarget = true;
2715 } 2725 }
2716 listener.handleContinueStatement(hasTarget, continueKeyword, token); 2726 listener.handleContinueStatement(hasTarget, continueKeyword, token);
2717 return expectSemicolon(token); 2727 return expectSemicolon(token);
2718 } 2728 }
2719 2729
2720 Token parseEmptyStatement(Token token) { 2730 Token parseEmptyStatement(Token token) {
2721 listener.handleEmptyStatement(token); 2731 listener.handleEmptyStatement(token);
2722 return expectSemicolon(token); 2732 return expectSemicolon(token);
2723 } 2733 }
2724 } 2734 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698