@samitouri / QOS-React-2 / commits / 60af6671d7

[ez] Check for use-before-decl only when gating is on

Sathya Gunasekaran committed Nov 2, 2023 at 12:32 UTC 60af6671d72540b472c1701ce7d42da4f4e3a16d
1 file changed +9 -7
compiler/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts
+9 -7
@@ -316,13 +316,15 @@ export function compileProgram(
316 }
317 );
318
319 - const error = checkFunctionReferencedBeforeDeclarationAtTopLevel(
320 - program,
321 - compiledFns.map(({ originalFn }) => originalFn)
322 - );
323 - if (error) {
324 - handleError(pass, null, error);
325 - return;
319 + if (options.gating != null) {
320 + const error = checkFunctionReferencedBeforeDeclarationAtTopLevel(
321 + program,
322 + compiledFns.map(({ originalFn }) => originalFn)
323 + );
324 + if (error) {
325 + handleError(pass, null, error);
326 + return;
327 + }
328 }
329
330 for (const { originalFn: fn, compiledFn } of compiledFns) {