feat(kernel): preserve union nodes across extraction
This commit is contained in:
@@ -703,7 +703,7 @@ export async function cFnPointerDispatchEdges(
|
||||
if (prof) { prof.nodesMs += Date.now() - tN; prof.nodesN++; }
|
||||
const structs: CfnptrFileIn['structs'] = [];
|
||||
for (const st of fileNodes) {
|
||||
if (st.kind !== 'struct') continue;
|
||||
if (st.kind !== 'struct' && st.kind !== 'union') continue;
|
||||
// sliceLinesPre semantics ride along: falsy startLine never parses,
|
||||
// and `endLine ?? startLine` is applied here so the kernel sees the
|
||||
// exact slice bounds the JS sweep would use.
|
||||
@@ -740,7 +740,7 @@ export async function cFnPointerDispatchEdges(
|
||||
if (prof) { prof.nodesMs += Date.now() - tN; prof.nodesN++; }
|
||||
let lines: string[] | null = null;
|
||||
for (const st of fileNodes) {
|
||||
if (st.kind !== 'struct') continue;
|
||||
if (st.kind !== 'struct' && st.kind !== 'union') continue;
|
||||
lines ??= s.split('\n');
|
||||
const body = sliceLinesPre(lines, st.startLine, st.endLine);
|
||||
const open = body.indexOf('{');
|
||||
|
||||
@@ -1827,6 +1827,7 @@ function resolveRustPathReference(
|
||||
n.name === leaf &&
|
||||
(n.kind === 'function' ||
|
||||
n.kind === 'struct' ||
|
||||
n.kind === 'union' ||
|
||||
n.kind === 'enum' ||
|
||||
n.kind === 'trait' ||
|
||||
n.kind === 'type_alias' ||
|
||||
|
||||
@@ -798,12 +798,12 @@ function lookupCalleeReturnType(
|
||||
return candidates.find((n) => n.kind === 'function')?.returnType ?? null;
|
||||
}
|
||||
|
||||
/** Does the graph contain a class/struct named `name`'s last segment? */
|
||||
/** Does the graph contain an aggregate type named `name`'s last segment? */
|
||||
function cppClassExists(name: string, ref: UnresolvedRef, context: ResolutionContext): boolean {
|
||||
const last = cppLastSegment(name);
|
||||
return context
|
||||
.getNodesByName(last)
|
||||
.some((n) => (n.kind === 'class' || n.kind === 'struct') && n.language === ref.language);
|
||||
.some((n) => (n.kind === 'class' || n.kind === 'struct' || n.kind === 'union') && n.language === ref.language);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1771,7 +1771,7 @@ export function matchMethodCall(
|
||||
);
|
||||
|
||||
for (const classNode of classCandidates) {
|
||||
if (classNode.kind === 'class' || classNode.kind === 'struct' || classNode.kind === 'interface') {
|
||||
if (classNode.kind === 'class' || classNode.kind === 'struct' || classNode.kind === 'union' || classNode.kind === 'interface') {
|
||||
// Skip cross-language class matches
|
||||
if (classNode.language !== ref.language) continue;
|
||||
|
||||
@@ -1807,7 +1807,7 @@ export function matchMethodCall(
|
||||
ref.filePath,
|
||||
);
|
||||
for (const classNode of fuzzyClassCandidates) {
|
||||
if (classNode.kind === 'class' || classNode.kind === 'struct' || classNode.kind === 'interface') {
|
||||
if (classNode.kind === 'class' || classNode.kind === 'struct' || classNode.kind === 'union' || classNode.kind === 'interface') {
|
||||
// Skip cross-language class matches
|
||||
if (classNode.language !== ref.language) continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user