@@ -40774,7 +40774,7 @@ function computeSignatureForInstruction(context, env, instr) {
4077440774 effects.push({
4077540775 kind: 'Freeze',
4077640776 value: operand,
40777- reason: ValueReason.Other ,
40777+ reason: ValueReason.HookCaptured ,
4077840778 });
4077940779 }
4078040780 }
@@ -41508,7 +41508,8 @@ class CollectDependenciesVisitor extends ReactiveFunctionVisitor {
4150841508 this.state = state;
4150941509 this.options = {
4151041510 memoizeJsxElements: !this.env.config.enableForest,
41511- forceMemoizePrimitives: this.env.config.enableForest,
41511+ forceMemoizePrimitives: this.env.config.enableForest ||
41512+ this.env.config.enablePreserveExistingMemoizationGuarantees,
4151241513 };
4151341514 }
4151441515 computeMemoizationInputs(value, lvalue) {
@@ -41596,9 +41597,14 @@ class CollectDependenciesVisitor extends ReactiveFunctionVisitor {
4159641597 case 'JSXText':
4159741598 case 'BinaryExpression':
4159841599 case 'UnaryExpression': {
41599- const level = options.forceMemoizePrimitives
41600- ? MemoizationLevel.Memoized
41601- : MemoizationLevel.Never;
41600+ if (options.forceMemoizePrimitives) {
41601+ const level = MemoizationLevel.Conditional;
41602+ return {
41603+ lvalues: lvalue !== null ? [{ place: lvalue, level }] : [],
41604+ rvalues: [...eachReactiveValueOperand(value)],
41605+ };
41606+ }
41607+ const level = MemoizationLevel.Never;
4160241608 return {
4160341609 lvalues: lvalue !== null ? [{ place: lvalue, level }] : [],
4160441610 rvalues: [],
@@ -41729,9 +41735,7 @@ class CollectDependenciesVisitor extends ReactiveFunctionVisitor {
4172941735 }
4173041736 case 'ComputedLoad':
4173141737 case 'PropertyLoad': {
41732- const level = options.forceMemoizePrimitives
41733- ? MemoizationLevel.Memoized
41734- : MemoizationLevel.Conditional;
41738+ const level = MemoizationLevel.Conditional;
4173541739 return {
4173641740 lvalues: lvalue !== null ? [{ place: lvalue, level }] : [],
4173741741 rvalues: [value.object],
@@ -45881,7 +45885,7 @@ function alignMethodCallScopes(fn) {
4588145885}
4588245886
4588345887function alignReactiveScopesToBlockScopesHIR(fn) {
45884- var _a, _b, _c, _d, _e;
45888+ var _a, _b, _c, _d, _e, _f, _g ;
4588545889 const activeBlockFallthroughRanges = [];
4588645890 const activeScopes = new Set();
4588745891 const seen = new Set();
@@ -45953,6 +45957,20 @@ function alignReactiveScopesToBlockScopesHIR(fn) {
4595345957 valueBlockNodes.set(fallthrough, node);
4595445958 }
4595545959 }
45960+ else if (terminal.kind === 'goto') {
45961+ const start = activeBlockFallthroughRanges.find(range => range.fallthrough === terminal.block);
45962+ if (start != null && start !== activeBlockFallthroughRanges.at(-1)) {
45963+ const fallthroughBlock = fn.body.blocks.get(start.fallthrough);
45964+ const firstId = (_g = (_f = fallthroughBlock.instructions[0]) === null || _f === void 0 ? void 0 : _f.id) !== null && _g !== void 0 ? _g : fallthroughBlock.terminal.id;
45965+ for (const scope of activeScopes) {
45966+ if (scope.range.end <= terminal.id) {
45967+ continue;
45968+ }
45969+ scope.range.start = makeInstructionId(Math.min(start.range.start, scope.range.start));
45970+ scope.range.end = makeInstructionId(Math.max(firstId, scope.range.end));
45971+ }
45972+ }
45973+ }
4595645974 mapTerminalSuccessors(terminal, successor => {
4595745975 var _a, _b;
4595845976 if (valueBlockNodes.has(successor)) {
0 commit comments