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

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

Issue 2940843003: Ignore recoverable parser errors in outline_builder to avoid double reporting. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698