diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart index 7877443d85b..831fcffd8d8 100644 --- a/pkg/analyzer/test/generated/parser_fasta_test.dart +++ b/pkg/analyzer/test/generated/parser_fasta_test.dart @@ -469,60 +469,6 @@ class ScopeProxy implements Scope { @reflectiveTest class TopLevelParserTest_Fasta extends FastaParserTestCase with TopLevelParserTestMixin { - @override - @failingTest - void - test_function_literal_allowed_in_ArgumentList_in_ConstructorFieldInitializer() { - // TODO(paulberry): Unhandled event: Method - super - .test_function_literal_allowed_in_ArgumentList_in_ConstructorFieldInitializer(); - } - - @override - @failingTest - void - test_function_literal_allowed_in_IndexExpression_in_ConstructorFieldInitializer() { - // TODO(paulberry): Unhandled event: Method - super - .test_function_literal_allowed_in_IndexExpression_in_ConstructorFieldInitializer(); - } - - @override - @failingTest - void - test_function_literal_allowed_in_ListLiteral_in_ConstructorFieldInitializer() { - // TODO(paulberry): Unhandled event: Method - super - .test_function_literal_allowed_in_ListLiteral_in_ConstructorFieldInitializer(); - } - - @override - @failingTest - void - test_function_literal_allowed_in_MapLiteral_in_ConstructorFieldInitializer() { - // TODO(paulberry): Unhandled event: Method - super - .test_function_literal_allowed_in_MapLiteral_in_ConstructorFieldInitializer(); - } - - @override - @failingTest - void - test_function_literal_allowed_in_ParenthesizedExpression_in_ConstructorFieldInitializer() { - // TODO(paulberry): Unhandled event: Method - super - .test_function_literal_allowed_in_ParenthesizedExpression_in_ConstructorFieldInitializer(); - } - - @override - @failingTest - void - test_function_literal_allowed_in_StringInterpolation_in_ConstructorFieldInitializer() { - // TODO(paulberry): Unhandled event: Method - super - .test_function_literal_allowed_in_StringInterpolation_in_ConstructorFieldInitializer(); - } - @override @failingTest void test_parseClassDeclaration_abstract() { 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 92d8f84a9ed..f47af376b5a 100644 --- a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart +++ b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart @@ -1018,6 +1018,54 @@ class AstBuilder extends ScopeListener { push(ast.typeParameterList(toAnalyzerToken(beginToken), typeParameters, toAnalyzerToken(endToken))); } + + @override + void endMethod(Token getOrSet, Token beginToken, Token endToken) { + debugEvent("Method"); + FunctionBody body = _endFunctionBody(); + ConstructorName redirectedConstructor = null; // TODO(paulberry) + List initializers = null; // TODO(paulberry) + Token separator = null; // TODO(paulberry) + FormalParameterList parameters = pop(); + TypeParameterList typeParameters = pop(); + var name = pop(); + analyzer.Token propertyKeyword = toAnalyzerToken(getOrSet); + TypeAnnotation returnType = pop(); + // TODO(paulberry): handle modifiers. + var modifiers = pop(); + assert(modifiers == null); + Token externalKeyword = null; // TODO(paulberry) + Token constKeyword = null; // TODO(paulberry) + Token factoryKeyword = null; // TODO(paulberry) + List metadata = pop(); + // TODO(paulberry): capture doc comments. + Comment comment = null; + SimpleIdentifier returnType2; + Token period; + SimpleIdentifier name2; + if (name is SimpleIdentifier) { + SimpleIdentifier returnType2 = name; + } + push(ast.constructorDeclaration( + comment, + metadata, + toAnalyzerToken(externalKeyword), + toAnalyzerToken(constKeyword), + toAnalyzerToken(factoryKeyword), + returnType2, + toAnalyzerToken(period), + name2, + parameters, + toAnalyzerToken(separator), + initializers, + redirectedConstructor, + body)); + } + + @override + void endMember() { + debugEvent("Member"); + } } /// Data structure placed on the stack to represent a class body. diff --git a/pkg/front_end/lib/src/fasta/parser/listener.dart b/pkg/front_end/lib/src/fasta/parser/listener.dart index 6100785b2b1..8be392c3981 100644 --- a/pkg/front_end/lib/src/fasta/parser/listener.dart +++ b/pkg/front_end/lib/src/fasta/parser/listener.dart @@ -452,6 +452,16 @@ class Listener { void beginMethod(Token token, Token name) {} + /// Handle the end of a method declaration. Substructures: + /// - metadata + /// - modifiers + /// - return type + /// - method name (identifier, possibly qualified) + /// - type variables + /// - formal parameters + /// - initializers + /// - async marker + /// - body void endMethod(Token getOrSet, Token beginToken, Token endToken) { logEvent("Method"); }