OLD | NEW |
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 Loading... |
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; | |
2701 token = expect('assert', token); | 2700 token = expect('assert', token); |
2702 token = expect('(', token); | 2701 expect('(', token); |
2703 bool old = mayParseFunctionExpressions; | 2702 token = parseArguments(token); |
2704 mayParseFunctionExpressions = true; | 2703 listener.handleAssertStatement(assertKeyword, token); |
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); | |
2714 return expectSemicolon(token); | 2704 return expectSemicolon(token); |
2715 } | 2705 } |
2716 | 2706 |
2717 Token parseContinueStatement(Token token) { | 2707 Token parseContinueStatement(Token token) { |
2718 assert(optional('continue', token)); | 2708 assert(optional('continue', token)); |
2719 Token continueKeyword = token; | 2709 Token continueKeyword = token; |
2720 token = token.next; | 2710 token = token.next; |
2721 bool hasTarget = false; | 2711 bool hasTarget = false; |
2722 if (token.isIdentifier()) { | 2712 if (token.isIdentifier()) { |
2723 token = parseIdentifier(token); | 2713 token = parseIdentifier(token); |
2724 hasTarget = true; | 2714 hasTarget = true; |
2725 } | 2715 } |
2726 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 2716 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
2727 return expectSemicolon(token); | 2717 return expectSemicolon(token); |
2728 } | 2718 } |
2729 | 2719 |
2730 Token parseEmptyStatement(Token token) { | 2720 Token parseEmptyStatement(Token token) { |
2731 listener.handleEmptyStatement(token); | 2721 listener.handleEmptyStatement(token); |
2732 return expectSemicolon(token); | 2722 return expectSemicolon(token); |
2733 } | 2723 } |
2734 } | 2724 } |
OLD | NEW |