refactor(javascript): share computed-key callable ownership

Give calls, captures, object operations, promises and effects one callable-owner tracker. Suspend a method while its computed key is evaluated in the enclosing callable; remove the capture-only downstream repair.

Co-authored-by: Alex Desir <adesir089@gmail.com>
This commit is contained in:
morlutoandAlex Desir committed 2026-10-14 15:20:07 +08:00
1 parent 6396851958
commit 76fa5304a8
8 files changed
+245 -107

No files matched your search

@@ -20,6 +20,7 @@ import {
import { semanticCallableIdForNode } from "./javascriptSemanticProjection.js";
import { semanticTopLevelEffectFollowsCapture } from "./javascriptSemanticMutationInitializers.js";
import { createSemanticCallableIdStack } from "./javascriptSemanticCallableStack.js";
import {
resolveSemanticBindingState,
type JavaScriptSemanticAnalysisState,
@@ -882,21 +883,20 @@ export const traverseDataEffects = (
context: DataEffectTraversalContext,
visit: (node: t.Node, parent: t.Node | null) => void,
): void => {
context.callableStack.length = 0;
const callableStack = createSemanticCallableIdStack(
context.callableIds,
context.callableStack,
);
context.ancestors.length = 0;
traverseJavaScriptAst(program, {
enter: (node, parent) => {
const callableId = semanticCallableIdForNode(node);
if (callableId !== null && context.callableIds.has(callableId))
context.callableStack.push(callableId);
callableStack.enter(node, parent);
visit(node, parent);
context.ancestors.push(node);
},
exit: (node) => {
context.ancestors.pop();
const callableId = semanticCallableIdForNode(node);
if (callableId !== null && context.callableStack.at(-1) === callableId)
context.callableStack.pop();
callableStack.exit(node);
},
});
};