Index: pkg/front_end/lib/src/fasta/source/diet_listener.dart |
diff --git a/pkg/front_end/lib/src/fasta/source/diet_listener.dart b/pkg/front_end/lib/src/fasta/source/diet_listener.dart |
index 89cbf4a5ce129a2c37669e2912486ede133098d5..bbbb2085806d6e47b431ead8025435b6eb42142e 100644 |
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart |
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart |
@@ -166,10 +166,21 @@ class DietListener extends StackListener { |
} |
@override |
+ void handleFunctionType(Token functionToken, Token endToken) { |
+ debugEvent("FunctionType"); |
+ } |
+ |
+ @override |
void endFunctionTypeAlias( |
Token typedefKeyword, Token equals, Token endToken) { |
debugEvent("FunctionTypeAlias"); |
- discard(2); // Name + endToken. |
+ if (stack.length == 1) { |
+ // TODO(ahe): This happens when recovering from `typedef I = A;`. Find a |
+ // different way to track tokens of formal parameters. |
+ discard(1); // Name. |
+ } else { |
+ discard(2); // Name + endToken. |
+ } |
checkEmpty(typedefKeyword.charOffset); |
} |