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

Unified Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 2492633002: Create AST structure for asserts in constructor initializers (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e325da2e537b216f1974ea5428c4e587d60efe76..a608baddbe1fbba5e97588bf475f4d3e1d94c8bd 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -5981,9 +5981,7 @@ class Parser {
* assertInitializer ::=
* 'assert' '(' expression [',' expression] ')'
*/
- void _parseAssertInitializer() {
- // TODO(brianwilkerson) Capture the syntax in the AST using a new class,
- // such as AssertInitializer
+ AssertInitializer _parseAssertInitializer() {
Token keyword = getAndAdvance();
Token leftParen = _expect(TokenType.OPEN_PAREN);
Expression expression = parseExpression2();
@@ -5994,8 +5992,8 @@ class Parser {
message = parseExpression2();
}
Token rightParen = _expect(TokenType.CLOSE_PAREN);
-// return new AssertInitializer(
-// keyword, leftParen, expression, comma, message, rightParen);
+ return new AssertInitializer(
+ keyword, leftParen, expression, comma, message, rightParen);
}
/**
@@ -6230,7 +6228,7 @@ class Parser {
_reportErrorForCurrentToken(ParserErrorCode.MISSING_INITIALIZER);
} else if (_enableAssertInitializer &&
_matchesKeyword(Keyword.ASSERT)) {
- _parseAssertInitializer();
+ initializers.add(_parseAssertInitializer());
} else {
initializers.add(parseConstructorFieldInitializer(false));
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698