@@ -41898,7 +41898,7 @@ function codegenFunction(fn, { uniqueIdentifiers, fbtOperands, }) {
4189841898 }
4189941899 const compiled = compileResult.unwrap();
4190041900 const hookGuard = fn.env.config.enableEmitHookGuards;
41901- if (hookGuard != null) {
41901+ if (hookGuard != null && fn.env.isInferredMemoEnabled ) {
4190241902 compiled.body = libExports.blockStatement([
4190341903 createHookGuard(hookGuard, compiled.body.body, GuardKind.PushHookGuard, GuardKind.PopHookGuard),
4190441904 ]);
@@ -41925,7 +41925,9 @@ function codegenFunction(fn, { uniqueIdentifiers, fbtOperands, }) {
4192541925 compiled.body.body.unshift(...preface);
4192641926 }
4192741927 const emitInstrumentForget = fn.env.config.enableEmitInstrumentForget;
41928- if (emitInstrumentForget != null && fn.id != null) {
41928+ if (emitInstrumentForget != null &&
41929+ fn.id != null &&
41930+ fn.env.isInferredMemoEnabled) {
4192941931 let gating;
4193041932 if (emitInstrumentForget.gating != null &&
4193141933 emitInstrumentForget.globalGating != null) {
@@ -42136,7 +42138,7 @@ function codegenBlockNoReset(cx, block) {
4213642138 return libExports.blockStatement(statements);
4213742139}
4213842140function wrapCacheDep(cx, value) {
42139- if (cx.env.config.enableEmitFreeze != null) {
42141+ if (cx.env.config.enableEmitFreeze != null && cx.env.isInferredMemoEnabled ) {
4214042142 return libExports.conditionalExpression(libExports.identifier('true'), libExports.callExpression(libExports.identifier(cx.env.config.enableEmitFreeze.importSpecifierName), [value, libExports.stringLiteral(cx.fnName)]), value);
4214142143 }
4214242144 else {
@@ -42826,13 +42828,13 @@ function createHookGuard(guard, stmts, before, after) {
4282642828 }
4282742829 return libExports.tryStatement(libExports.blockStatement([createHookGuardImpl(before), ...stmts]), null, libExports.blockStatement([createHookGuardImpl(after)]));
4282842830}
42829- function createCallExpression(config , callee, args, loc, isHook) {
42831+ function createCallExpression(env , callee, args, loc, isHook) {
4283042832 const callExpr = libExports.callExpression(callee, args);
4283142833 if (loc != null && loc != GeneratedSource) {
4283242834 callExpr.loc = loc;
4283342835 }
42834- const hookGuard = config.enableEmitHookGuards;
42835- if (hookGuard != null && isHook) {
42836+ const hookGuard = env. config.enableEmitHookGuards;
42837+ if (hookGuard != null && isHook && env.isInferredMemoEnabled ) {
4283642838 const iife = libExports.functionExpression(null, [], libExports.blockStatement([
4283742839 createHookGuard(hookGuard, [libExports.returnStatement(callExpr)], GuardKind.AllowHook, GuardKind.DisallowHook),
4283842840 ]));
@@ -42924,7 +42926,7 @@ function codegenInstructionValue(cx, instrValue) {
4292442926 const isHook = getHookKind(cx.env, instrValue.callee.identifier) != null;
4292542927 const callee = codegenPlaceToExpression(cx, instrValue.callee);
4292642928 const args = instrValue.args.map(arg => codegenArgument(cx, arg));
42927- value = createCallExpression(cx.env.config , callee, args, instrValue.loc, isHook);
42929+ value = createCallExpression(cx.env, callee, args, instrValue.loc, isHook);
4292842930 break;
4292942931 }
4293042932 case 'OptionalExpression': {
@@ -42983,7 +42985,7 @@ function codegenInstructionValue(cx, instrValue) {
4298342985 suggestions: null,
4298442986 });
4298542987 const args = instrValue.args.map(arg => codegenArgument(cx, arg));
42986- value = createCallExpression(cx.env.config , memberExpr, args, instrValue.loc, isHook);
42988+ value = createCallExpression(cx.env, memberExpr, args, instrValue.loc, isHook);
4298742989 break;
4298842990 }
4298942991 case 'NewExpression': {
@@ -54175,6 +54177,10 @@ function compileProgram(program, pass) {
5417554177 kind: 'compile',
5417654178 compiledFn: compileFn(fn, environment, fnType, 'no_inferred_memo', useMemoCacheIdentifier.name, pass.opts.logger, pass.filename, pass.code),
5417754179 };
54180+ if (!compileResult.compiledFn.hasFireRewrite &&
54181+ !compileResult.compiledFn.hasLoweredContextAccess) {
54182+ return null;
54183+ }
5417854184 }
5417954185 catch (err) {
5418054186 if (err instanceof CompilerError) {
0 commit comments