Skip to content

Commit 6031440

Browse files
authored
fix(wasm-worker): wire paramBindings, returnTypeMap, callAssignments through worker boundary (#1352)
These three ExtractorOutput fields were populated by the JS/TS extractor but never included in SerializedExtractorOutput, causing them to be silently dropped when results crossed the Worker thread boundary. The main thread always received undefined for these fields regardless of what the worker computed, breaking cross-file return-type propagation, param binding resolution, and call-assignment tracking in the WASM engine. Fixes #1348
1 parent 16af0e0 commit 6031440

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/domain/wasm-worker-entry.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,11 @@ function serializeExtractorOutput(
806806
astNodes,
807807
...(symbols.fnRefBindings?.length ? { fnRefBindings: symbols.fnRefBindings } : {}),
808808
...(symbols.newExpressions?.length ? { newExpressions: symbols.newExpressions } : {}),
809+
...(symbols.returnTypeMap?.size
810+
? { returnTypeMap: Array.from(symbols.returnTypeMap.entries()) }
811+
: {}),
812+
...(symbols.callAssignments?.length ? { callAssignments: symbols.callAssignments } : {}),
813+
...(symbols.paramBindings?.length ? { paramBindings: symbols.paramBindings } : {}),
809814
};
810815
}
811816

src/domain/wasm-worker-pool.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ function deserializeResult(ser: SerializedExtractorOutput | null): ExtractorOutp
108108
if (ser.astNodes !== undefined) out.astNodes = ser.astNodes as unknown as ASTNodeRow[];
109109
if (ser.fnRefBindings?.length) out.fnRefBindings = ser.fnRefBindings;
110110
if (ser.newExpressions?.length) out.newExpressions = ser.newExpressions;
111+
if (ser.returnTypeMap?.length) {
112+
const returnTypeMap = new Map<string, TypeMapEntry>();
113+
for (const [k, v] of ser.returnTypeMap) returnTypeMap.set(k, v);
114+
out.returnTypeMap = returnTypeMap;
115+
}
116+
if (ser.callAssignments?.length) out.callAssignments = ser.callAssignments;
117+
if (ser.paramBindings?.length) out.paramBindings = ser.paramBindings;
111118
return out;
112119
}
113120

src/domain/wasm-worker-protocol.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212

1313
import type {
1414
Call,
15+
CallAssignment,
1516
ClassRelation,
1617
DataflowResult,
1718
Definition,
1819
Export,
1920
Import,
2021
LanguageId,
22+
ParamBinding,
2123
TypeMapEntry,
2224
} from '../types.js';
2325

@@ -64,6 +66,9 @@ export interface SerializedExtractorOutput {
6466
}>;
6567
fnRefBindings?: import('../types.js').FnRefBinding[];
6668
newExpressions?: readonly string[];
69+
returnTypeMap?: Array<[string, TypeMapEntry]>;
70+
callAssignments?: CallAssignment[];
71+
paramBindings?: ParamBinding[];
6772
}
6873

6974
export interface WorkerParseResponseOk {

0 commit comments

Comments
 (0)