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

Unified Diff: pkg/front_end/lib/src/fasta/source/diet_listener.dart

Issue 2730093002: Avoid crashing on function syntax. (Closed)
Patch Set: Update status. Created 3 years, 10 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
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);
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_target.dart ('k') | pkg/front_end/lib/src/fasta/source/outline_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698