mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Ignore recoverable parser errors in outline_builder to avoid double reporting.
R=danrubel@google.com Review-Url: https://codereview.chromium.org/2940843003 .
This commit is contained in:
parent
3fd4b27c9d
commit
246334011a
1 changed files with 17 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue