@samitouri / QOS-React-2 / commits / 7fddf42d06

[ez] Hooks dont escape, their args do

Joe Savona committed May 31, 2023 at 16:05 UTC 7fddf42d060b1c2f75b895ae23744be27200b486
1 file changed +3 -3
compiler/forget/src/ReactiveScopes/PruneNonEscapingScopes.ts
+3 -3
@@ -25,7 +25,6 @@ import {
25 getHookKind,
26 isMutableEffect,
27 } from "../HIR";
28 -import { eachInstructionValueOperand } from "../HIR/visitors";
28 import { log } from "../Utils/logger";
29 import { assertExhaustive } from "../Utils/utils";
30 import { getPlaceScope } from "./BuildReactiveBlocks";
@@ -722,8 +721,9 @@ class CollectDependenciesVisitor extends ReactiveFunctionVisitor<State> {
721 } else if (instruction.value.kind === "CallExpression") {
722 const callee = instruction.value.callee;
723 if (getHookKind(state.env, callee.identifier)) {
725 - for (const operand of eachInstructionValueOperand(instruction.value)) {
726 - state.escapingValues.add(operand.identifier.id);
724 + for (const operand of instruction.value.args) {
725 + const place = operand.kind === "Spread" ? operand.place : operand;
726 + state.escapingValues.add(place.identifier.id);
727 }
728 }
729 }