@samitouri / QOS-React / commits / e262d9e5ba

only run validation if code is actually transformed

Disables post-codegen validation if there were no React functions in the input.

Joseph Savona committed Oct 25, 2022 at 08:33 UTC e262d9e5ba3e78edbe92c8abab856ce252b17d11
2 files changed +6 -1
compiler/forget/src/BackEnd/PostCodegenValidator.ts
+5
@@ -20,6 +20,11 @@ export default {
20 };
21
22 export function run(lirProg: LIR.Prog, context: CompilerContext) {
23 + // Only run validation if the input has React functions and was successfully
24 + // transformed (no bailouts)
25 + if (lirProg.funcs.size === 0 || context.bailouts.length !== 0) {
26 + return;
27 + }
28 const postCodegenValidator = context.opts.postCodegenValidator;
29 if (postCodegenValidator === null) {
30 return;
compiler/forget/src/CompilerOptions.ts
+1 -1
@@ -151,7 +151,7 @@ export function createCompilerOptions(): CompilerOptions {
151 return {
152 outputKinds: [OutputKind.JS],
153 flags: createCompilerFlags(),
154 - stopPass: PassName.JSGen,
154 + stopPass: PassName.Validator,
155 optIn: false,
156 logger: noopLogger,
157 allowedCapitalizedUserFunctions: new Set(),