Return correct recovery code for FatalError (#2548)

Summary:
In support of #2547. Sometimes, it is more desirable (less costly, better for debugging) to flag a warning for a possibly anomalous condition, than to assume that it is anomalous and enforce it as an error. This change exposes warnings that a user upgrades to errors, so that they can then be enforced as such.
Pull Request resolved: https://github.com/facebook/prepack/pull/2548

Differential Revision: D9884632

Pulled By: sb98052

fbshipit-source-id: c47b57a21aa047b0f3fa2672508f8fb23c04942a
This commit is contained in:
Sapan Bhatia 2018-09-17 14:38:32 -07:00 committed by Facebook Github Bot
parent 8ba4fbc916
commit 47f6f4b495

View File

@ -425,7 +425,7 @@ function run(
}
if (compilerDiagnostic.location) compilerDiagnostics.set(compilerDiagnostic.location, compilerDiagnostic);
else compilerDiagnosticsList.push(compilerDiagnostic);
return "Recover";
return compilerDiagnostic.severity === "FatalError" ? "Fail" : "Recover";
}
function printDiagnostics(caughtFatalError: boolean, caughtUnexpectedError: boolean = false): boolean {