| Index: pkg/front_end/lib/src/fasta/source/outline_builder.dart
|
| diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
|
| index 2e2289915100c43b954895622a23a83960b1b220..3789892e35823a634494d33badd75dc3a786f8b5 100644
|
| --- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
|
| +++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
|
| @@ -497,22 +497,6 @@ class OutlineBuilder extends UnhandledListener {
|
| // Ignored for now.
|
| }
|
|
|
| - @override
|
| - void endFunctionTypedFormalParameter(
|
| - Token thisKeyword, FormalParameterType kind) {
|
| - debugEvent("FunctionTypedFormalParameter");
|
| - List<FormalParameterBuilder> formals = pop();
|
| - int formalsOffset = pop();
|
| - List<TypeVariableBuilder> typeVariables = pop();
|
| - int charOffset = pop();
|
| - String name = pop();
|
| - TypeBuilder returnType = pop();
|
| - push(library.addFunctionType(
|
| - returnType, typeVariables, formals, formalsOffset));
|
| - push(name);
|
| - push(charOffset);
|
| - }
|
| -
|
| @override
|
| void endOptionalFormalParameters(
|
| int count, Token beginToken, Token endToken) {
|
| @@ -611,6 +595,18 @@ class OutlineBuilder extends UnhandledListener {
|
| silenceParserErrors = false;
|
| }
|
|
|
| + @override
|
| + void beginFunctionType(Token beginToken) {
|
| + debugEvent("beginFunctionType");
|
| + library.beginNestedDeclaration("#function_type", hasMembers: false);
|
| + }
|
| +
|
| + @override
|
| + void beginFunctionTypedFormalParameter(Token token) {
|
| + debugEvent("beginFunctionTypedFormalParameter");
|
| + library.beginNestedDeclaration("#function_type", hasMembers: false);
|
| + }
|
| +
|
| @override
|
| void endFunctionType(Token functionToken, Token endToken) {
|
| debugEvent("FunctionType");
|
| @@ -622,22 +618,42 @@ class OutlineBuilder extends UnhandledListener {
|
| returnType, typeVariables, formals, functionToken.charOffset));
|
| }
|
|
|
| + @override
|
| + void endFunctionTypedFormalParameter(
|
| + Token thisKeyword, FormalParameterType kind) {
|
| + debugEvent("FunctionTypedFormalParameter");
|
| + List<FormalParameterBuilder> formals = pop();
|
| + int formalsOffset = pop();
|
| + List<TypeVariableBuilder> typeVariables = pop();
|
| + int charOffset = pop();
|
| + String name = pop();
|
| + TypeBuilder returnType = pop();
|
| + push(library.addFunctionType(
|
| + returnType, typeVariables, formals, formalsOffset));
|
| + push(name);
|
| + push(charOffset);
|
| + }
|
| +
|
| @override
|
| void endFunctionTypeAlias(
|
| Token typedefKeyword, Token equals, Token endToken) {
|
| debugEvent("endFunctionTypeAlias");
|
| - List<FormalParameterBuilder> formals;
|
| List<TypeVariableBuilder> typeVariables;
|
| String name;
|
| - TypeBuilder returnType;
|
| int charOffset;
|
| + FunctionTypeBuilder functionType;
|
| if (equals == null) {
|
| - formals = pop();
|
| + List<FormalParameterBuilder> formals = pop();
|
| pop(); // formals offset
|
| typeVariables = pop();
|
| charOffset = pop();
|
| name = pop();
|
| - returnType = pop();
|
| + TypeBuilder returnType = pop();
|
| + // Create a nested declaration that is ended below by
|
| + // `library.addFunctionType`.
|
| + library.beginNestedDeclaration("#function_type", hasMembers: false);
|
| + functionType =
|
| + library.addFunctionType(returnType, null, formals, charOffset);
|
| } else {
|
| var type = pop();
|
| typeVariables = pop();
|
| @@ -649,8 +665,7 @@ class OutlineBuilder extends UnhandledListener {
|
| // `type.typeVariables`. A typedef can have type variables, and a new
|
| // function type can also have type variables (representing the type of
|
| // a generic function).
|
| - formals = type.formals;
|
| - returnType = type.returnType;
|
| + functionType = type;
|
| } else {
|
| // TODO(ahe): Improve this error message.
|
| library.addCompileTimeError(
|
| @@ -659,7 +674,7 @@ class OutlineBuilder extends UnhandledListener {
|
| }
|
| List<MetadataBuilder> metadata = pop();
|
| library.addFunctionTypeAlias(
|
| - metadata, returnType, name, typeVariables, formals, charOffset);
|
| + metadata, name, typeVariables, functionType, charOffset);
|
| checkEmpty(typedefKeyword.charOffset);
|
| silenceParserErrors = true;
|
| }
|
|
|