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 fb2421a4b64328364516a7e5716c52cca0bdf065..bc54281f9b402161ad70ce93c0c0bba24c361675 100644 |
--- a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart |
+++ b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart |
@@ -1125,12 +1125,11 @@ class AstBuilder extends ScopeListener { |
List<ConstructorInitializer> initializers = null; // TODO(paulberry) |
Token separator = null; // TODO(paulberry) |
FormalParameterList parameters = pop(); |
- /* TypeParameterList typeParameters = */ pop(); // TODO(paulberry) |
+ TypeParameterList typeParameters = pop(); // TODO(paulberry) |
var name = pop(); |
- // TODO(paulberry) |
- // analyzer.Token propertyKeyword = toAnalyzerToken(getOrSet); |
- /* TypeAnnotation returnType = */ pop(); // TODO(paulberry) |
- |
+ Token operatorKeyword = null; // TODO(paulberry) |
+ TypeAnnotation returnType = pop(); // TODO(paulberry) |
+ Token modifierKeyword = null; // TODO(paulberry) |
Token externalKeyword = null; |
Token constKeyword = null; |
Token factoryKeyword = null; |
@@ -1158,23 +1157,48 @@ class AstBuilder extends ScopeListener { |
SimpleIdentifier returnType2; |
Token period; |
SimpleIdentifier name2; |
+ void unnamedConstructor() { |
+ push(ast.constructorDeclaration( |
+ comment, |
+ metadata, |
+ toAnalyzerToken(externalKeyword), |
+ toAnalyzerToken(constKeyword), |
+ toAnalyzerToken(factoryKeyword), |
+ returnType2, |
+ toAnalyzerToken(period), |
+ name2, |
+ parameters, |
+ toAnalyzerToken(separator), |
+ initializers, |
+ redirectedConstructor, |
+ body)); |
+ } |
+ |
+ void method() { |
+ push(ast.methodDeclaration( |
+ comment, |
+ metadata, |
+ toAnalyzerToken(externalKeyword), |
+ toAnalyzerToken(modifierKeyword), |
+ returnType, |
+ toAnalyzerToken(getOrSet), |
+ toAnalyzerToken(operatorKeyword), |
+ name, |
+ typeParameters, |
+ parameters, |
+ body)); |
+ } |
+ |
if (name is SimpleIdentifier) { |
returnType2 = name; |
+ if (name.name == className) { |
+ unnamedConstructor(); |
+ } else { |
+ method(); |
+ } |
+ } else { |
+ throw new UnimplementedError(); |
} |
- push(ast.constructorDeclaration( |
- comment, |
- metadata, |
- toAnalyzerToken(externalKeyword), |
- toAnalyzerToken(constKeyword), |
- toAnalyzerToken(factoryKeyword), |
- returnType2, |
- toAnalyzerToken(period), |
- name2, |
- parameters, |
- toAnalyzerToken(separator), |
- initializers, |
- redirectedConstructor, |
- body)); |
} |
@override |