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

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

Issue 2742283003: Fix for parsing named constructors 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 | « pkg/analyzer/test/generated/parser_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
index 9367e9f4d9758c9e9864a4860906d70d009c1de6..74b633ec3ae0e4e184c4618bef5e3d1612f591ed 100644
--- a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
+++ b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
@@ -1294,9 +1294,9 @@ class AstBuilder extends ScopeListener {
_Modifiers modifiers = pop();
List<Annotation> metadata = pop();
Comment comment = pop();
- Token period;
- void unnamedConstructor(
- SimpleIdentifier returnType, SimpleIdentifier name) {
+
+ void constructor(SimpleIdentifier returnType, analyzer.Token period,
+ SimpleIdentifier name) {
push(ast.constructorDeclaration(
comment,
metadata,
@@ -1304,7 +1304,7 @@ class AstBuilder extends ScopeListener {
toAnalyzerToken(modifiers?.finalConstOrVarKeyword),
null, // TODO(paulberry): factoryKeyword
returnType,
- toAnalyzerToken(period),
+ period,
name,
parameters,
toAnalyzerToken(separator),
@@ -1331,12 +1331,14 @@ class AstBuilder extends ScopeListener {
if (name is SimpleIdentifier) {
if (name.name == className) {
- unnamedConstructor(name, null);
+ constructor(name, null, null);
} else {
method(null, name);
}
} else if (name is _OperatorName) {
method(name.operatorKeyword, name.name);
+ } else if (name is PrefixedIdentifier) {
+ constructor(name.prefix, name.period, name.identifier);
} else {
throw new UnimplementedError();
}
« no previous file with comments | « pkg/analyzer/test/generated/parser_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698