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 2fa72595d6119ac3dab4776311443f188d7eba4b..19938160b2349fa6d28a204a813355fba9e137d5 100644 |
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart |
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart |
@@ -50,6 +50,12 @@ class OutlineBuilder extends UnhandledListener { |
final bool enableNative; |
+ /// When true, recoverable parser errors are silently ignored. This is |
+ /// because they will be reported by the BodyBuilder later. However, typedefs |
+ /// are fully compiled by the outline builder, so parser errors are turned on |
+ /// when parsing typedefs. |
+ bool silenceParserErrors = true; |
+ |
String nativeMethodName; |
OutlineBuilder(SourceLibraryBuilder library) |
@@ -597,6 +603,7 @@ class OutlineBuilder extends UnhandledListener { |
@override |
void beginFunctionTypeAlias(Token token) { |
library.beginNestedDeclaration(null, hasMembers: false); |
+ silenceParserErrors = false; |
} |
@override |
@@ -649,6 +656,7 @@ class OutlineBuilder extends UnhandledListener { |
library.addFunctionTypeAlias( |
metadata, returnType, name, typeVariables, formals, charOffset); |
checkEmpty(typedefKeyword.charOffset); |
+ silenceParserErrors = true; |
} |
@override |
@@ -814,6 +822,15 @@ class OutlineBuilder extends UnhandledListener { |
push(popList(count) ?? NullValue.Modifiers); |
} |
+ @override |
+ void handleRecoverableError(Token token, FastaMessage message) { |
+ if (silenceParserErrors) { |
+ debugEvent("RecoverableError"); |
+ } else { |
+ super.handleRecoverableError(token, message); |
+ } |
+ } |
+ |
@override |
Token handleUnrecoverableError(Token token, FastaMessage message) { |
if (enableNative && message.code == codeExpectedBlockToSkip) { |