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

Unified Diff: pkg/analyzer/lib/src/fasta/ast_builder.dart

Issue 2772773003: Parse RedirectingConstructorInvocation with Fasta. (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/fasta/ast_builder.dart
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 63d3b1e9d28c38efc5e9ee4deb2dcbb6d4cb478b..f232464f6f77281df5964d0f4642bfc0e0360865 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -1499,19 +1499,32 @@ class AstBuilder extends ScopeListener {
var initializers = <ConstructorInitializer>[];
for (Object initializerObject in initializerObjects) {
if (initializerObject is FunctionExpressionInvocation) {
- var superExpression = initializerObject.function as SuperExpression;
- initializers.add(ast.superConstructorInvocation(
- superExpression.superKeyword,
- null,
- null,
- initializerObject.argumentList));
+ Expression function = initializerObject.function;
+ if (function is SuperExpression) {
+ initializers.add(ast.superConstructorInvocation(function.superKeyword,
+ null, null, initializerObject.argumentList));
+ } else {
+ initializers.add(ast.redirectingConstructorInvocation(
+ (function as ThisExpression).thisKeyword,
+ null,
+ null,
+ initializerObject.argumentList));
+ }
} else if (initializerObject is MethodInvocation) {
- var superExpression = initializerObject.target as SuperExpression;
- initializers.add(ast.superConstructorInvocation(
- superExpression.superKeyword,
- initializerObject.operator,
- initializerObject.methodName,
- initializerObject.argumentList));
+ Expression target = initializerObject.target;
+ if (target is SuperExpression) {
+ initializers.add(ast.superConstructorInvocation(
+ target.superKeyword,
+ initializerObject.operator,
+ initializerObject.methodName,
+ initializerObject.argumentList));
+ } else {
+ initializers.add(ast.redirectingConstructorInvocation(
+ (target as ThisExpression).thisKeyword,
+ initializerObject.operator,
+ initializerObject.methodName,
+ initializerObject.argumentList));
+ }
} else if (initializerObject is AssignmentExpression) {
analyzer.Token thisKeyword;
analyzer.Token period;
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698