diff --git a/gitnexus/src/core/ingestion/languages/c/captures.ts b/gitnexus/src/core/ingestion/languages/c/captures.ts index 751d645f7..e5139521e 100644 --- a/gitnexus/src/core/ingestion/languages/c/captures.ts +++ b/gitnexus/src/core/ingestion/languages/c/captures.ts @@ -1,5 +1,5 @@ import type { Capture, CaptureMatch } from 'gitnexus-shared'; -import { findNodeAtRange, nodeToCapture, syntheticCapture } from '../../utils/ast-helpers.js'; +import { findNodeAtRange, nodeToCapture, syntheticCapture, type SyntaxNode } from '../../utils/ast-helpers.js'; import { getCParser, getCScopeQuery } from './query.js'; import { getTreeSitterBufferSize } from '../../constants.js'; import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js'; @@ -126,7 +126,7 @@ export function emitCScopeCaptures( * Check if a C function_definition or declaration has `static` storage class. * Walks direct children for a `storage_class_specifier` node with text `static`. */ -function hasStaticStorageClass(node: ReturnType['parse']>['rootNode']): boolean { +function hasStaticStorageClass(node: SyntaxNode): boolean { for (let i = 0; i < node.childCount; i++) { const child = node.child(i); if (child !== null && child.type === 'storage_class_specifier' && child.text === 'static') { diff --git a/gitnexus/src/core/ingestion/languages/c/static-linkage.ts b/gitnexus/src/core/ingestion/languages/c/static-linkage.ts index babe1fd17..fb063a65d 100644 --- a/gitnexus/src/core/ingestion/languages/c/static-linkage.ts +++ b/gitnexus/src/core/ingestion/languages/c/static-linkage.ts @@ -41,12 +41,15 @@ export function expandCWildcardNames( const target = parsedFiles.find((p) => p.moduleScope === targetModuleScope); if (target === undefined) return []; + const seen = new Set(); const names: string[] = []; for (const def of target.localDefs) { const name = simpleName(def); if (name === '') continue; if (isStaticName(target.filePath, name)) continue; - if (!names.includes(name)) names.push(name); + if (seen.has(name)) continue; + seen.add(name); + names.push(name); } return names; }