refactor(javascript): share result binding projection and facts

This commit is contained in:
morluto committed 2026-10-22 10:33:18 +08:00
1 parent 34fd7bdf7d
commit dbcec4cf56
7 files changed
+57 -56

No files matched your search

@@ -9,7 +9,10 @@ import {
addSemanticGraphUnknown,
} from "./JavaScriptSemanticGraphConstruction.js";
import { unknownSemanticEvidence } from "./JavaScriptSemanticGraphEvidence.js";
import type { SemanticFlowProjectionContext } from "./JavaScriptSemanticGraphFlowProjection.js";
import {
projectSemanticResultBindings,
type SemanticFlowProjectionContext,
} from "./JavaScriptSemanticGraphFlowProjection.js";
interface ChildUnknownInput {
readonly context: SemanticFlowProjectionContext;
@@ -80,18 +83,7 @@ const projectSpawn = (
relation: "spawns",
resolution: spawn.resolution === "complete" ? "resolved" : "candidate",
});
for (const projected of spawn.projectedResultBindings)
addSemanticGraphRelation(context.state, {
source: child,
target: context.bindingNodes.get(projected.bindingId),
relation: "destructures",
resolution:
projected.resolution === "complete" ? "resolved" : "candidate",
properties: {
projection_path: [...projected.projectionPath],
projection_resolution: projected.resolution,
},
});
projectSemanticResultBindings(context, child, spawn.projectedResultBindings);
if (spawn.argvCount !== null)
addSemanticGraphRelation(context.state, {
source: callSite,