Chromium Code Reviews| Index: pkg/analyzer/lib/src/generated/parser.dart |
| diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart |
| index fcf9b0132a2d4265d7527c05f679a4c09e57fd81..8efed5534eb4ae140ece8435b1eea7d2f68eca33 100644 |
| --- a/pkg/analyzer/lib/src/generated/parser.dart |
| +++ b/pkg/analyzer/lib/src/generated/parser.dart |
| @@ -2862,6 +2862,7 @@ class Parser { |
| "parseDirective invoked in an invalid state (currentToken = $_currentToken)"); |
| } |
| } |
| + |
| Directive directive = parseDirective(); |
| if (declarations.length > 0 && !directiveFoundAfterDeclaration) { |
| _reportErrorForToken(ParserErrorCode.DIRECTIVE_AFTER_DECLARATION, |
| @@ -4346,6 +4347,30 @@ class Parser { |
| } |
| /** |
| + * Parse an assert within a constructor's initializer list. Return the assert. |
| + * |
| + * This method assumes that the current token matches `Keyword.ASSERT`. |
| + * |
| + * assertInitializer ::= |
| + * 'assert' '(' expression [',' expression] ')' |
| + */ |
| + void _parseAssertInitializer() { |
| + // return AssertInitializer |
|
scheglov
2016/08/27 00:06:45
I don't quite understand what this comment means.
Brian Wilkerson
2016/08/27 00:32:44
Done
It was a reminder to "Capture the syntax in
|
| + Token keyword = getAndAdvance(); |
| + Token leftParen = _expect(TokenType.OPEN_PAREN); |
| + Expression expression = parseExpression2(); |
| + Token comma; |
| + Expression message; |
| + if (_matches(TokenType.COMMA)) { |
| + comma = getAndAdvance(); |
| + message = parseExpression2(); |
| + } |
| + Token rightParen = _expect(TokenType.CLOSE_PAREN); |
| +// return new AssertInitializer( |
| +// keyword, leftParen, expression, comma, message, rightParen); |
| + } |
| + |
| + /** |
| * Parse an assert statement. Return the assert statement. |
| * |
| * This method assumes that the current token matches `Keyword.ASSERT`. |
| @@ -5502,6 +5527,8 @@ class Parser { |
| } else if (_matches(TokenType.OPEN_CURLY_BRACKET) || |
| _matches(TokenType.FUNCTION)) { |
| _reportErrorForCurrentToken(ParserErrorCode.MISSING_INITIALIZER); |
| + } else if (_matchesKeyword(Keyword.ASSERT)) { |
| + _parseAssertInitializer(); |
| } else { |
| initializers.add(_parseConstructorFieldInitializer(false)); |
| } |
| @@ -8282,6 +8309,7 @@ class Parser { |
| Keyword keyword = _currentToken.keyword; |
| return keyword == Keyword.CASE || keyword == Keyword.DEFAULT; |
| } |
| + |
| while (!atEndOrNextMember()) { |
| _advance(); |
| } |
| @@ -8625,6 +8653,7 @@ class Parser { |
| type == TokenType.INT || |
| type == TokenType.DOUBLE; |
| } |
| + |
| while ((_tokenMatchesIdentifier(token) && !isKeywordAfterUri(token)) || |
| isValidInUri(token)) { |
| token = token.next; |