From 60af6671d72540b472c1701ce7d42da4f4e3a16d Mon Sep 17 00:00:00 2001 From: Sathya Gunasekaran Date: Thu, 2 Nov 2023 12:32:40 -0700 Subject: [PATCH] [ez] Check for use-before-decl only when gating is on --- .../src/Entrypoint/Program.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts b/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts index cde8dba18a..d305146ec5 100644 --- a/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts +++ b/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts @@ -316,13 +316,15 @@ export function compileProgram( } ); - const error = checkFunctionReferencedBeforeDeclarationAtTopLevel( - program, - compiledFns.map(({ originalFn }) => originalFn) - ); - if (error) { - handleError(pass, null, error); - return; + if (options.gating != null) { + const error = checkFunctionReferencedBeforeDeclarationAtTopLevel( + program, + compiledFns.map(({ originalFn }) => originalFn) + ); + if (error) { + handleError(pass, null, error); + return; + } } for (const { originalFn: fn, compiledFn } of compiledFns) {