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

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

Issue 2803113002: Fix for parsing named factory constructors with Fasta. (Closed)
Patch Set: Restore toAnalyzerToken() invocation. Created 3 years, 8 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_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 e9c43d98a0694389ecde59ea50045057b0e539a6..5a7a7f6b5e5725dfd797a365a0affa4fc8c68e1e 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -1571,15 +1571,31 @@ class AstBuilder extends ScopeListener {
_Modifiers modifiers = pop();
List<Annotation> metadata = pop();
Comment comment = pop();
+
+ // Decompose the preliminary ConstructorName into the type name and
+ // the actual constructor name.
+ SimpleIdentifier returnType;
+ analyzer.Token period;
+ SimpleIdentifier name;
+ Identifier typeName = constructorName.type.name;
+ if (typeName is SimpleIdentifier) {
+ returnType = typeName;
+ } else if (typeName is PrefixedIdentifier) {
+ returnType = typeName.prefix;
+ period = typeName.period;
+ name =
+ ast.simpleIdentifier(typeName.identifier.token, isDeclaration: true);
+ }
+
push(ast.constructorDeclaration(
comment,
metadata,
toAnalyzerToken(modifiers?.externalKeyword),
toAnalyzerToken(modifiers?.finalConstOrVarKeyword),
toAnalyzerToken(factoryKeyword),
- constructorName.type.name,
- constructorName.period,
- constructorName.name,
+ ast.simpleIdentifier(returnType.token),
+ period,
+ name,
parameters,
toAnalyzerToken(separator),
null,
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698