(name: string, type: string, file: string, val: number, extraProps: any = {})
| 570 | }; |
| 571 | |
| 572 | const addNode = (name: string, type: string, file: string, val: number, extraProps: any = {}) => { |
| 573 | const id = nodeIdSequence++; |
| 574 | nodes.push({ id, name, type, file, val, ...extraProps }); |
| 575 | const symbolKey = `${type}:${name}`; |
| 576 | if (!nodeSymbolIndex.has(symbolKey)) nodeSymbolIndex.set(symbolKey, []); |
| 577 | nodeSymbolIndex.get(symbolKey)!.push(id); |
| 578 | if (!nodeSymbolIndex.has(name)) nodeSymbolIndex.set(name, []); |
| 579 | nodeSymbolIndex.get(name)!.push(id); |
| 580 | return id; |
| 581 | }; |
| 582 | |
| 583 | /** |
| 584 | * Resolve a symbol name to a single node ID, preferring candidates |
no test coverage detected