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

This commit is contained in:
Sathya Gunasekaran
2023-11-02 12:32:40 -07:00
parent 48e709e7ad
commit 60af6671d7
@@ -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) {