MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / addNode

Function addNode

website/src/lib/parser.worker.ts:720–733  ·  view source on GitHub ↗
(name: string, type: string, file: string, val: number, extraProps: any = {})

Source from the content-addressed store, hash-verified

718};
719
720const addNode = (name: string, type: string, file: string, val: number, extraProps: any = {}) => {
721 const maxNodes = indexOptions.maxNodes || 100000;
722 if (nodes.length >= maxNodes && type !== 'Repository') {
723 return -1;
724 }
725 const id = nodeIdSequence++;
726 nodes.push({ id, name, type, file, val, ...extraProps });
727 const symbolKey = `${type}:${name}`;
728 if (!nodeSymbolIndex.has(symbolKey)) nodeSymbolIndex.set(symbolKey, []);
729 nodeSymbolIndex.get(symbolKey)!.push(id);
730 if (!nodeSymbolIndex.has(name)) nodeSymbolIndex.set(name, []);
731 nodeSymbolIndex.get(name)!.push(id);
732 return id;
733};
734
735/**
736 * Resolve a symbol name to a single node ID, preferring candidates

Callers 3

getOrCreateFolderChainFunction · 0.85
parser.worker.tsFile · 0.85
processNextBatchFunction · 0.85

Calls 4

hasMethod · 0.65
getMethod · 0.65
pushMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected