@colbymchenry/codegraph-win32-arm64 1.5.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/codegraph +5 -0
- package/lib/dist/.test-build-engine.json +1 -0
- package/lib/dist/.test-build-viewer.json +1 -0
- package/lib/dist/bin/codegraph.d.ts +1 -0
- package/lib/dist/bin/codegraph.d.ts.map +1 -1
- package/lib/dist/bin/codegraph.js +744 -320
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/viewer-gate.d.ts +17 -0
- package/lib/dist/bin/viewer-gate.d.ts.map +1 -0
- package/lib/dist/bin/viewer-gate.js +31 -0
- package/lib/dist/bin/viewer-gate.js.map +1 -0
- package/lib/dist/context/formatter.d.ts +7 -1
- package/lib/dist/context/formatter.d.ts.map +1 -1
- package/lib/dist/context/formatter.js +12 -6
- package/lib/dist/context/formatter.js.map +1 -1
- package/lib/dist/context/index.d.ts +12 -0
- package/lib/dist/context/index.d.ts.map +1 -1
- package/lib/dist/context/index.js +103 -16
- package/lib/dist/context/index.js.map +1 -1
- package/lib/dist/db/index.d.ts +58 -2
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +187 -32
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +1 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +64 -1
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/queries.d.ts +583 -6
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +1417 -57
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/schema.sql +27 -4
- package/lib/dist/db/sqlite-adapter.d.ts +2 -0
- package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/lib/dist/db/sqlite-adapter.js +56 -7
- package/lib/dist/db/sqlite-adapter.js.map +1 -1
- package/lib/dist/db/synthesis-stage.d.ts +12 -0
- package/lib/dist/db/synthesis-stage.d.ts.map +1 -0
- package/lib/dist/db/synthesis-stage.js +89 -0
- package/lib/dist/db/synthesis-stage.js.map +1 -0
- package/lib/dist/db/wal-valve.d.ts +32 -12
- package/lib/dist/db/wal-valve.d.ts.map +1 -1
- package/lib/dist/db/wal-valve.js +65 -22
- package/lib/dist/db/wal-valve.js.map +1 -1
- package/lib/dist/db/wsl-shared-index.d.ts +53 -0
- package/lib/dist/db/wsl-shared-index.d.ts.map +1 -0
- package/lib/dist/db/wsl-shared-index.js +121 -0
- package/lib/dist/db/wsl-shared-index.js.map +1 -0
- package/lib/dist/directory.d.ts +130 -2
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +306 -23
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/errors.d.ts +14 -0
- package/lib/dist/errors.d.ts.map +1 -1
- package/lib/dist/errors.js +16 -1
- package/lib/dist/errors.js.map +1 -1
- package/lib/dist/extraction/cfml-extractor.d.ts +1 -0
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/cfml-extractor.js +15 -3
- package/lib/dist/extraction/cfml-extractor.js.map +1 -1
- package/lib/dist/extraction/dfm-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/dfm-extractor.js +14 -10
- package/lib/dist/extraction/dfm-extractor.js.map +1 -1
- package/lib/dist/extraction/extraction-version.d.ts +1 -1
- package/lib/dist/extraction/extraction-version.js +1 -1
- package/lib/dist/extraction/function-ref.d.ts +6 -4
- package/lib/dist/extraction/function-ref.d.ts.map +1 -1
- package/lib/dist/extraction/function-ref.js +41 -14
- package/lib/dist/extraction/function-ref.js.map +1 -1
- package/lib/dist/extraction/generated-detection.d.ts +48 -12
- package/lib/dist/extraction/generated-detection.d.ts.map +1 -1
- package/lib/dist/extraction/generated-detection.js +176 -11
- package/lib/dist/extraction/generated-detection.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts +38 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +115 -3
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +218 -14
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +874 -176
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.d.ts +58 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +310 -19
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
- package/lib/dist/extraction/languages/dart.js +8 -3
- package/lib/dist/extraction/languages/dart.js.map +1 -1
- package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
- package/lib/dist/extraction/languages/erlang.js +58 -22
- package/lib/dist/extraction/languages/erlang.js.map +1 -1
- package/lib/dist/extraction/languages/javascript.js +1 -1
- package/lib/dist/extraction/languages/javascript.js.map +1 -1
- package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/lib/dist/extraction/languages/kotlin.js +169 -36
- package/lib/dist/extraction/languages/kotlin.js.map +1 -1
- package/lib/dist/extraction/languages/lua.d.ts.map +1 -1
- package/lib/dist/extraction/languages/lua.js +4 -1
- package/lib/dist/extraction/languages/lua.js.map +1 -1
- package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
- package/lib/dist/extraction/languages/objc.js +4 -0
- package/lib/dist/extraction/languages/objc.js.map +1 -1
- package/lib/dist/extraction/languages/python.d.ts.map +1 -1
- package/lib/dist/extraction/languages/python.js +71 -0
- package/lib/dist/extraction/languages/python.js.map +1 -1
- package/lib/dist/extraction/languages/rust.d.ts +20 -0
- package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
- package/lib/dist/extraction/languages/rust.js +50 -20
- package/lib/dist/extraction/languages/rust.js.map +1 -1
- package/lib/dist/extraction/languages/scala.d.ts.map +1 -1
- package/lib/dist/extraction/languages/scala.js +18 -3
- package/lib/dist/extraction/languages/scala.js.map +1 -1
- package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
- package/lib/dist/extraction/languages/typescript.js +9 -2
- package/lib/dist/extraction/languages/typescript.js.map +1 -1
- package/lib/dist/extraction/liquid-extractor.d.ts +18 -0
- package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/liquid-extractor.js +98 -22
- package/lib/dist/extraction/liquid-extractor.js.map +1 -1
- package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/mybatis-extractor.js +6 -4
- package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +7 -0
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +20 -1
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/syntax-tokens.d.ts +103 -0
- package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -0
- package/lib/dist/extraction/syntax-tokens.js +381 -0
- package/lib/dist/extraction/syntax-tokens.js.map +1 -0
- package/lib/dist/extraction/tree-sitter-helpers.d.ts +5 -0
- package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.js +17 -0
- package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts +31 -3
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +101 -18
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +926 -132
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/lib/dist/file-limits.d.ts +40 -0
- package/lib/dist/file-limits.d.ts.map +1 -0
- package/lib/dist/file-limits.js +147 -0
- package/lib/dist/file-limits.js.map +1 -0
- package/lib/dist/graph/branch-guards.d.ts +248 -0
- package/lib/dist/graph/branch-guards.d.ts.map +1 -0
- package/lib/dist/graph/branch-guards.js +2231 -0
- package/lib/dist/graph/branch-guards.js.map +1 -0
- package/lib/dist/graph/dead-code.d.ts +251 -0
- package/lib/dist/graph/dead-code.d.ts.map +1 -0
- package/lib/dist/graph/dead-code.js +776 -0
- package/lib/dist/graph/dead-code.js.map +1 -0
- package/lib/dist/graph/dynamic-boundary-report.d.ts +121 -0
- package/lib/dist/graph/dynamic-boundary-report.d.ts.map +1 -0
- package/lib/dist/graph/dynamic-boundary-report.js +283 -0
- package/lib/dist/graph/dynamic-boundary-report.js.map +1 -0
- package/lib/dist/graph/index.d.ts +4 -0
- package/lib/dist/graph/index.d.ts.map +1 -1
- package/lib/dist/graph/index.js +16 -1
- package/lib/dist/graph/index.js.map +1 -1
- package/lib/dist/graph/named-symbol-flow.d.ts +125 -0
- package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -0
- package/lib/dist/graph/named-symbol-flow.js +552 -0
- package/lib/dist/graph/named-symbol-flow.js.map +1 -0
- package/lib/dist/graph/queries.d.ts.map +1 -1
- package/lib/dist/graph/queries.js +2 -0
- package/lib/dist/graph/queries.js.map +1 -1
- package/lib/dist/graph/symbol-lookup.d.ts +83 -0
- package/lib/dist/graph/symbol-lookup.d.ts.map +1 -0
- package/lib/dist/graph/symbol-lookup.js +181 -0
- package/lib/dist/graph/symbol-lookup.js.map +1 -0
- package/lib/dist/graph/traversal.d.ts +9 -0
- package/lib/dist/graph/traversal.d.ts.map +1 -1
- package/lib/dist/graph/traversal.js +62 -36
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/graph/type-hierarchy.d.ts +155 -0
- package/lib/dist/graph/type-hierarchy.d.ts.map +1 -0
- package/lib/dist/graph/type-hierarchy.js +382 -0
- package/lib/dist/graph/type-hierarchy.js.map +1 -0
- package/lib/dist/index.d.ts +273 -11
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +511 -34
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/index.d.ts +4 -3
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +11 -8
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/targets/antigravity.d.ts.map +1 -1
- package/lib/dist/installer/targets/antigravity.js +14 -2
- package/lib/dist/installer/targets/antigravity.js.map +1 -1
- package/lib/dist/installer/targets/claude.d.ts +3 -0
- package/lib/dist/installer/targets/claude.d.ts.map +1 -1
- package/lib/dist/installer/targets/claude.js +72 -12
- package/lib/dist/installer/targets/claude.js.map +1 -1
- package/lib/dist/installer/targets/codex.d.ts +23 -8
- package/lib/dist/installer/targets/codex.d.ts.map +1 -1
- package/lib/dist/installer/targets/codex.js +74 -47
- package/lib/dist/installer/targets/codex.js.map +1 -1
- package/lib/dist/installer/targets/copilot-cli.d.ts +32 -0
- package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-cli.js +215 -0
- package/lib/dist/installer/targets/copilot-cli.js.map +1 -0
- package/lib/dist/installer/targets/copilot-jetbrains.d.ts +42 -0
- package/lib/dist/installer/targets/copilot-jetbrains.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-jetbrains.js +238 -0
- package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -0
- package/lib/dist/installer/targets/copilot-vscode.d.ts +47 -0
- package/lib/dist/installer/targets/copilot-vscode.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-vscode.js +219 -0
- package/lib/dist/installer/targets/copilot-vscode.js.map +1 -0
- package/lib/dist/installer/targets/opencode.d.ts +16 -5
- package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
- package/lib/dist/installer/targets/opencode.js +73 -22
- package/lib/dist/installer/targets/opencode.js.map +1 -1
- package/lib/dist/installer/targets/registry.d.ts.map +1 -1
- package/lib/dist/installer/targets/registry.js +6 -0
- package/lib/dist/installer/targets/registry.js.map +1 -1
- package/lib/dist/installer/targets/shared.d.ts +14 -3
- package/lib/dist/installer/targets/shared.d.ts.map +1 -1
- package/lib/dist/installer/targets/shared.js +39 -11
- package/lib/dist/installer/targets/shared.js.map +1 -1
- package/lib/dist/installer/targets/toml.d.ts +6 -5
- package/lib/dist/installer/targets/toml.d.ts.map +1 -1
- package/lib/dist/installer/targets/toml.js +99 -20
- package/lib/dist/installer/targets/toml.js.map +1 -1
- package/lib/dist/installer/targets/types.d.ts +12 -5
- package/lib/dist/installer/targets/types.d.ts.map +1 -1
- package/lib/dist/mcp/answer-freshness.d.ts +10 -0
- package/lib/dist/mcp/answer-freshness.d.ts.map +1 -0
- package/lib/dist/mcp/answer-freshness.js +68 -0
- package/lib/dist/mcp/answer-freshness.js.map +1 -0
- package/lib/dist/mcp/daemon-manager.d.ts +1 -1
- package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-manager.js +17 -1
- package/lib/dist/mcp/daemon-manager.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +8 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +65 -2
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts +17 -4
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +133 -23
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +26 -13
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +126 -32
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.d.ts +1 -10
- package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.js +46 -42
- package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
- package/lib/dist/mcp/engine.d.ts +31 -9
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +190 -64
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/explore-dedup.d.ts +140 -0
- package/lib/dist/mcp/explore-dedup.d.ts.map +1 -0
- package/lib/dist/mcp/explore-dedup.js +239 -0
- package/lib/dist/mcp/explore-dedup.js.map +1 -0
- package/lib/dist/mcp/explore-diagnostics.d.ts +289 -0
- package/lib/dist/mcp/explore-diagnostics.d.ts.map +1 -0
- package/lib/dist/mcp/explore-diagnostics.js +558 -0
- package/lib/dist/mcp/explore-diagnostics.js.map +1 -0
- package/lib/dist/mcp/explore-session-state.d.ts +217 -0
- package/lib/dist/mcp/explore-session-state.d.ts.map +1 -0
- package/lib/dist/mcp/explore-session-state.js +322 -0
- package/lib/dist/mcp/explore-session-state.js.map +1 -0
- package/lib/dist/mcp/index-freshness-worker.d.ts +2 -0
- package/lib/dist/mcp/index-freshness-worker.d.ts.map +1 -0
- package/lib/dist/mcp/index-freshness-worker.js +30 -0
- package/lib/dist/mcp/index-freshness-worker.js.map +1 -0
- package/lib/dist/mcp/index-freshness.d.ts +7 -0
- package/lib/dist/mcp/index-freshness.d.ts.map +1 -0
- package/lib/dist/mcp/index-freshness.js +94 -0
- package/lib/dist/mcp/index-freshness.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +27 -1
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +159 -14
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts +4 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.js +14 -3
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
- package/lib/dist/mcp/project-lifecycle.d.ts +9 -0
- package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -0
- package/lib/dist/mcp/project-lifecycle.js +181 -0
- package/lib/dist/mcp/project-lifecycle.js.map +1 -0
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +15 -1
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +2 -2
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +9 -7
- package/lib/dist/mcp/query-pool.js.map +1 -1
- package/lib/dist/mcp/query-worker.js +2 -2
- package/lib/dist/mcp/query-worker.js.map +1 -1
- package/lib/dist/mcp/server-instructions.d.ts +2 -2
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +13 -5
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +16 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +36 -13
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/startup-handshake.d.ts +3 -1
- package/lib/dist/mcp/startup-handshake.d.ts.map +1 -1
- package/lib/dist/mcp/startup-handshake.js +10 -2
- package/lib/dist/mcp/startup-handshake.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +544 -38
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +4246 -770
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/mcp/writer-lock.d.ts +61 -0
- package/lib/dist/mcp/writer-lock.d.ts.map +1 -0
- package/lib/dist/mcp/writer-lock.js +260 -0
- package/lib/dist/mcp/writer-lock.js.map +1 -0
- package/lib/dist/project-config.d.ts +23 -0
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +39 -2
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/alias-binding.d.ts +56 -0
- package/lib/dist/resolution/alias-binding.d.ts.map +1 -0
- package/lib/dist/resolution/alias-binding.js +127 -0
- package/lib/dist/resolution/alias-binding.js.map +1 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.js +21 -19
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts +23 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +330 -154
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/cpp-constructor.d.ts +4 -0
- package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-constructor.js +123 -0
- package/lib/dist/resolution/cpp-constructor.js.map +1 -0
- package/lib/dist/resolution/cpp-macro-visibility.d.ts +12 -0
- package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-macro-visibility.js +342 -0
- package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -0
- package/lib/dist/resolution/expo-router-synthesizer.d.ts +32 -0
- package/lib/dist/resolution/expo-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/expo-router-synthesizer.js +189 -0
- package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/csharp.js +96 -2
- package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
- package/lib/dist/resolution/frameworks/expo-router.d.ts +189 -0
- package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/expo-router.js +785 -0
- package/lib/dist/resolution/frameworks/expo-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/express.js +251 -16
- package/lib/dist/resolution/frameworks/express.js.map +1 -1
- package/lib/dist/resolution/frameworks/index.d.ts +5 -0
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +29 -1
- package/lib/dist/resolution/frameworks/index.js.map +1 -1
- package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/java.js +79 -47
- package/lib/dist/resolution/frameworks/java.js.map +1 -1
- package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/nestjs.js +6 -14
- package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
- package/lib/dist/resolution/frameworks/nextjs.d.ts +76 -0
- package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/nextjs.js +328 -0
- package/lib/dist/resolution/frameworks/nextjs.js.map +1 -0
- package/lib/dist/resolution/frameworks/object-literal.d.ts +32 -0
- package/lib/dist/resolution/frameworks/object-literal.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/object-literal.js +139 -0
- package/lib/dist/resolution/frameworks/object-literal.js.map +1 -0
- package/lib/dist/resolution/frameworks/package-deps.d.ts +14 -0
- package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/package-deps.js +78 -0
- package/lib/dist/resolution/frameworks/package-deps.js.map +1 -0
- package/lib/dist/resolution/frameworks/python.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/python.js +166 -0
- package/lib/dist/resolution/frameworks/python.js.map +1 -1
- package/lib/dist/resolution/frameworks/react-native.d.ts +26 -0
- package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react-native.js +153 -14
- package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
- package/lib/dist/resolution/frameworks/react-router.d.ts +46 -0
- package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/react-router.js +187 -0
- package/lib/dist/resolution/frameworks/react-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/react.d.ts +2 -1
- package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react.js +188 -139
- package/lib/dist/resolution/frameworks/react.js.map +1 -1
- package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/svelte.js +6 -1
- package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
- package/lib/dist/resolution/frameworks/sveltekit-router.d.ts +36 -0
- package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/sveltekit-router.js +156 -0
- package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/swift.js +11 -1
- package/lib/dist/resolution/frameworks/swift.js.map +1 -1
- package/lib/dist/resolution/frameworks/tanstack-router.d.ts +84 -0
- package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/tanstack-router.js +437 -0
- package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/vue-router.d.ts +82 -0
- package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/vue-router.js +377 -0
- package/lib/dist/resolution/frameworks/vue-router.js.map +1 -0
- package/lib/dist/resolution/import-resolver.d.ts +38 -0
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +394 -28
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +89 -25
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +567 -149
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/js-builtins.d.ts +13 -0
- package/lib/dist/resolution/js-builtins.d.ts.map +1 -0
- package/lib/dist/resolution/js-builtins.js +46 -0
- package/lib/dist/resolution/js-builtins.js.map +1 -0
- package/lib/dist/resolution/name-matcher.d.ts +99 -22
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +2192 -87
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/next-router-synthesizer.d.ts +27 -0
- package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/next-router-synthesizer.js +113 -0
- package/lib/dist/resolution/next-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/path-aliases.d.ts +6 -4
- package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
- package/lib/dist/resolution/path-aliases.js +125 -17
- package/lib/dist/resolution/path-aliases.js.map +1 -1
- package/lib/dist/resolution/react-router-synthesizer.d.ts +33 -0
- package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/react-router-synthesizer.js +126 -0
- package/lib/dist/resolution/react-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/resolver-pool.d.ts +2 -0
- package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
- package/lib/dist/resolution/resolver-pool.js +4 -0
- package/lib/dist/resolution/resolver-pool.js.map +1 -1
- package/lib/dist/resolution/strip-comments.d.ts +6 -0
- package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
- package/lib/dist/resolution/strip-comments.js +58 -0
- package/lib/dist/resolution/strip-comments.js.map +1 -1
- package/lib/dist/resolution/sveltekit-synthesizer.d.ts +58 -0
- package/lib/dist/resolution/sveltekit-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/sveltekit-synthesizer.js +173 -0
- package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -0
- package/lib/dist/resolution/synth-utils.d.ts +26 -0
- package/lib/dist/resolution/synth-utils.d.ts.map +1 -0
- package/lib/dist/resolution/synth-utils.js +75 -0
- package/lib/dist/resolution/synth-utils.js.map +1 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.d.ts +31 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.js +114 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/tier-synthesizer.d.ts +49 -0
- package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/tier-synthesizer.js +931 -0
- package/lib/dist/resolution/tier-synthesizer.js.map +1 -0
- package/lib/dist/resolution/types.d.ts +78 -2
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/resolution/types.js +64 -0
- package/lib/dist/resolution/types.js.map +1 -1
- package/lib/dist/resolution/vue-router-synthesizer.d.ts +30 -0
- package/lib/dist/resolution/vue-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/vue-router-synthesizer.js +115 -0
- package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -0
- package/lib/dist/search/identifier-segments.d.ts +10 -0
- package/lib/dist/search/identifier-segments.d.ts.map +1 -1
- package/lib/dist/search/identifier-segments.js +29 -0
- package/lib/dist/search/identifier-segments.js.map +1 -1
- package/lib/dist/search/query-paths.d.ts +106 -0
- package/lib/dist/search/query-paths.d.ts.map +1 -0
- package/lib/dist/search/query-paths.js +513 -0
- package/lib/dist/search/query-paths.js.map +1 -0
- package/lib/dist/search/query-utils.d.ts +16 -1
- package/lib/dist/search/query-utils.d.ts.map +1 -1
- package/lib/dist/search/query-utils.js +48 -10
- package/lib/dist/search/query-utils.js.map +1 -1
- package/lib/dist/sync/watch-policy.d.ts +14 -0
- package/lib/dist/sync/watch-policy.d.ts.map +1 -1
- package/lib/dist/sync/watch-policy.js +19 -0
- package/lib/dist/sync/watch-policy.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +74 -35
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +281 -99
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/telemetry/index.d.ts +4 -2
- package/lib/dist/telemetry/index.d.ts.map +1 -1
- package/lib/dist/telemetry/index.js +92 -41
- package/lib/dist/telemetry/index.js.map +1 -1
- package/lib/dist/types.d.ts +21 -2
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +2 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/ui-server/api/deadcode.d.ts +84 -0
- package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -0
- package/lib/dist/ui-server/api/deadcode.js +136 -0
- package/lib/dist/ui-server/api/deadcode.js.map +1 -0
- package/lib/dist/ui-server/api/effects.d.ts +87 -0
- package/lib/dist/ui-server/api/effects.d.ts.map +1 -0
- package/lib/dist/ui-server/api/effects.js +499 -0
- package/lib/dist/ui-server/api/effects.js.map +1 -0
- package/lib/dist/ui-server/api/entrypoints.d.ts +86 -0
- package/lib/dist/ui-server/api/entrypoints.d.ts.map +1 -0
- package/lib/dist/ui-server/api/entrypoints.js +279 -0
- package/lib/dist/ui-server/api/entrypoints.js.map +1 -0
- package/lib/dist/ui-server/api/events.d.ts +183 -0
- package/lib/dist/ui-server/api/events.d.ts.map +1 -0
- package/lib/dist/ui-server/api/events.js +430 -0
- package/lib/dist/ui-server/api/events.js.map +1 -0
- package/lib/dist/ui-server/api/file.d.ts +66 -0
- package/lib/dist/ui-server/api/file.d.ts.map +1 -0
- package/lib/dist/ui-server/api/file.js +235 -0
- package/lib/dist/ui-server/api/file.js.map +1 -0
- package/lib/dist/ui-server/api/filecode.d.ts +126 -0
- package/lib/dist/ui-server/api/filecode.d.ts.map +1 -0
- package/lib/dist/ui-server/api/filecode.js +205 -0
- package/lib/dist/ui-server/api/filecode.js.map +1 -0
- package/lib/dist/ui-server/api/flow.d.ts +226 -0
- package/lib/dist/ui-server/api/flow.d.ts.map +1 -0
- package/lib/dist/ui-server/api/flow.js +612 -0
- package/lib/dist/ui-server/api/flow.js.map +1 -0
- package/lib/dist/ui-server/api/hierarchy.d.ts +81 -0
- package/lib/dist/ui-server/api/hierarchy.d.ts.map +1 -0
- package/lib/dist/ui-server/api/hierarchy.js +92 -0
- package/lib/dist/ui-server/api/hierarchy.js.map +1 -0
- package/lib/dist/ui-server/api/index.d.ts +90 -0
- package/lib/dist/ui-server/api/index.d.ts.map +1 -0
- package/lib/dist/ui-server/api/index.js +332 -0
- package/lib/dist/ui-server/api/index.js.map +1 -0
- package/lib/dist/ui-server/api/map.d.ts +238 -0
- package/lib/dist/ui-server/api/map.d.ts.map +1 -0
- package/lib/dist/ui-server/api/map.js +681 -0
- package/lib/dist/ui-server/api/map.js.map +1 -0
- package/lib/dist/ui-server/api/node.d.ts +81 -0
- package/lib/dist/ui-server/api/node.d.ts.map +1 -0
- package/lib/dist/ui-server/api/node.js +388 -0
- package/lib/dist/ui-server/api/node.js.map +1 -0
- package/lib/dist/ui-server/api/nodes.d.ts +25 -0
- package/lib/dist/ui-server/api/nodes.d.ts.map +1 -0
- package/lib/dist/ui-server/api/nodes.js +45 -0
- package/lib/dist/ui-server/api/nodes.js.map +1 -0
- package/lib/dist/ui-server/api/program.d.ts +139 -0
- package/lib/dist/ui-server/api/program.d.ts.map +1 -0
- package/lib/dist/ui-server/api/program.js +315 -0
- package/lib/dist/ui-server/api/program.js.map +1 -0
- package/lib/dist/ui-server/api/respond.d.ts +76 -0
- package/lib/dist/ui-server/api/respond.d.ts.map +1 -0
- package/lib/dist/ui-server/api/respond.js +186 -0
- package/lib/dist/ui-server/api/respond.js.map +1 -0
- package/lib/dist/ui-server/api/route-roots.d.ts +39 -0
- package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -0
- package/lib/dist/ui-server/api/route-roots.js +96 -0
- package/lib/dist/ui-server/api/route-roots.js.map +1 -0
- package/lib/dist/ui-server/api/routes.d.ts +59 -0
- package/lib/dist/ui-server/api/routes.d.ts.map +1 -0
- package/lib/dist/ui-server/api/routes.js +108 -0
- package/lib/dist/ui-server/api/routes.js.map +1 -0
- package/lib/dist/ui-server/api/screens.d.ts +117 -0
- package/lib/dist/ui-server/api/screens.d.ts.map +1 -0
- package/lib/dist/ui-server/api/screens.js +611 -0
- package/lib/dist/ui-server/api/screens.js.map +1 -0
- package/lib/dist/ui-server/api/search.d.ts +29 -0
- package/lib/dist/ui-server/api/search.d.ts.map +1 -0
- package/lib/dist/ui-server/api/search.js +232 -0
- package/lib/dist/ui-server/api/search.js.map +1 -0
- package/lib/dist/ui-server/api/session.d.ts +52 -0
- package/lib/dist/ui-server/api/session.d.ts.map +1 -0
- package/lib/dist/ui-server/api/session.js +196 -0
- package/lib/dist/ui-server/api/session.js.map +1 -0
- package/lib/dist/ui-server/api/source.d.ts +200 -0
- package/lib/dist/ui-server/api/source.d.ts.map +1 -0
- package/lib/dist/ui-server/api/source.js +422 -0
- package/lib/dist/ui-server/api/source.js.map +1 -0
- package/lib/dist/ui-server/api/stats.d.ts +27 -0
- package/lib/dist/ui-server/api/stats.d.ts.map +1 -0
- package/lib/dist/ui-server/api/stats.js +164 -0
- package/lib/dist/ui-server/api/stats.js.map +1 -0
- package/lib/dist/ui-server/api/steps.d.ts +274 -0
- package/lib/dist/ui-server/api/steps.d.ts.map +1 -0
- package/lib/dist/ui-server/api/steps.js +1446 -0
- package/lib/dist/ui-server/api/steps.js.map +1 -0
- package/lib/dist/ui-server/api/trail-store.d.ts +142 -0
- package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -0
- package/lib/dist/ui-server/api/trail-store.js +323 -0
- package/lib/dist/ui-server/api/trail-store.js.map +1 -0
- package/lib/dist/ui-server/api/trails.d.ts +163 -0
- package/lib/dist/ui-server/api/trails.d.ts.map +1 -0
- package/lib/dist/ui-server/api/trails.js +369 -0
- package/lib/dist/ui-server/api/trails.js.map +1 -0
- package/lib/dist/ui-server/api/when.d.ts +125 -0
- package/lib/dist/ui-server/api/when.d.ts.map +1 -0
- package/lib/dist/ui-server/api/when.js +251 -0
- package/lib/dist/ui-server/api/when.js.map +1 -0
- package/lib/dist/ui-server/api/wire.d.ts +179 -0
- package/lib/dist/ui-server/api/wire.d.ts.map +1 -0
- package/lib/dist/ui-server/api/wire.js +231 -0
- package/lib/dist/ui-server/api/wire.js.map +1 -0
- package/lib/dist/ui-server/assets.d.ts +40 -0
- package/lib/dist/ui-server/assets.d.ts.map +1 -0
- package/lib/dist/ui-server/assets.js +110 -0
- package/lib/dist/ui-server/assets.js.map +1 -0
- package/lib/dist/ui-server/constants.d.ts +32 -0
- package/lib/dist/ui-server/constants.d.ts.map +1 -0
- package/lib/dist/ui-server/constants.js +35 -0
- package/lib/dist/ui-server/constants.js.map +1 -0
- package/lib/dist/ui-server/highlight/index.d.ts +113 -0
- package/lib/dist/ui-server/highlight/index.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/index.js +307 -0
- package/lib/dist/ui-server/highlight/index.js.map +1 -0
- package/lib/dist/ui-server/highlight/languages.d.ts +36 -0
- package/lib/dist/ui-server/highlight/languages.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/languages.js +50 -0
- package/lib/dist/ui-server/highlight/languages.js.map +1 -0
- package/lib/dist/ui-server/index.d.ts +92 -0
- package/lib/dist/ui-server/index.d.ts.map +1 -0
- package/lib/dist/ui-server/index.js +399 -0
- package/lib/dist/ui-server/index.js.map +1 -0
- package/lib/dist/ui-server/open-browser.d.ts +31 -0
- package/lib/dist/ui-server/open-browser.d.ts.map +1 -0
- package/lib/dist/ui-server/open-browser.js +79 -0
- package/lib/dist/ui-server/open-browser.js.map +1 -0
- package/lib/dist/ui-server/security.d.ts +127 -0
- package/lib/dist/ui-server/security.d.ts.map +1 -0
- package/lib/dist/ui-server/security.js +332 -0
- package/lib/dist/ui-server/security.js.map +1 -0
- package/lib/dist/ui-server/static.d.ts +45 -0
- package/lib/dist/ui-server/static.d.ts.map +1 -0
- package/lib/dist/ui-server/static.js +165 -0
- package/lib/dist/ui-server/static.js.map +1 -0
- package/lib/dist/utils.d.ts +14 -2
- package/lib/dist/utils.d.ts.map +1 -1
- package/lib/dist/utils.js +25 -10
- package/lib/dist/utils.js.map +1 -1
- package/lib/dist/viewer/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
- package/lib/dist/viewer/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
- package/lib/dist/viewer/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-2syK4fUT.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-CBJ8pzag.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-B4oTjJdl.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-CBjNughH.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-italic-66oory27.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-italic-BqAiT5Ww.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-B7_fu1kp.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-Bg0ZHwF4.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-D6eaYXMU.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-DRuN92E5.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
- package/lib/dist/viewer/assets/index-CF9yvio6.css +1 -0
- package/lib/dist/viewer/assets/index-D4S7YUPf.js +97 -0
- package/lib/dist/viewer/index.html +16 -0
- package/lib/kernel/codegraph-kernel.node +2 -2
- package/lib/node_modules/.package-lock.json +4 -4
- package/lib/node_modules/picomatch/README.md +56 -51
- package/lib/node_modules/picomatch/lib/constants.js +4 -0
- package/lib/node_modules/picomatch/lib/parse.js +341 -1
- package/lib/node_modules/picomatch/lib/picomatch.js +25 -5
- package/lib/node_modules/picomatch/lib/scan.js +30 -18
- package/lib/node_modules/picomatch/package.json +4 -4
- package/lib/package.json +9 -2
- package/package.json +1 -1
|
@@ -47,6 +47,7 @@ const function_ref_1 = require("./function-ref");
|
|
|
47
47
|
const generated_detection_1 = require("./generated-detection");
|
|
48
48
|
const languages_1 = require("./languages");
|
|
49
49
|
const c_cpp_1 = require("./languages/c-cpp");
|
|
50
|
+
const rust_1 = require("./languages/rust");
|
|
50
51
|
const liquid_extractor_1 = require("./liquid-extractor");
|
|
51
52
|
const razor_extractor_1 = require("./razor-extractor");
|
|
52
53
|
const svelte_extractor_1 = require("./svelte-extractor");
|
|
@@ -70,6 +71,19 @@ const RTK_HOOK_NAME_RE = /^use[A-Z][A-Za-z0-9]*(?:Query|Mutation)$/;
|
|
|
70
71
|
/** React HOC callees whose result is itself a component — a PascalCase const
|
|
71
72
|
* initialized with one of these is a component, not a constant (#841). */
|
|
72
73
|
const REACT_COMPONENT_HOCS = new Set(['forwardRef', 'memo', 'React.forwardRef', 'React.memo']);
|
|
74
|
+
/**
|
|
75
|
+
* Method node types that spell a SIGNATURE — a declaration with no body (#1638).
|
|
76
|
+
*
|
|
77
|
+
* They are a method of whatever type declares them and nothing on their own, so
|
|
78
|
+
* they must not take `extractMethod`'s "no class-like parent, so treat it as a
|
|
79
|
+
* free function" fallback. The other `methodTypes` can: a `method_definition`
|
|
80
|
+
* outside a class really is a function. This one appears outside a class only
|
|
81
|
+
* inside a type literal (`type Handle = { stop(): void }`), whose members
|
|
82
|
+
* `extractTypeAlias` already extracts and attaches to the alias (#359) — take
|
|
83
|
+
* the fallback and the file gains a phantom top-level `function stop` beside
|
|
84
|
+
* the real `Handle::stop`.
|
|
85
|
+
*/
|
|
86
|
+
const SIGNATURE_METHOD_NODE_TYPES = new Set(['method_signature']);
|
|
73
87
|
/** Vue store collections whose object-literal members are the symbols an agent
|
|
74
88
|
* looks for. Extracted as function nodes so `actions`/`mutations`/`getters` are
|
|
75
89
|
* findable + readable (the foundation under any later dispatch-bridge synth). */
|
|
@@ -184,7 +198,7 @@ function extractNameRaw(node, source, extractor) {
|
|
|
184
198
|
// not from identifiers in their body. Without this, single-expression arrow
|
|
185
199
|
// functions like `const fn = () => someIdentifier` get named "someIdentifier"
|
|
186
200
|
// instead of "fn", because the fallback below finds the body identifier.
|
|
187
|
-
if (node.type === 'arrow_function' || node.type === 'function_expression') {
|
|
201
|
+
if (node.type === 'arrow_function' || node.type === 'function_expression' || node.type === 'generator_function') {
|
|
188
202
|
return '<anonymous>';
|
|
189
203
|
}
|
|
190
204
|
// Fall back to first identifier child
|
|
@@ -382,12 +396,107 @@ const LITERAL_RECEIVER_TYPES = new Set([
|
|
|
382
396
|
'list', 'list_literal', 'array', 'array_literal', 'array_creation_expression',
|
|
383
397
|
'dictionary', 'dict_literal', 'object', 'tuple', 'set',
|
|
384
398
|
]);
|
|
399
|
+
/**
|
|
400
|
+
* Languages whose member calls go through the TS/JS grammars.
|
|
401
|
+
*/
|
|
402
|
+
const TS_JS_CHAIN_LANGUAGES = new Set(['typescript', 'tsx', 'javascript', 'jsx']);
|
|
403
|
+
/** Receiver node types (TS/JS grammars) that continue a member chain downward. */
|
|
404
|
+
const TS_JS_CHAIN_RECEIVER_TYPES = new Set(['member_expression', 'subscript_expression']);
|
|
405
|
+
/** The field of a `this.<field>.<method>()` receiver: public or ES private (#1496, #1987). */
|
|
406
|
+
const THIS_FIELD_PROPERTY_TYPES = new Set(['property_identifier', 'private_property_identifier']);
|
|
407
|
+
/**
|
|
408
|
+
* Identifier-rooted member chains have no inferred property type (#1566),
|
|
409
|
+
* including host API chains (#1707). Keep the existing `window.MyNamespace`
|
|
410
|
+
* escape for project globals; call-result and `this` receivers have their own
|
|
411
|
+
* paths and are outside this guard.
|
|
412
|
+
*/
|
|
413
|
+
function isUnresolvedTsJsChain(node, source) {
|
|
414
|
+
let cur = node;
|
|
415
|
+
while (cur && TS_JS_CHAIN_RECEIVER_TYPES.has(cur.type)) {
|
|
416
|
+
cur = (0, tree_sitter_helpers_1.getChildByField)(cur, 'object');
|
|
417
|
+
}
|
|
418
|
+
return !!cur && cur.type === 'identifier' && (0, tree_sitter_helpers_1.getNodeText)(cur, source) !== 'window';
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* TS/JS wrappers that leave a member call's receiver the same object:
|
|
422
|
+
* `(x).m()`, `x!.m()`, `(x as T).m()`, `(x satisfies T).m()`, `(<T>x).m()`
|
|
423
|
+
* and `(await x).m()` all call `m` on what `x` holds.
|
|
424
|
+
*/
|
|
425
|
+
const TS_JS_TRANSPARENT_RECEIVER_TYPES = new Set([
|
|
426
|
+
'parenthesized_expression', 'non_null_expression', 'as_expression',
|
|
427
|
+
'satisfies_expression', 'type_assertion', 'await_expression',
|
|
428
|
+
]);
|
|
429
|
+
/**
|
|
430
|
+
* Strip {@link TS_JS_TRANSPARENT_RECEIVER_TYPES} wrappers off a receiver.
|
|
431
|
+
* tree-sitter-typescript parses `a && b!.c()` as `(a && b)!.c()`; the `!`
|
|
432
|
+
* belongs to the right operand, so a non-null over a binary expression peels
|
|
433
|
+
* to that operand.
|
|
434
|
+
*/
|
|
435
|
+
function peelTsJsReceiver(node) {
|
|
436
|
+
let cur = node;
|
|
437
|
+
while (TS_JS_TRANSPARENT_RECEIVER_TYPES.has(cur.type)) {
|
|
438
|
+
let inner = cur.type === 'type_assertion'
|
|
439
|
+
? cur.namedChild(cur.namedChildCount - 1)
|
|
440
|
+
: cur.namedChild(0);
|
|
441
|
+
if (cur.type === 'non_null_expression') {
|
|
442
|
+
while (inner?.type === 'binary_expression')
|
|
443
|
+
inner = (0, tree_sitter_helpers_1.getChildByField)(inner, 'right');
|
|
444
|
+
}
|
|
445
|
+
if (!inner)
|
|
446
|
+
break;
|
|
447
|
+
cur = inner;
|
|
448
|
+
}
|
|
449
|
+
return cur;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Whether a TS/JS receiver still collapses to the bare method name: `this` /
|
|
453
|
+
* `super` (the resolver reads the owner off the enclosing class), a member
|
|
454
|
+
* chain rooted at either or at `window` (the project-global escape of
|
|
455
|
+
* {@link isUnresolvedTsJsChain}), and `new C()` (its class is written at the
|
|
456
|
+
* call).
|
|
457
|
+
*/
|
|
458
|
+
function keepsBareTsJsReceiver(node, source) {
|
|
459
|
+
let cur = node;
|
|
460
|
+
while (cur && TS_JS_CHAIN_RECEIVER_TYPES.has(cur.type)) {
|
|
461
|
+
const object = (0, tree_sitter_helpers_1.getChildByField)(cur, 'object');
|
|
462
|
+
cur = object ? peelTsJsReceiver(object) : null;
|
|
463
|
+
}
|
|
464
|
+
if (!cur)
|
|
465
|
+
return false;
|
|
466
|
+
if (cur.type === 'this' || cur.type === 'super')
|
|
467
|
+
return true;
|
|
468
|
+
if (cur.type === 'identifier')
|
|
469
|
+
return (0, tree_sitter_helpers_1.getNodeText)(cur, source) === 'window';
|
|
470
|
+
return cur === node && cur.type === 'new_expression';
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* React hooks that bind a NAME to a handler function (`const onPress =
|
|
474
|
+
* useCallback(() => {…}, [])`). The arrow inside is extracted as a function
|
|
475
|
+
* node named by the declarator — see `reactHookBoundName`.
|
|
476
|
+
*/
|
|
477
|
+
const REACT_HANDLER_HOOKS = /^(?:React\.)?use(?:Callback|EffectEvent|Event)$/;
|
|
385
478
|
class TreeSitterExtractor {
|
|
479
|
+
/**
|
|
480
|
+
* The node's prose, from either place it can live: a preceding comment
|
|
481
|
+
* sibling (every language) or a docstring inside the body (Python's bare
|
|
482
|
+
* first-statement string, and the same shape in other languages that opt in
|
|
483
|
+
* via `getBodyDocstring`). When a node carries both, they are joined rather
|
|
484
|
+
* than one winning — they are two separate things the author wrote about the
|
|
485
|
+
* same symbol, and the column holds free text (#1905).
|
|
486
|
+
*/
|
|
487
|
+
docstringFor(node) {
|
|
488
|
+
const preceding = (0, tree_sitter_helpers_1.getPrecedingDocstring)(node, this.source);
|
|
489
|
+
const body = this.extractor?.getBodyDocstring?.(node, this.source);
|
|
490
|
+
if (preceding && body)
|
|
491
|
+
return `${preceding}\n\n${body}`;
|
|
492
|
+
return body || preceding;
|
|
493
|
+
}
|
|
386
494
|
filePath;
|
|
387
495
|
language;
|
|
388
496
|
source;
|
|
389
497
|
tree = null;
|
|
390
498
|
nodes = [];
|
|
499
|
+
nodeIds = new tree_sitter_helpers_1.NodeIdAllocator();
|
|
391
500
|
edges = [];
|
|
392
501
|
unresolvedReferences = [];
|
|
393
502
|
// Value-reference edges (default ON; set CODEGRAPH_VALUE_REFS=0 to disable; see flushValueRefs).
|
|
@@ -503,6 +612,9 @@ class TreeSitterExtractor {
|
|
|
503
612
|
isExported: false,
|
|
504
613
|
updatedAt: Date.now(),
|
|
505
614
|
};
|
|
615
|
+
const fileDocstring = this.extractor?.getBodyDocstring?.(this.tree.rootNode, this.source);
|
|
616
|
+
if (fileDocstring)
|
|
617
|
+
fileNode.docstring = fileDocstring;
|
|
506
618
|
this.nodes.push(fileNode);
|
|
507
619
|
// Push file node onto stack so top-level declarations get contains edges
|
|
508
620
|
this.nodeStack.push(fileNode.id);
|
|
@@ -521,6 +633,16 @@ class TreeSitterExtractor {
|
|
|
521
633
|
if (packageNodeId)
|
|
522
634
|
this.nodeStack.pop();
|
|
523
635
|
this.nodeStack.pop();
|
|
636
|
+
// hasError is routine for several grammars; warn only when no symbols survived.
|
|
637
|
+
const symbolCount = this.nodes.filter((n) => n.kind !== 'file').length;
|
|
638
|
+
if (this.tree?.rootNode.hasError && symbolCount === 0) {
|
|
639
|
+
this.errors.push({
|
|
640
|
+
message: `${this.filePath}: parse produced no symbols (tree has errors) — ` +
|
|
641
|
+
`the file is indexed but contributes nothing to the graph`,
|
|
642
|
+
severity: 'warning',
|
|
643
|
+
code: 'parse_error',
|
|
644
|
+
});
|
|
645
|
+
}
|
|
524
646
|
}
|
|
525
647
|
catch (error) {
|
|
526
648
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -586,6 +708,7 @@ class TreeSitterExtractor {
|
|
|
586
708
|
return;
|
|
587
709
|
const nodeType = node.type;
|
|
588
710
|
if (depth > 0 && (this.extractor?.functionTypes.includes(nodeType) ||
|
|
711
|
+
((this.language === 'lua' || this.language === 'luau') && nodeType === 'function_definition') ||
|
|
589
712
|
nodeType === 'arrow_function' ||
|
|
590
713
|
nodeType === 'function_expression' ||
|
|
591
714
|
nodeType === 'lambda_literal' ||
|
|
@@ -630,6 +753,13 @@ class TreeSitterExtractor {
|
|
|
630
753
|
for (const n of this.nodes) {
|
|
631
754
|
if (n.kind === 'function' || n.kind === 'method')
|
|
632
755
|
definedHere.add(n.name);
|
|
756
|
+
// Python only (#1478): class-as-value is a first-class idiom (DRF
|
|
757
|
+
// get_serializer_class, Meta.model, registry dicts), so same-file CLASS
|
|
758
|
+
// names pass the gate too. Other languages keep the function/method
|
|
759
|
+
// gate — TS/JS recover class references through type annotations, and
|
|
760
|
+
// resolution's kind filter would drop their class candidates anyway.
|
|
761
|
+
else if (this.language === 'python' && n.kind === 'class')
|
|
762
|
+
definedHere.add(n.name);
|
|
633
763
|
}
|
|
634
764
|
// Import-binding names only (all binding emitters push kind 'imports').
|
|
635
765
|
// Deliberately NOT 'references': those carry type-annotation and
|
|
@@ -940,6 +1070,25 @@ class TreeSitterExtractor {
|
|
|
940
1070
|
if (skipChildren)
|
|
941
1071
|
return;
|
|
942
1072
|
}
|
|
1073
|
+
if (this.language === 'cpp' && (0, c_cpp_1.isCppConstructorDeclaration)(node)) {
|
|
1074
|
+
this.extractMethod(node);
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
// C/C++ function-like macros (`#define TRACE(x) ...`) become `constant`
|
|
1078
|
+
// nodes carrying the directive as their signature. A macro is a value,
|
|
1079
|
+
// never an executable callee: the resolver reads these to recognize a
|
|
1080
|
+
// call whose name is a macro visible in the translation unit and refuses
|
|
1081
|
+
// to bind it to a same-named function elsewhere (#1838). Mirrored in the
|
|
1082
|
+
// kernel (ccpp/mod.rs visit_node).
|
|
1083
|
+
if ((this.language === 'c' || this.language === 'cpp') && nodeType === 'preproc_function_def') {
|
|
1084
|
+
const name = (0, tree_sitter_helpers_1.getChildByField)(node, 'name');
|
|
1085
|
+
if (name) {
|
|
1086
|
+
this.createNode('constant', (0, tree_sitter_helpers_1.getNodeText)(name, this.source), node, {
|
|
1087
|
+
signature: (0, tree_sitter_helpers_1.getNodeText)(node, this.source).trim(),
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
return;
|
|
1091
|
+
}
|
|
943
1092
|
// C++ namespace blocks: carry the namespace name as a qualifiedName prefix
|
|
944
1093
|
// while walking the body, so `namespace flash { void compute_attn(); }`
|
|
945
1094
|
// indexes compute_attn with qualifiedName `flash::compute_attn` and a
|
|
@@ -998,6 +1147,9 @@ class TreeSitterExtractor {
|
|
|
998
1147
|
else if (classification === 'trait') {
|
|
999
1148
|
this.extractClass(node, 'trait');
|
|
1000
1149
|
}
|
|
1150
|
+
else if (classification === 'module') {
|
|
1151
|
+
this.extractClass(node, 'module');
|
|
1152
|
+
}
|
|
1001
1153
|
else {
|
|
1002
1154
|
this.extractClass(node);
|
|
1003
1155
|
}
|
|
@@ -1008,12 +1160,23 @@ class TreeSitterExtractor {
|
|
|
1008
1160
|
this.extractClass(node);
|
|
1009
1161
|
skipChildren = true;
|
|
1010
1162
|
}
|
|
1011
|
-
// Check for method declarations (only if not already handled by functionTypes)
|
|
1012
|
-
|
|
1163
|
+
// Check for method declarations (only if not already handled by functionTypes).
|
|
1164
|
+
// A bodiless SIGNATURE only counts as one where a type declares it — see
|
|
1165
|
+
// SIGNATURE_METHOD_NODE_TYPES for what falling through would otherwise mint.
|
|
1166
|
+
else if (this.extractor.methodTypes.includes(nodeType)
|
|
1167
|
+
&& (!(TS_JS_CHAIN_LANGUAGES.has(this.language) || this.language === 'arkts')
|
|
1168
|
+
|| !SIGNATURE_METHOD_NODE_TYPES.has(nodeType) || this.isInsideClassLikeNode())) {
|
|
1013
1169
|
// TS/JS class fields parse as a methodTypes node; only function-valued
|
|
1014
1170
|
// fields are methods — a plain field (`public fonts: Fonts;`) is a
|
|
1015
|
-
// property (#808).
|
|
1016
|
-
|
|
1171
|
+
// property (#808). C++ lists `field_declaration` so pure-virtual methods
|
|
1172
|
+
// mint nodes (#1727); non-callable ones return 'skip' and fall through to
|
|
1173
|
+
// the children walk. classifyMethodNode is absent for other languages.
|
|
1174
|
+
const methodClass = this.extractor.classifyMethodNode?.(node) ?? 'method';
|
|
1175
|
+
if (methodClass === 'skip') {
|
|
1176
|
+
// Not a method — leave skipChildren false so data-member initializers
|
|
1177
|
+
// still contribute call/instantiation edges under the enclosing class.
|
|
1178
|
+
}
|
|
1179
|
+
else if (methodClass === 'property') {
|
|
1017
1180
|
const propNode = this.extractProperty(node);
|
|
1018
1181
|
// Walk the initializer so its calls/instantiations attribute to the
|
|
1019
1182
|
// property (`history = createHistory()` → history calls
|
|
@@ -1046,6 +1209,11 @@ class TreeSitterExtractor {
|
|
|
1046
1209
|
this.extractStruct(node);
|
|
1047
1210
|
skipChildren = true; // extractStruct visits body children
|
|
1048
1211
|
}
|
|
1212
|
+
// Check for union declarations
|
|
1213
|
+
else if (this.extractor.unionTypes?.includes(nodeType)) {
|
|
1214
|
+
this.extractUnion(node);
|
|
1215
|
+
skipChildren = true; // extractUnion visits body children
|
|
1216
|
+
}
|
|
1049
1217
|
// Check for enum declarations
|
|
1050
1218
|
else if (this.extractor.enumTypes.includes(nodeType)) {
|
|
1051
1219
|
this.extractEnum(node);
|
|
@@ -1251,20 +1419,16 @@ class TreeSitterExtractor {
|
|
|
1251
1419
|
else if (nodeType === 'impl_item') {
|
|
1252
1420
|
this.extractRustImplItem(node);
|
|
1253
1421
|
}
|
|
1254
|
-
//
|
|
1255
|
-
//
|
|
1256
|
-
//
|
|
1257
|
-
//
|
|
1258
|
-
//
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
this.extractTypeAnnotations(node, parentId);
|
|
1265
|
-
}
|
|
1266
|
-
// don't skipChildren — nested signatures still need traversal
|
|
1267
|
-
}
|
|
1422
|
+
// NOTE: `property_signature` / `method_signature` used to be handled here,
|
|
1423
|
+
// hanging their type annotations off the ENCLOSING INTERFACE — the only
|
|
1424
|
+
// anchor available while the members themselves went unextracted. Since
|
|
1425
|
+
// #1638 they are in the TS extractor's `methodTypes` / `propertyTypes`, so
|
|
1426
|
+
// the branches above claim them first (under the same `isInsideClassLikeNode`
|
|
1427
|
+
// guard this branch had, so nothing it used to reach is now missed) and this
|
|
1428
|
+
// one was dead. The `references` edges survive — `extractMethod` and
|
|
1429
|
+
// `extractProperty` each call `extractTypeAnnotations` — but now hang off
|
|
1430
|
+
// the member, which is the more precise anchor: `Api::fetch → PageId` says
|
|
1431
|
+
// which member wants the type, where `Api → PageId` only said the file did.
|
|
1268
1432
|
// Visit children (unless the extract method already visited them)
|
|
1269
1433
|
if (!skipChildren) {
|
|
1270
1434
|
for (let i = 0; i < node.namedChildCount; i++) {
|
|
@@ -1284,7 +1448,7 @@ class TreeSitterExtractor {
|
|
|
1284
1448
|
if (!name) {
|
|
1285
1449
|
return null;
|
|
1286
1450
|
}
|
|
1287
|
-
const id =
|
|
1451
|
+
const id = this.nodeIds.generate(this.filePath, kind, name, node.startPosition.row + 1, node.startPosition.column);
|
|
1288
1452
|
// Some grammars (e.g. Dart) model a function/method body as a *sibling* of
|
|
1289
1453
|
// the signature node, so the declaration node's own range is just the
|
|
1290
1454
|
// signature line. Extend endLine to the resolved body when it sits beyond
|
|
@@ -1438,7 +1602,7 @@ class TreeSitterExtractor {
|
|
|
1438
1602
|
}
|
|
1439
1603
|
/**
|
|
1440
1604
|
* Check if the current node stack indicates we are inside a class-like node
|
|
1441
|
-
* (class, struct, interface, trait). File nodes do not count as class-like.
|
|
1605
|
+
* (class, struct, union, interface, trait). File nodes do not count as class-like.
|
|
1442
1606
|
*/
|
|
1443
1607
|
isInsideClassLikeNode() {
|
|
1444
1608
|
if (this.nodeStack.length === 0)
|
|
@@ -1451,6 +1615,7 @@ class TreeSitterExtractor {
|
|
|
1451
1615
|
return false;
|
|
1452
1616
|
return (parentNode.kind === 'class' ||
|
|
1453
1617
|
parentNode.kind === 'struct' ||
|
|
1618
|
+
parentNode.kind === 'union' ||
|
|
1454
1619
|
parentNode.kind === 'interface' ||
|
|
1455
1620
|
parentNode.kind === 'trait' ||
|
|
1456
1621
|
parentNode.kind === 'enum' ||
|
|
@@ -1485,13 +1650,15 @@ class TreeSitterExtractor {
|
|
|
1485
1650
|
// — SvelteKit actions). Inline-object arrows reached by the general walker
|
|
1486
1651
|
// get no override, so they still fall through to the <anonymous> skip below.
|
|
1487
1652
|
let name = nameOverride ?? extractName(node, this.source, this.extractor);
|
|
1653
|
+
// A CommonJS export assignment names the function it holds — see below.
|
|
1654
|
+
let commonJsExport = false;
|
|
1488
1655
|
// For arrow functions and function expressions assigned to variables,
|
|
1489
1656
|
// resolve the name from the parent variable_declarator.
|
|
1490
1657
|
// e.g. `export const useAuth = () => { ... }` — the arrow_function node
|
|
1491
1658
|
// has no `name` field; the name lives on the variable_declarator.
|
|
1492
1659
|
if (!nameOverride &&
|
|
1493
1660
|
name === '<anonymous>' &&
|
|
1494
|
-
(node.type === 'arrow_function' || node.type === 'function_expression')) {
|
|
1661
|
+
(node.type === 'arrow_function' || node.type === 'function_expression' || node.type === 'generator_function')) {
|
|
1495
1662
|
const parent = node.parent;
|
|
1496
1663
|
if (parent?.type === 'variable_declarator') {
|
|
1497
1664
|
const varName = (0, tree_sitter_helpers_1.getChildByField)(parent, 'name');
|
|
@@ -1499,6 +1666,19 @@ class TreeSitterExtractor {
|
|
|
1499
1666
|
name = (0, tree_sitter_helpers_1.getNodeText)(varName, this.source);
|
|
1500
1667
|
}
|
|
1501
1668
|
}
|
|
1669
|
+
else if (parent?.type === 'assignment_expression') {
|
|
1670
|
+
// `exports.getItems = async (req, res) => {…}` / `module.exports.x =
|
|
1671
|
+
// function () {…}` — the CommonJS controller style. The function is
|
|
1672
|
+
// anonymous only syntactically: the export property is the name every
|
|
1673
|
+
// `router.get('/items', getItems)` resolves. Without a node the handler
|
|
1674
|
+
// is invisible to callers/impact and its calls attribute to the file
|
|
1675
|
+
// (#1675). Same treatment `const X = () => {}` already gets.
|
|
1676
|
+
const exportName = this.commonJsExportName(parent, node);
|
|
1677
|
+
if (exportName) {
|
|
1678
|
+
name = exportName;
|
|
1679
|
+
commonJsExport = true;
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1502
1682
|
}
|
|
1503
1683
|
if (name === '<anonymous>') {
|
|
1504
1684
|
// Don't emit a node for the anonymous wrapper itself, but still visit its
|
|
@@ -1523,10 +1703,10 @@ class TreeSitterExtractor {
|
|
|
1523
1703
|
}
|
|
1524
1704
|
return;
|
|
1525
1705
|
}
|
|
1526
|
-
const docstring =
|
|
1706
|
+
const docstring = this.docstringFor(node);
|
|
1527
1707
|
const signature = this.extractor.getSignature?.(node, this.source);
|
|
1528
1708
|
const visibility = this.extractor.getVisibility?.(node);
|
|
1529
|
-
const isExported = this.extractor.isExported?.(node, this.source);
|
|
1709
|
+
const isExported = commonJsExport || this.extractor.isExported?.(node, this.source);
|
|
1530
1710
|
const isAsync = this.extractor.isAsync?.(node);
|
|
1531
1711
|
const isStatic = this.extractor.isStatic?.(node);
|
|
1532
1712
|
const returnType = this.extractor.getReturnType?.(node, this.source);
|
|
@@ -1636,7 +1816,7 @@ class TreeSitterExtractor {
|
|
|
1636
1816
|
if (this.extractor.skipBodilessClass && !resolvedBody)
|
|
1637
1817
|
return;
|
|
1638
1818
|
const name = extractName(node, this.source, this.extractor);
|
|
1639
|
-
const docstring =
|
|
1819
|
+
const docstring = this.docstringFor(node);
|
|
1640
1820
|
const visibility = this.extractor.getVisibility?.(node);
|
|
1641
1821
|
const isExported = this.extractor.isExported?.(node, this.source);
|
|
1642
1822
|
const classNode = this.createNode(kind, name, node, {
|
|
@@ -1708,11 +1888,14 @@ class TreeSitterExtractor {
|
|
|
1708
1888
|
}
|
|
1709
1889
|
return;
|
|
1710
1890
|
}
|
|
1711
|
-
const docstring =
|
|
1891
|
+
const docstring = this.docstringFor(node);
|
|
1712
1892
|
const signature = this.extractor.getSignature?.(node, this.source);
|
|
1713
1893
|
const visibility = this.extractor.getVisibility?.(node);
|
|
1714
1894
|
const isAsync = this.extractor.isAsync?.(node);
|
|
1715
1895
|
const isStatic = this.extractor.isStatic?.(node);
|
|
1896
|
+
// Only persist abstract when true — a false return must not mint `isAbstract: false`
|
|
1897
|
+
// on every ordinary method (breaks kernel↔wasm parity JSON equality).
|
|
1898
|
+
const isAbstract = this.extractor.isAbstract?.(node) ? true : undefined;
|
|
1716
1899
|
const returnType = this.extractor.getReturnType?.(node, this.source);
|
|
1717
1900
|
const extraProps = {
|
|
1718
1901
|
docstring,
|
|
@@ -1720,6 +1903,7 @@ class TreeSitterExtractor {
|
|
|
1720
1903
|
visibility,
|
|
1721
1904
|
isAsync,
|
|
1722
1905
|
isStatic,
|
|
1906
|
+
isAbstract,
|
|
1723
1907
|
returnType,
|
|
1724
1908
|
};
|
|
1725
1909
|
if (receiverType) {
|
|
@@ -1733,7 +1917,7 @@ class TreeSitterExtractor {
|
|
|
1733
1917
|
if (receiverType && !this.isInsideClassLikeNode()) {
|
|
1734
1918
|
const ownerNode = this.nodes.find((n) => n.name === receiverType &&
|
|
1735
1919
|
n.filePath === this.filePath &&
|
|
1736
|
-
(n.kind === 'struct' || n.kind === 'class' || n.kind === 'enum' || n.kind === 'trait'));
|
|
1920
|
+
(n.kind === 'struct' || n.kind === 'union' || n.kind === 'class' || n.kind === 'enum' || n.kind === 'trait'));
|
|
1737
1921
|
if (ownerNode) {
|
|
1738
1922
|
this.edges.push({
|
|
1739
1923
|
source: ownerNode.id,
|
|
@@ -1762,7 +1946,7 @@ class TreeSitterExtractor {
|
|
|
1762
1946
|
if (!this.extractor)
|
|
1763
1947
|
return;
|
|
1764
1948
|
const name = extractName(node, this.source, this.extractor);
|
|
1765
|
-
const docstring =
|
|
1949
|
+
const docstring = this.docstringFor(node);
|
|
1766
1950
|
const isExported = this.extractor.isExported?.(node, this.source);
|
|
1767
1951
|
const kind = this.extractor.interfaceKind ?? 'interface';
|
|
1768
1952
|
const interfaceNode = this.createNode(kind, name, node, {
|
|
@@ -1791,34 +1975,49 @@ class TreeSitterExtractor {
|
|
|
1791
1975
|
* Extract a struct
|
|
1792
1976
|
*/
|
|
1793
1977
|
extractStruct(node) {
|
|
1978
|
+
this.extractAggregate(node, 'struct');
|
|
1979
|
+
}
|
|
1980
|
+
/** Extract a union while sharing the member-walk behavior of aggregate types. */
|
|
1981
|
+
extractUnion(node) {
|
|
1982
|
+
this.extractAggregate(node, 'union');
|
|
1983
|
+
}
|
|
1984
|
+
/** Extract a struct-like declaration without conflating its semantic kind. */
|
|
1985
|
+
extractAggregate(node, kind) {
|
|
1794
1986
|
if (!this.extractor)
|
|
1795
1987
|
return;
|
|
1796
1988
|
// Skip forward declarations and type references (no body = not a definition)
|
|
1797
1989
|
// — EXCEPT C# positional records (`record struct M(decimal Amount);`),
|
|
1798
1990
|
// complete definitions with no body block. (#831)
|
|
1991
|
+
//
|
|
1992
|
+
// `allowBodilessStruct` is the per-language escape hatch for the same
|
|
1993
|
+
// situation: a bodiless struct that IS a complete definition (Rust's unit
|
|
1994
|
+
// struct `struct Unit;`). Opposite polarity from `skipBodilessClass`
|
|
1995
|
+
// (#1093) because the two defaults differ — a bodiless CLASS is kept
|
|
1996
|
+
// unless a language opts into skipping, a bodiless STRUCT is skipped
|
|
1997
|
+
// unless a language opts into keeping.
|
|
1799
1998
|
const body = (0, tree_sitter_helpers_1.getChildByField)(node, this.extractor.bodyField);
|
|
1800
|
-
if (!body && node.type !== 'record_declaration')
|
|
1999
|
+
if (!body && node.type !== 'record_declaration' && !this.extractor.allowBodilessStruct)
|
|
1801
2000
|
return;
|
|
1802
2001
|
const name = extractName(node, this.source, this.extractor);
|
|
1803
|
-
const docstring =
|
|
2002
|
+
const docstring = this.docstringFor(node);
|
|
1804
2003
|
const visibility = this.extractor.getVisibility?.(node);
|
|
1805
2004
|
const isExported = this.extractor.isExported?.(node, this.source);
|
|
1806
|
-
const
|
|
2005
|
+
const aggregateNode = this.createNode(kind, name, node, {
|
|
1807
2006
|
docstring,
|
|
1808
2007
|
visibility,
|
|
1809
2008
|
isExported,
|
|
1810
2009
|
});
|
|
1811
|
-
if (!
|
|
2010
|
+
if (!aggregateNode)
|
|
1812
2011
|
return;
|
|
1813
2012
|
// Extract inheritance (e.g. Swift: struct HTTPMethod: RawRepresentable)
|
|
1814
|
-
this.extractInheritance(node,
|
|
2013
|
+
this.extractInheritance(node, aggregateNode.id);
|
|
1815
2014
|
// C# primary-constructor parameter dependencies (`struct P(int x)`, and
|
|
1816
2015
|
// `record struct M(decimal Amount)` which the grammar nests here).
|
|
1817
|
-
this.extractCsharpPrimaryCtorParamRefs(node,
|
|
2016
|
+
this.extractCsharpPrimaryCtorParamRefs(node, aggregateNode.id);
|
|
1818
2017
|
// Push to stack for field extraction (bodiless positional records have
|
|
1819
2018
|
// no members to visit)
|
|
1820
2019
|
if (body) {
|
|
1821
|
-
this.nodeStack.push(
|
|
2020
|
+
this.nodeStack.push(aggregateNode.id);
|
|
1822
2021
|
for (let i = 0; i < body.namedChildCount; i++) {
|
|
1823
2022
|
const child = body.namedChild(i);
|
|
1824
2023
|
if (child) {
|
|
@@ -1840,7 +2039,7 @@ class TreeSitterExtractor {
|
|
|
1840
2039
|
if (!body)
|
|
1841
2040
|
return;
|
|
1842
2041
|
const name = extractName(node, this.source, this.extractor);
|
|
1843
|
-
const docstring =
|
|
2042
|
+
const docstring = this.docstringFor(node);
|
|
1844
2043
|
const visibility = this.extractor.getVisibility?.(node);
|
|
1845
2044
|
const isExported = this.extractor.isExported?.(node, this.source);
|
|
1846
2045
|
const enumNode = this.createNode('enum', name, node, {
|
|
@@ -1900,7 +2099,7 @@ class TreeSitterExtractor {
|
|
|
1900
2099
|
extractProperty(node) {
|
|
1901
2100
|
if (!this.extractor)
|
|
1902
2101
|
return null;
|
|
1903
|
-
const docstring =
|
|
2102
|
+
const docstring = this.docstringFor(node);
|
|
1904
2103
|
const visibility = this.extractor.getVisibility?.(node);
|
|
1905
2104
|
const isStatic = this.extractor.isStatic?.(node) ?? false;
|
|
1906
2105
|
const hookName = this.extractor.extractPropertyName?.(node, this.source);
|
|
@@ -1919,7 +2118,17 @@ class TreeSitterExtractor {
|
|
|
1919
2118
|
// and the initializer VALUE, which the generic finder below would
|
|
1920
2119
|
// wrongly pick — so fields use the type field only (#808). Other
|
|
1921
2120
|
// languages (C# property_declaration) keep the generic scan.
|
|
1922
|
-
|
|
2121
|
+
//
|
|
2122
|
+
// A `property_signature` (an interface member, #1638) carries a `type`
|
|
2123
|
+
// field and no value, so it reads the type field too. It cannot take the
|
|
2124
|
+
// generic scan: that scan's exclusion list covers `identifier` but not the
|
|
2125
|
+
// `property_identifier` an interface member is named with, so it stops on
|
|
2126
|
+
// the name and `interface Stats { counts: Record<string, number> }` yields
|
|
2127
|
+
// `signature: "counts counts"` instead of the type. Named explicitly
|
|
2128
|
+
// rather than folded into the field test so no other language's
|
|
2129
|
+
// `property_declaration` moves off the generic scan.
|
|
2130
|
+
const isTsJsField = node.type === 'public_field_definition' || node.type === 'field_definition'
|
|
2131
|
+
|| node.type === 'property_signature';
|
|
1923
2132
|
const typeNode = isTsJsField
|
|
1924
2133
|
? (0, tree_sitter_helpers_1.getChildByField)(node, 'type')
|
|
1925
2134
|
: node.namedChildren.find(c => c.type !== 'modifier' && c.type !== 'modifiers'
|
|
@@ -1953,7 +2162,7 @@ class TreeSitterExtractor {
|
|
|
1953
2162
|
extractField(node) {
|
|
1954
2163
|
if (!this.extractor)
|
|
1955
2164
|
return;
|
|
1956
|
-
const docstring =
|
|
2165
|
+
const docstring = this.docstringFor(node);
|
|
1957
2166
|
const visibility = this.extractor.getVisibility?.(node);
|
|
1958
2167
|
const isStatic = this.extractor.isStatic?.(node) ?? false;
|
|
1959
2168
|
// A class field that is actually a CONSTANT (Java `static final`, C# `const`
|
|
@@ -2033,6 +2242,21 @@ class TreeSitterExtractor {
|
|
|
2033
2242
|
// and the language-aware path in `extractTypeAnnotations` descends
|
|
2034
2243
|
// into that wrapper (#381).
|
|
2035
2244
|
this.extractTypeAnnotations(node, fieldNode.id);
|
|
2245
|
+
// Walk the initializer ATTRIBUTED to the declared field (#693, the
|
|
2246
|
+
// Go fix; same shape as the TS/JS class-field walk above). The
|
|
2247
|
+
// dispatcher only scanned this subtree for function-as-value
|
|
2248
|
+
// candidates, so a lambda / method reference / anonymous class in
|
|
2249
|
+
// `private final Runnable r = () -> target();` contributed NO call
|
|
2250
|
+
// edge at all and `target` looked callerless. Keyed on the `value`
|
|
2251
|
+
// FIELD, which only Java's `variable_declarator` carries — C#,
|
|
2252
|
+
// VB.NET and PHP spell their initializer differently and are
|
|
2253
|
+
// deliberately untouched here.
|
|
2254
|
+
const valueNode = (0, tree_sitter_helpers_1.getChildByField)(decl, 'value');
|
|
2255
|
+
if (valueNode) {
|
|
2256
|
+
this.nodeStack.push(fieldNode.id);
|
|
2257
|
+
this.visitFunctionBody(valueNode, fieldNode.id);
|
|
2258
|
+
this.nodeStack.pop();
|
|
2259
|
+
}
|
|
2036
2260
|
}
|
|
2037
2261
|
}
|
|
2038
2262
|
}
|
|
@@ -2068,6 +2292,13 @@ class TreeSitterExtractor {
|
|
|
2068
2292
|
if (key && value && (value.type === 'arrow_function' || value.type === 'function_expression')) {
|
|
2069
2293
|
this.extractFunction(value, this.objectKeyName(key));
|
|
2070
2294
|
}
|
|
2295
|
+
else if (value?.type === 'call_expression') {
|
|
2296
|
+
// `key: Effect.fn("…")(function* () {…})` — see curriedWrapperBoundName.
|
|
2297
|
+
const fn = (0, tree_sitter_helpers_1.getChildByField)(value, 'arguments')?.namedChild(0);
|
|
2298
|
+
const bound = fn ? this.curriedWrapperBoundName(fn) : null;
|
|
2299
|
+
if (fn && bound)
|
|
2300
|
+
this.extractFunction(fn, bound);
|
|
2301
|
+
}
|
|
2071
2302
|
}
|
|
2072
2303
|
else if (member.type === 'method_definition') {
|
|
2073
2304
|
// Method shorthand: `{ fetchUser() {...} }`. extractMethod deliberately
|
|
@@ -2080,6 +2311,21 @@ class TreeSitterExtractor {
|
|
|
2080
2311
|
}
|
|
2081
2312
|
}
|
|
2082
2313
|
}
|
|
2314
|
+
/**
|
|
2315
|
+
* A top-level binding exported by a LATER statement rather than at its
|
|
2316
|
+
* declaration: `export default NAME`, `export { NAME }`, `export { NAME as
|
|
2317
|
+
* default }`. The declaration's own `isExported` (an `export_statement`
|
|
2318
|
+
* ancestor) cannot see these, so a store written as `const useStore =
|
|
2319
|
+
* create(…)` + `export default useStore` read as unexported and its actions
|
|
2320
|
+
* were never extracted. One anchored regex over the file source; JS-family
|
|
2321
|
+
* callers only.
|
|
2322
|
+
*/
|
|
2323
|
+
isExportedLater(name) {
|
|
2324
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(name))
|
|
2325
|
+
return false;
|
|
2326
|
+
const re = new RegExp(`^[ \\t]*export\\s+(?:default\\s+${name}\\s*;?[ \\t]*$|\\{[^}]*\\b${name}\\b[^}]*\\})`, 'm');
|
|
2327
|
+
return re.test(this.source);
|
|
2328
|
+
}
|
|
2083
2329
|
/** Property-key text with surrounding quotes stripped (`'foo'` → `foo`). */
|
|
2084
2330
|
objectKeyName(key) {
|
|
2085
2331
|
return (0, tree_sitter_helpers_1.getNodeText)(key, this.source).replace(/^['"`]|['"`]$/g, '');
|
|
@@ -2484,7 +2730,7 @@ class TreeSitterExtractor {
|
|
|
2484
2730
|
// Go: var_declaration, short_var_declaration, const_declaration
|
|
2485
2731
|
const isConst = this.extractor.isConst?.(node) ?? false;
|
|
2486
2732
|
const kind = isConst ? 'constant' : 'variable';
|
|
2487
|
-
const docstring =
|
|
2733
|
+
const docstring = this.docstringFor(node);
|
|
2488
2734
|
const isExported = this.extractor.isExported?.(node, this.source) ?? false;
|
|
2489
2735
|
// Extract variable declarators based on language
|
|
2490
2736
|
if (this.language === 'typescript' || this.language === 'javascript' ||
|
|
@@ -2512,7 +2758,7 @@ class TreeSitterExtractor {
|
|
|
2512
2758
|
}
|
|
2513
2759
|
const name = (0, tree_sitter_helpers_1.getNodeText)(nameNode, this.source);
|
|
2514
2760
|
// Arrow functions / function expressions: extract as function instead of variable
|
|
2515
|
-
if (valueNode && (valueNode.type === 'arrow_function' || valueNode.type === 'function_expression')) {
|
|
2761
|
+
if (valueNode && (valueNode.type === 'arrow_function' || valueNode.type === 'function_expression' || valueNode.type === 'generator_function')) {
|
|
2516
2762
|
this.extractFunction(valueNode);
|
|
2517
2763
|
continue;
|
|
2518
2764
|
}
|
|
@@ -2562,7 +2808,10 @@ class TreeSitterExtractor {
|
|
|
2562
2808
|
// never nodes — so `node`/`callers` on `fetchUser` return "not
|
|
2563
2809
|
// found" and the agent Reads the store to reconstruct the flow.
|
|
2564
2810
|
// Scoped to EXPORTED consts to exclude inline-object noise
|
|
2565
|
-
// (`ctx.set({...})`) the object-method skip deliberately avoids
|
|
2811
|
+
// (`ctx.set({...})`) the object-method skip deliberately avoids —
|
|
2812
|
+
// where "exported" includes the two-statement form `const useStore
|
|
2813
|
+
// = create(…)` … `export default useStore` (see isExportedLater),
|
|
2814
|
+
// the shape most React Native stores are written in.
|
|
2566
2815
|
const objectOfFns = valueNode && (valueNode.type === 'object' || valueNode.type === 'object_expression')
|
|
2567
2816
|
? valueNode
|
|
2568
2817
|
: valueNode?.type === 'call_expression'
|
|
@@ -2574,7 +2823,7 @@ class TreeSitterExtractor {
|
|
|
2574
2823
|
// whose functions are body-local consts — it must fall through to a
|
|
2575
2824
|
// normal body walk (extracting those consts), not be skipped here.
|
|
2576
2825
|
const hasInlineFns = !!objectOfFns && this.objectHasInlineFunctions(objectOfFns);
|
|
2577
|
-
const extractObjectMethods = isExported && !!objectOfFns && hasInlineFns;
|
|
2826
|
+
const extractObjectMethods = (isExported || this.isExportedLater(name)) && !!objectOfFns && hasInlineFns;
|
|
2578
2827
|
// RTK Query: `createApi`/`injectEndpoints` define endpoints as
|
|
2579
2828
|
// object-literal properties whose values are `build.query/mutation(...)`
|
|
2580
2829
|
// calls — nested under an `endpoints` arrow, so neither the
|
|
@@ -2601,19 +2850,25 @@ class TreeSitterExtractor {
|
|
|
2601
2850
|
VUE_STORE_COLLECTION_NAMES.has(name) && this.looksLikeVueStoreFile()) {
|
|
2602
2851
|
storeCollections.push(objectOfFns);
|
|
2603
2852
|
}
|
|
2604
|
-
// Visit the initializer body for calls
|
|
2605
|
-
//
|
|
2606
|
-
// / createApi / store-collection
|
|
2607
|
-
//
|
|
2608
|
-
//
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2853
|
+
// Visit the initializer body for calls, ATTRIBUTED to the declared
|
|
2854
|
+
// symbol (#693) — EXCEPT the shapes whose members are extracted
|
|
2855
|
+
// one-by-one below (the store-factory / createApi / store-collection
|
|
2856
|
+
// objects), where walking the whole initializer would re-visit each
|
|
2857
|
+
// member arrow and double-count its calls.
|
|
2858
|
+
//
|
|
2859
|
+
// Two things were wrong here before. The walk ran with only the FILE
|
|
2860
|
+
// on the stack, so `const cfg = load()` recorded the FILE as load's
|
|
2861
|
+
// caller — the exact leak Go's #693 fixed. And an object literal was
|
|
2862
|
+
// skipped outright, so `const obj = { handler: () => target() }`
|
|
2863
|
+
// contributed nothing at all unless the const was exported (only then
|
|
2864
|
+
// does extractObjectLiteralFunctions mint the members).
|
|
2865
|
+
const membersExtractedSeparately = extractObjectMethods || !!rtkEndpoints || !!piniaSetup || storeCollections.length > 0;
|
|
2866
|
+
if (valueNode && !membersExtractedSeparately) {
|
|
2867
|
+
if (varNode)
|
|
2868
|
+
this.nodeStack.push(varNode.id);
|
|
2616
2869
|
this.visitFunctionBody(valueNode, '');
|
|
2870
|
+
if (varNode)
|
|
2871
|
+
this.nodeStack.pop();
|
|
2617
2872
|
}
|
|
2618
2873
|
if (extractObjectMethods && objectOfFns) {
|
|
2619
2874
|
this.extractObjectLiteralFunctions(objectOfFns);
|
|
@@ -2637,17 +2892,32 @@ class TreeSitterExtractor {
|
|
|
2637
2892
|
const right = (0, tree_sitter_helpers_1.getChildByField)(node, 'right') || node.namedChild(1);
|
|
2638
2893
|
// Ruby constant assignments (`MAX = 3`) have a `constant`-typed LHS, not
|
|
2639
2894
|
// `identifier`; without this they were never extracted as symbols at all.
|
|
2895
|
+
let assigned = null;
|
|
2640
2896
|
if (left && (left.type === 'identifier' || left.type === 'constant')) {
|
|
2641
2897
|
const name = (0, tree_sitter_helpers_1.getNodeText)(left, this.source);
|
|
2642
2898
|
// Skip if name starts with lowercase and looks like a function call result
|
|
2643
2899
|
// Python constants are usually UPPER_CASE
|
|
2644
2900
|
const initValue = right ? (0, tree_sitter_helpers_1.getNodeText)(right, this.source).slice(0, 100) : undefined;
|
|
2645
2901
|
const initSignature = initValue ? `= ${initValue}${initValue.length >= 100 ? '...' : ''}` : undefined;
|
|
2646
|
-
this.createNode(kind, name, node, {
|
|
2902
|
+
assigned = this.createNode(kind, name, node, {
|
|
2647
2903
|
docstring,
|
|
2648
2904
|
signature: initSignature,
|
|
2649
2905
|
});
|
|
2650
2906
|
}
|
|
2907
|
+
// Walk the initializer ATTRIBUTED to the assigned name (#693). A
|
|
2908
|
+
// module-level `app = FastAPI()` / `ENGINE = create_engine(url)` /
|
|
2909
|
+
// `handler = lambda: run()` dropped every call on the right-hand side, so
|
|
2910
|
+
// whatever the module builds at import time linked to nothing. A tuple
|
|
2911
|
+
// target (`a, b = f(), g()`) mints no symbol, so its RHS is walked at the
|
|
2912
|
+
// enclosing scope rather than lost. Python only: Ruby shares this branch
|
|
2913
|
+
// and gets its own turn.
|
|
2914
|
+
if (this.language === 'python' && right) {
|
|
2915
|
+
if (assigned)
|
|
2916
|
+
this.nodeStack.push(assigned.id);
|
|
2917
|
+
this.visitFunctionBody(right, '');
|
|
2918
|
+
if (assigned)
|
|
2919
|
+
this.nodeStack.pop();
|
|
2920
|
+
}
|
|
2651
2921
|
}
|
|
2652
2922
|
else if (this.language === 'go') {
|
|
2653
2923
|
// Go: var_declaration, short_var_declaration, const_declaration
|
|
@@ -2713,15 +2983,26 @@ class TreeSitterExtractor {
|
|
|
2713
2983
|
const varList = assign.namedChildren.find((c) => c.type === 'variable_list');
|
|
2714
2984
|
const exprList = assign.namedChildren.find((c) => c.type === 'expression_list');
|
|
2715
2985
|
const values = exprList ? exprList.namedChildren : [];
|
|
2716
|
-
const
|
|
2717
|
-
|
|
2718
|
-
const name = (0, tree_sitter_helpers_1.getNodeText)(nameNode, this.source);
|
|
2719
|
-
if (!name)
|
|
2720
|
-
return;
|
|
2986
|
+
const targets = varList ? varList.namedChildren : [];
|
|
2987
|
+
targets.forEach((nameNode, i) => {
|
|
2721
2988
|
const valueNode = values[i];
|
|
2989
|
+
const target = this.luaAssignmentTarget(nameNode);
|
|
2990
|
+
if (!target)
|
|
2991
|
+
return;
|
|
2992
|
+
if (valueNode?.type === 'function_definition') {
|
|
2993
|
+
this.extractLuaFunctionValue(valueNode, target.name, target.receiver, docstring);
|
|
2994
|
+
return;
|
|
2995
|
+
}
|
|
2996
|
+
if (valueNode?.type === 'table_constructor') {
|
|
2997
|
+
this.extractLuaTableFunctions(valueNode, target.fullName);
|
|
2998
|
+
}
|
|
2999
|
+
// A dotted assignment updates a table member; it is not a standalone
|
|
3000
|
+
// variable node. Function-valued members were handled above.
|
|
3001
|
+
if (target.receiver || node.type === 'assignment_statement')
|
|
3002
|
+
return;
|
|
2722
3003
|
const initValue = valueNode ? (0, tree_sitter_helpers_1.getNodeText)(valueNode, this.source).slice(0, 100) : undefined;
|
|
2723
3004
|
const initSignature = initValue ? `= ${initValue}${initValue.length >= 100 ? '...' : ''}` : undefined;
|
|
2724
|
-
this.createNode(kind, name, nameNode, { docstring, signature: initSignature, isExported });
|
|
3005
|
+
this.createNode(kind, target.name, nameNode, { docstring, signature: initSignature, isExported });
|
|
2725
3006
|
});
|
|
2726
3007
|
}
|
|
2727
3008
|
else if (this.language === 'c') {
|
|
@@ -2786,6 +3067,8 @@ class TreeSitterExtractor {
|
|
|
2786
3067
|
else {
|
|
2787
3068
|
// Generic fallback for other languages
|
|
2788
3069
|
// Try to find identifier children
|
|
3070
|
+
const nameField = (0, tree_sitter_helpers_1.getChildByField)(node, 'name');
|
|
3071
|
+
let declared = null;
|
|
2789
3072
|
for (let i = 0; i < node.namedChildCount; i++) {
|
|
2790
3073
|
const child = node.namedChild(i);
|
|
2791
3074
|
if (child?.type === 'identifier' || child?.type === 'variable_declarator') {
|
|
@@ -2793,13 +3076,103 @@ class TreeSitterExtractor {
|
|
|
2793
3076
|
? (0, tree_sitter_helpers_1.getNodeText)(child, this.source)
|
|
2794
3077
|
: extractName(child, this.source, this.extractor);
|
|
2795
3078
|
if (name && name !== '<anonymous>') {
|
|
2796
|
-
this.createNode(kind, name, child, {
|
|
3079
|
+
const created = this.createNode(kind, name, child, {
|
|
2797
3080
|
docstring,
|
|
2798
3081
|
isExported,
|
|
2799
3082
|
});
|
|
3083
|
+
if (created && nameField && child.startIndex === nameField.startIndex) {
|
|
3084
|
+
declared = created;
|
|
3085
|
+
}
|
|
2800
3086
|
}
|
|
2801
3087
|
}
|
|
2802
3088
|
}
|
|
3089
|
+
// Walk the initializer ATTRIBUTED to the declared symbol (#693). Rust
|
|
3090
|
+
// only for now: `const N: usize = compute()` and
|
|
3091
|
+
// `static REGISTRY: Lazy<T> = Lazy::new(|| build())` dropped every call
|
|
3092
|
+
// inside the initializer, so a handler table or a lazily-built singleton
|
|
3093
|
+
// linked to nothing. The other languages sharing this fallback spell
|
|
3094
|
+
// their initializer differently and get their own turn.
|
|
3095
|
+
if (this.language === 'rust') {
|
|
3096
|
+
const valueNode = (0, tree_sitter_helpers_1.getChildByField)(node, 'value');
|
|
3097
|
+
if (valueNode) {
|
|
3098
|
+
if (declared)
|
|
3099
|
+
this.nodeStack.push(declared.id);
|
|
3100
|
+
this.visitFunctionBody(valueNode, '');
|
|
3101
|
+
if (declared)
|
|
3102
|
+
this.nodeStack.pop();
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
/** Resolve a Lua assignment target into its callable name and optional table receiver. */
|
|
3108
|
+
luaAssignmentTarget(node) {
|
|
3109
|
+
if (node.type === 'identifier') {
|
|
3110
|
+
const name = (0, tree_sitter_helpers_1.getNodeText)(node, this.source).trim();
|
|
3111
|
+
return name ? { name, fullName: name } : null;
|
|
3112
|
+
}
|
|
3113
|
+
if (node.type !== 'dot_index_expression' &&
|
|
3114
|
+
node.type !== 'method_index_expression' &&
|
|
3115
|
+
node.type !== 'bracket_index_expression')
|
|
3116
|
+
return null;
|
|
3117
|
+
const table = (0, tree_sitter_helpers_1.getChildByField)(node, 'table');
|
|
3118
|
+
const field = (0, tree_sitter_helpers_1.getChildByField)(node, 'field') ?? (0, tree_sitter_helpers_1.getChildByField)(node, 'method');
|
|
3119
|
+
if (!table || !field)
|
|
3120
|
+
return null;
|
|
3121
|
+
const receiver = (0, tree_sitter_helpers_1.getNodeText)(table, this.source).trim();
|
|
3122
|
+
const name = this.luaStaticFieldName(field, node.type === 'bracket_index_expression');
|
|
3123
|
+
if (!receiver || !name)
|
|
3124
|
+
return null;
|
|
3125
|
+
return { name, receiver, fullName: `${receiver}.${name}` };
|
|
3126
|
+
}
|
|
3127
|
+
/** A statically-known Lua field name; dynamic bracket keys are not callable identities. */
|
|
3128
|
+
luaStaticFieldName(node, bracketed) {
|
|
3129
|
+
if (node.type === 'identifier') {
|
|
3130
|
+
return bracketed ? '' : (0, tree_sitter_helpers_1.getNodeText)(node, this.source).trim();
|
|
3131
|
+
}
|
|
3132
|
+
if (node.type === 'string') {
|
|
3133
|
+
const content = node.namedChildren.find((child) => child.type === 'string_content');
|
|
3134
|
+
return content ? (0, tree_sitter_helpers_1.getNodeText)(content, this.source).trim() : '';
|
|
3135
|
+
}
|
|
3136
|
+
return '';
|
|
3137
|
+
}
|
|
3138
|
+
/** Extract an anonymous Lua function using the name supplied by its assignment target. */
|
|
3139
|
+
extractLuaFunctionValue(node, name, receiver, docstring) {
|
|
3140
|
+
if (!this.extractor)
|
|
3141
|
+
return;
|
|
3142
|
+
const signature = this.extractor.getSignature?.(node, this.source);
|
|
3143
|
+
const extra = { docstring, signature };
|
|
3144
|
+
if (receiver)
|
|
3145
|
+
extra.qualifiedName = this.composeReceiverQualifiedName(receiver, name);
|
|
3146
|
+
else
|
|
3147
|
+
extra.isExported = this.extractor.isExported?.(node, this.source);
|
|
3148
|
+
const functionNode = this.createNode(receiver ? 'method' : 'function', name, node, extra);
|
|
3149
|
+
if (!functionNode)
|
|
3150
|
+
return;
|
|
3151
|
+
this.nodeStack.push(functionNode.id);
|
|
3152
|
+
const body = (0, tree_sitter_helpers_1.getChildByField)(node, this.extractor.bodyField);
|
|
3153
|
+
if (body)
|
|
3154
|
+
this.visitFunctionBody(body, functionNode.id);
|
|
3155
|
+
this.nodeStack.pop();
|
|
3156
|
+
}
|
|
3157
|
+
/** Extract function-valued keyed fields from a Lua table, including nested tables. */
|
|
3158
|
+
extractLuaTableFunctions(table, receiver) {
|
|
3159
|
+
for (const field of table.namedChildren) {
|
|
3160
|
+
if (field.type !== 'field')
|
|
3161
|
+
continue;
|
|
3162
|
+
const nameNode = (0, tree_sitter_helpers_1.getChildByField)(field, 'name');
|
|
3163
|
+
const valueNode = (0, tree_sitter_helpers_1.getChildByField)(field, 'value');
|
|
3164
|
+
if (!nameNode || !valueNode)
|
|
3165
|
+
continue;
|
|
3166
|
+
const bracketed = (0, tree_sitter_helpers_1.getNodeText)(field, this.source).trimStart().startsWith('[');
|
|
3167
|
+
const name = this.luaStaticFieldName(nameNode, bracketed);
|
|
3168
|
+
if (!name)
|
|
3169
|
+
continue;
|
|
3170
|
+
if (valueNode.type === 'function_definition') {
|
|
3171
|
+
this.extractLuaFunctionValue(valueNode, name, receiver);
|
|
3172
|
+
}
|
|
3173
|
+
else if (valueNode.type === 'table_constructor') {
|
|
3174
|
+
this.extractLuaTableFunctions(valueNode, `${receiver}.${name}`);
|
|
3175
|
+
}
|
|
2803
3176
|
}
|
|
2804
3177
|
}
|
|
2805
3178
|
/**
|
|
@@ -2814,23 +3187,23 @@ class TreeSitterExtractor {
|
|
|
2814
3187
|
const name = extractName(node, this.source, this.extractor);
|
|
2815
3188
|
if (name === '<anonymous>')
|
|
2816
3189
|
return false;
|
|
2817
|
-
const docstring =
|
|
3190
|
+
const docstring = this.docstringFor(node);
|
|
2818
3191
|
const isExported = this.extractor.isExported?.(node, this.source);
|
|
2819
3192
|
// Check if this type alias is actually a struct or interface definition
|
|
2820
3193
|
// (e.g. Go: `type Foo struct { ... }` is a type_spec wrapping struct_type)
|
|
2821
3194
|
const resolvedKind = this.extractor.resolveTypeAliasKind?.(node, this.source);
|
|
2822
|
-
if (resolvedKind === 'struct') {
|
|
2823
|
-
const
|
|
2824
|
-
if (!
|
|
3195
|
+
if (resolvedKind === 'struct' || resolvedKind === 'union') {
|
|
3196
|
+
const aggregateNode = this.createNode(resolvedKind, name, node, { docstring, isExported });
|
|
3197
|
+
if (!aggregateNode)
|
|
2825
3198
|
return true;
|
|
2826
3199
|
// Visit body children for field extraction
|
|
2827
|
-
this.nodeStack.push(
|
|
2828
|
-
// Try Go-style 'type' field first, then find inner
|
|
3200
|
+
this.nodeStack.push(aggregateNode.id);
|
|
3201
|
+
// Try Go-style 'type' field first, then find the matching inner aggregate child.
|
|
2829
3202
|
const typeChild = (0, tree_sitter_helpers_1.getChildByField)(node, 'type')
|
|
2830
|
-
|| this.findChildByTypes(node, this.extractor.structTypes);
|
|
3203
|
+
|| this.findChildByTypes(node, resolvedKind === 'union' ? (this.extractor.unionTypes ?? []) : this.extractor.structTypes);
|
|
2831
3204
|
if (typeChild) {
|
|
2832
3205
|
// Extract struct embedding (e.g. Go: `type DB struct { *Head; Queryable }`)
|
|
2833
|
-
this.extractInheritance(typeChild,
|
|
3206
|
+
this.extractInheritance(typeChild, aggregateNode.id);
|
|
2834
3207
|
const body = (0, tree_sitter_helpers_1.getChildByField)(typeChild, this.extractor.bodyField) || typeChild;
|
|
2835
3208
|
for (let i = 0; i < body.namedChildCount; i++) {
|
|
2836
3209
|
const child = body.namedChild(i);
|
|
@@ -2978,7 +3351,7 @@ class TreeSitterExtractor {
|
|
|
2978
3351
|
const memberKind = child.type === 'method_signature'
|
|
2979
3352
|
? 'method'
|
|
2980
3353
|
: this.isTsFunctionTypedProperty(child) ? 'method' : 'property';
|
|
2981
|
-
const docstring =
|
|
3354
|
+
const docstring = this.docstringFor(child);
|
|
2982
3355
|
const signature = (0, tree_sitter_helpers_1.getNodeText)(child, this.source);
|
|
2983
3356
|
this.createNode(memberKind, memberName, child, {
|
|
2984
3357
|
docstring,
|
|
@@ -3681,15 +4054,18 @@ class TreeSitterExtractor {
|
|
|
3681
4054
|
}
|
|
3682
4055
|
// Erlang: a local call is `call(expr: atom, args)`; a remote call nests it
|
|
3683
4056
|
// under `remote(module: remote_module, fun: call)` — the module qualifier
|
|
3684
|
-
// lives on the PARENT.
|
|
3685
|
-
//
|
|
3686
|
-
//
|
|
3687
|
-
//
|
|
3688
|
-
//
|
|
3689
|
-
//
|
|
3690
|
-
// `
|
|
3691
|
-
//
|
|
3692
|
-
//
|
|
4057
|
+
// lives on the PARENT. Arity is part of a function's identity (#1610), so
|
|
4058
|
+
// refs carry the call-site arity: remote calls are emitted as `mod::fn/2`,
|
|
4059
|
+
// byte-identical to the qualifiedName the module namespace + arity suffix
|
|
4060
|
+
// gives every function (see languages/erlang.ts), so they resolve via
|
|
4061
|
+
// matchByQualifiedName; local calls are emitted `fn/2` and resolved by the
|
|
4062
|
+
// erlang arity step in matchReference (same-file first). A var/macro callee
|
|
4063
|
+
// or module (`F(X)`, `?M(X)`, `Mod:handle(X)`) has no static target —
|
|
4064
|
+
// except `?MODULE:fn(X)`, which the bare-name-with-arity + same-file
|
|
4065
|
+
// preference resolves correctly. `fun name/1` / `fun mod:name/1` values
|
|
4066
|
+
// are function REFERENCES (callback registration) carrying their own
|
|
4067
|
+
// written arity, and record construction/update/index/field-access are
|
|
4068
|
+
// `references` to the record's struct node.
|
|
3693
4069
|
if (this.language === 'erlang') {
|
|
3694
4070
|
const line = node.startPosition.row + 1;
|
|
3695
4071
|
const column = node.startPosition.column;
|
|
@@ -3723,9 +4099,13 @@ class TreeSitterExtractor {
|
|
|
3723
4099
|
if (!macroName || (0, tree_sitter_helpers_1.getNodeText)(macroName, this.source) !== 'MODULE')
|
|
3724
4100
|
return;
|
|
3725
4101
|
}
|
|
4102
|
+
// Arity from the call site's own argument list — part of the callee's
|
|
4103
|
+
// identity, and what disambiguates `f/1` from `f/2` (#1610).
|
|
4104
|
+
const callArgsNode = (0, tree_sitter_helpers_1.getChildByField)(node, 'args');
|
|
4105
|
+
const callArity = callArgsNode ? callArgsNode.namedChildCount : 0;
|
|
3726
4106
|
this.unresolvedReferences.push({
|
|
3727
4107
|
fromNodeId: callerId,
|
|
3728
|
-
referenceName: calleeName
|
|
4108
|
+
referenceName: `${calleeName}/${callArity}`,
|
|
3729
4109
|
referenceKind: 'calls',
|
|
3730
4110
|
line,
|
|
3731
4111
|
column,
|
|
@@ -3746,9 +4126,10 @@ class TreeSitterExtractor {
|
|
|
3746
4126
|
const target = argsNode?.namedChild(0) ?? null;
|
|
3747
4127
|
const targetModule = target ? this.resolveErlangGenServerTarget(target) : null;
|
|
3748
4128
|
if (targetModule) {
|
|
4129
|
+
// OTP fixes the handler arities: handle_call/3, handle_cast/2.
|
|
3749
4130
|
this.unresolvedReferences.push({
|
|
3750
4131
|
fromNodeId: callerId,
|
|
3751
|
-
referenceName: `${targetModule}::${fnBare === 'cast' ? 'handle_cast' : 'handle_call'}`,
|
|
4132
|
+
referenceName: `${targetModule}::${fnBare === 'cast' ? 'handle_cast/2' : 'handle_call/3'}`,
|
|
3752
4133
|
referenceKind: 'calls',
|
|
3753
4134
|
line,
|
|
3754
4135
|
column,
|
|
@@ -3780,9 +4161,17 @@ class TreeSitterExtractor {
|
|
|
3780
4161
|
(0, tree_sitter_helpers_1.getNodeText)((0, tree_sitter_helpers_1.getChildByField)(m, 'name'), this.source) === 'MODULE';
|
|
3781
4162
|
if (m.type !== 'atom' && !isLocalModule)
|
|
3782
4163
|
continue;
|
|
4164
|
+
// Arity of the spawned/applied function = the length of the
|
|
4165
|
+
// static args-list literal directly after the (M, F) pair, when
|
|
4166
|
+
// present (`spawn_link(?MODULE, request_process, [Req, Env])` →
|
|
4167
|
+
// /2). A var/absent list leaves the ref arity-less; the
|
|
4168
|
+
// qualified matcher then resolves it only when the module
|
|
4169
|
+
// defines exactly one arity of that name.
|
|
4170
|
+
const mfaList = argExprs[i + 2];
|
|
4171
|
+
const arityTail = mfaList?.type === 'list' ? `/${mfaList.namedChildCount}` : '';
|
|
3783
4172
|
this.unresolvedReferences.push({
|
|
3784
4173
|
fromNodeId: callerId,
|
|
3785
|
-
referenceName: isLocalModule ? erlAtom(f) : `${erlAtom(m)}::${erlAtom(f)}
|
|
4174
|
+
referenceName: (isLocalModule ? erlAtom(f) : `${erlAtom(m)}::${erlAtom(f)}`) + arityTail,
|
|
3786
4175
|
referenceKind: 'calls',
|
|
3787
4176
|
line: f.startPosition.row + 1,
|
|
3788
4177
|
column: f.startPosition.column,
|
|
@@ -3805,6 +4194,12 @@ class TreeSitterExtractor {
|
|
|
3805
4194
|
return;
|
|
3806
4195
|
refName = `${erlAtom(moduleAtom)}::${refName}`;
|
|
3807
4196
|
}
|
|
4197
|
+
// `fun f/1` writes its arity — carry it so the ref lands on the
|
|
4198
|
+
// matching arity's node (#1610).
|
|
4199
|
+
const funArityNode = (0, tree_sitter_helpers_1.getChildByField)(node, 'arity');
|
|
4200
|
+
const funArityValue = funArityNode ? (0, tree_sitter_helpers_1.getChildByField)(funArityNode, 'value') : null;
|
|
4201
|
+
if (funArityValue)
|
|
4202
|
+
refName = `${refName}/${(0, tree_sitter_helpers_1.getNodeText)(funArityValue, this.source)}`;
|
|
3808
4203
|
this.unresolvedReferences.push({
|
|
3809
4204
|
fromNodeId: callerId,
|
|
3810
4205
|
referenceName: refName,
|
|
@@ -4349,10 +4744,17 @@ class TreeSitterExtractor {
|
|
|
4349
4744
|
// This helps the resolver distinguish method calls from bare function calls
|
|
4350
4745
|
// (e.g., Python's console.print() vs builtin print())
|
|
4351
4746
|
// Skip self/this/cls as they don't aid resolution
|
|
4352
|
-
const
|
|
4747
|
+
const rawReceiver = (0, tree_sitter_helpers_1.getChildByField)(func, 'object') ||
|
|
4353
4748
|
(0, tree_sitter_helpers_1.getChildByField)(func, 'operand') ||
|
|
4354
4749
|
(0, tree_sitter_helpers_1.getChildByField)(func, 'argument') ||
|
|
4355
4750
|
func.namedChild(0);
|
|
4751
|
+
// TS/JS: look through wrappers that keep the receiver the same
|
|
4752
|
+
// object (`(x).m()`, `x!.m()`, `(x as T).m()`, `(await f()).m()`),
|
|
4753
|
+
// so the branches below see the identifier / call / chain the
|
|
4754
|
+
// call is really made on.
|
|
4755
|
+
const receiver = rawReceiver && TS_JS_CHAIN_LANGUAGES.has(this.language)
|
|
4756
|
+
? peelTsJsReceiver(rawReceiver)
|
|
4757
|
+
: rawReceiver;
|
|
4356
4758
|
// A LITERAL receiver — `", ".join(...)`, `"x".toUpperCase()`,
|
|
4357
4759
|
// `5.times`, `[].concat(...)` — calls a builtin of the literal's
|
|
4358
4760
|
// type, never a project symbol. The bare-name fallback below let
|
|
@@ -4373,6 +4775,37 @@ class TreeSitterExtractor {
|
|
|
4373
4775
|
calleeName = methodName;
|
|
4374
4776
|
}
|
|
4375
4777
|
}
|
|
4778
|
+
else if (this.language === 'rust' && receiver && receiver.type === 'self') {
|
|
4779
|
+
// Rust `self.method()`. Keep the `self.` prefix, exactly as the
|
|
4780
|
+
// field shape below does (#1585): the resolver reads the owner
|
|
4781
|
+
// off the CALLING method's qualified name and resolves the
|
|
4782
|
+
// method on that type. Collapsing to the bare method name handed
|
|
4783
|
+
// the resolver a name with no owner, which it then matched among
|
|
4784
|
+
// all same-named methods by file proximity — so `self.reset()`
|
|
4785
|
+
// inside `impl Target` landed on a `Decoy::reset` that happened
|
|
4786
|
+
// to sit nearer, with nothing in the edge to show it was a guess
|
|
4787
|
+
// (#1861). Mirrored in the kernel's extract_call (rustlang.rs).
|
|
4788
|
+
calleeName = `self.${methodName}`;
|
|
4789
|
+
}
|
|
4790
|
+
else if (this.language === 'rust' &&
|
|
4791
|
+
receiver &&
|
|
4792
|
+
receiver.type === 'field_expression' &&
|
|
4793
|
+
(0, tree_sitter_helpers_1.getChildByField)(receiver, 'value')?.type === 'self' &&
|
|
4794
|
+
(0, tree_sitter_helpers_1.getChildByField)(receiver, 'field')?.type === 'field_identifier') {
|
|
4795
|
+
// Rust `self.<field>.<method>()` — a call through a field of the
|
|
4796
|
+
// enclosing type (#1585). Keep the `self.` prefix: the resolver
|
|
4797
|
+
// recognizes the shape, reads the field's declared type off the
|
|
4798
|
+
// owner struct's declaration, and resolves the method on THAT
|
|
4799
|
+
// type — or leaves the ref unresolved when the type is external
|
|
4800
|
+
// or unknown. Previously this collapsed to the bare method name,
|
|
4801
|
+
// which exact-matched whichever same-named method was nearest —
|
|
4802
|
+
// often the calling method itself, a self-edge not in the source.
|
|
4803
|
+
// Deeper chains (`self.a.b.m()`), `self.f().m()` and parenthesized
|
|
4804
|
+
// receivers keep the bare name. Mirrored in the kernel's
|
|
4805
|
+
// extract_call (rustlang.rs).
|
|
4806
|
+
const fieldName = (0, tree_sitter_helpers_1.getNodeText)((0, tree_sitter_helpers_1.getChildByField)(receiver, 'field'), this.source);
|
|
4807
|
+
calleeName = `self.${fieldName}.${methodName}`;
|
|
4808
|
+
}
|
|
4376
4809
|
else if ((this.language === 'cpp' ||
|
|
4377
4810
|
this.language === 'c' ||
|
|
4378
4811
|
this.language === 'kotlin' ||
|
|
@@ -4448,6 +4881,56 @@ class TreeSitterExtractor {
|
|
|
4448
4881
|
// name, which either failed to resolve or resolved ambiguously.
|
|
4449
4882
|
calleeName = `${(0, tree_sitter_helpers_1.getNodeText)(receiver, this.source)}.${methodName}`;
|
|
4450
4883
|
}
|
|
4884
|
+
else if ((this.language === 'typescript' ||
|
|
4885
|
+
this.language === 'javascript' ||
|
|
4886
|
+
this.language === 'tsx' ||
|
|
4887
|
+
this.language === 'jsx') &&
|
|
4888
|
+
receiver &&
|
|
4889
|
+
receiver.type === 'member_expression' &&
|
|
4890
|
+
(0, tree_sitter_helpers_1.getChildByField)(receiver, 'object')?.type === 'this' &&
|
|
4891
|
+
THIS_FIELD_PROPERTY_TYPES.has((0, tree_sitter_helpers_1.getChildByField)(receiver, 'property')?.type ?? '')) {
|
|
4892
|
+
// TS/JS call through a field of the enclosing class —
|
|
4893
|
+
// `this.mailer.send()` (#1496). Keep the `this.<field>` prefix:
|
|
4894
|
+
// the resolver reads the field's declared type off the class's
|
|
4895
|
+
// own declaration (`private mailer: Mailer`, `mailer = new
|
|
4896
|
+
// Mailer()`) and resolves the method on THAT type — or leaves the
|
|
4897
|
+
// ref unresolved when the type is external or unknown. Previously
|
|
4898
|
+
// this collapsed to the bare method name, which exact-matched
|
|
4899
|
+
// whichever same-named method was nearest — the calling method
|
|
4900
|
+
// itself when the two share a name, a self-edge not in the
|
|
4901
|
+
// source. Same discipline as Rust's `self.<field>` (#1585).
|
|
4902
|
+
// Mirrored in the kernel's extract_call (tsjs/extractors.rs).
|
|
4903
|
+
// An ES private field (`this.#items.add()`) is the same shape;
|
|
4904
|
+
// its name keeps the `#` (#1987).
|
|
4905
|
+
const fieldName = (0, tree_sitter_helpers_1.getNodeText)((0, tree_sitter_helpers_1.getChildByField)(receiver, 'property'), this.source);
|
|
4906
|
+
calleeName = `this.${fieldName}.${methodName}`;
|
|
4907
|
+
}
|
|
4908
|
+
else if ((this.language === 'typescript' ||
|
|
4909
|
+
this.language === 'javascript' ||
|
|
4910
|
+
this.language === 'tsx' ||
|
|
4911
|
+
this.language === 'jsx' ||
|
|
4912
|
+
this.language === 'python') &&
|
|
4913
|
+
receiver &&
|
|
4914
|
+
(receiver.type === 'call_expression' || receiver.type === 'call')) {
|
|
4915
|
+
// Receiver that is itself a call — `d.setdefault(k, []).append(v)`,
|
|
4916
|
+
// `make().run()`, `res.json().data` (#1683). The bare method name
|
|
4917
|
+
// this used to emit exact-matched any top-level project symbol of
|
|
4918
|
+
// that name and fabricated a call edge from an unrelated function
|
|
4919
|
+
// (`append`, `get`, `run`…). Keep the inner callee, encoded as
|
|
4920
|
+
// `<inner>().<method>` like the Java/Kotlin/C++ chains: the
|
|
4921
|
+
// marker never appears in an ordinary ref, so nothing name-matches
|
|
4922
|
+
// it, and a chain resolver can later infer the receiver's type
|
|
4923
|
+
// from what the inner call returns. An inner callee that is not a
|
|
4924
|
+
// plain name or member chain (`(await x)()`, `arr[0]()`) has no
|
|
4925
|
+
// static receiver at all — emit nothing: a silent miss, never a
|
|
4926
|
+
// wrong edge. The inner call is visited on its own either way.
|
|
4927
|
+
// Mirrored in the kernel (tsjs/extractors.rs, python.rs).
|
|
4928
|
+
const innerFn = (0, tree_sitter_helpers_1.getChildByField)(receiver, 'function');
|
|
4929
|
+
const innerCallee = innerFn ? (0, tree_sitter_helpers_1.getNodeText)(innerFn, this.source).replace(/\s+/g, '') : '';
|
|
4930
|
+
if (!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(innerCallee))
|
|
4931
|
+
return;
|
|
4932
|
+
calleeName = `${innerCallee}().${methodName}`;
|
|
4933
|
+
}
|
|
4451
4934
|
else if (this.language === 'go' &&
|
|
4452
4935
|
receiver &&
|
|
4453
4936
|
receiver.type === 'selector_expression' &&
|
|
@@ -4462,6 +4945,30 @@ class TreeSitterExtractor {
|
|
|
4462
4945
|
// inference (see matchGoFieldChainCall) or stay unresolved.
|
|
4463
4946
|
calleeName = `${(0, tree_sitter_helpers_1.getNodeText)(receiver, this.source).replace(/\s+/g, '')}.${methodName}`;
|
|
4464
4947
|
}
|
|
4948
|
+
else if (TS_JS_CHAIN_LANGUAGES.has(this.language) &&
|
|
4949
|
+
receiver &&
|
|
4950
|
+
TS_JS_CHAIN_RECEIVER_TYPES.has(receiver.type) &&
|
|
4951
|
+
isUnresolvedTsJsChain(receiver, this.source)) {
|
|
4952
|
+
// Keep the source call for effect reporting, but never collapse
|
|
4953
|
+
// it to a guessed method. The resolver only lets frameworks
|
|
4954
|
+
// with receiver evidence handle these qualified chains.
|
|
4955
|
+
const chain = (0, tree_sitter_helpers_1.getNodeText)(func, this.source).replace(/\s+/g, '').replace(/\?\./g, '.');
|
|
4956
|
+
if (!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*){2,}$/.test(chain))
|
|
4957
|
+
return;
|
|
4958
|
+
calleeName = chain;
|
|
4959
|
+
}
|
|
4960
|
+
else if (TS_JS_CHAIN_LANGUAGES.has(this.language) &&
|
|
4961
|
+
receiver &&
|
|
4962
|
+
!keepsBareTsJsReceiver(receiver, this.source)) {
|
|
4963
|
+
// Any other TS/JS receiver is an expression with no static
|
|
4964
|
+
// type here — `(a ?? b).map()`, `f().list.map()`,
|
|
4965
|
+
// `arr[0].run()`, `(() => {}).call()`. The bare method name this
|
|
4966
|
+
// used to emit exact-matched whichever project method shared the
|
|
4967
|
+
// name (`(await list()).map()` onto an adapter class's `map`).
|
|
4968
|
+
// Emit nothing: a silent miss, never a wrong edge. Mirrored in
|
|
4969
|
+
// the kernel's extract_call (tsjs/extractors.rs).
|
|
4970
|
+
return;
|
|
4971
|
+
}
|
|
4465
4972
|
else {
|
|
4466
4973
|
calleeName = methodName;
|
|
4467
4974
|
}
|
|
@@ -4665,43 +5172,103 @@ class TreeSitterExtractor {
|
|
|
4665
5172
|
}
|
|
4666
5173
|
}
|
|
4667
5174
|
/**
|
|
4668
|
-
*
|
|
4669
|
-
* that invokes a constructor — `Calculator calc(0)` (direct-init) or
|
|
4670
|
-
* `Widget w{1, 2}` (brace-init) — as opposed to a plain variable or a
|
|
4671
|
-
* function declaration? Used to emit an `instantiates` edge for the
|
|
5175
|
+
* C++ stack construction — `Calculator calc(0)` / `Widget w{1, 2}` — is
|
|
4672
5176
|
* call-less construction syntax (#1035); heap `new T(...)` is handled
|
|
4673
5177
|
* separately by INSTANTIATION_KINDS.
|
|
4674
5178
|
*
|
|
4675
|
-
*
|
|
4676
|
-
*
|
|
4677
|
-
*
|
|
4678
|
-
*
|
|
4679
|
-
*
|
|
4680
|
-
*
|
|
4681
|
-
*
|
|
4682
|
-
*
|
|
4683
|
-
*
|
|
4684
|
-
*
|
|
4685
|
-
*
|
|
5179
|
+
* The `type` field must be a class-like NAMED type (`type_identifier`,
|
|
5180
|
+
* `template_type`, or `qualified_identifier`). Primitives (`int x(0)`),
|
|
5181
|
+
* `auto` (`placeholder_type_specifier` — that form always carries a real
|
|
5182
|
+
* `call_expression`, already handled), and sized specifiers are excluded —
|
|
5183
|
+
* they construct no class. `extern T x;` declares, it constructs nothing.
|
|
5184
|
+
*
|
|
5185
|
+
* Per declarator:
|
|
5186
|
+
* - a bare `identifier` is default construction (`T item;`) — arity 0;
|
|
5187
|
+
* - an `init_declarator` whose `value` is an `argument_list` (`(args)`) or
|
|
5188
|
+
* `initializer_list` (`{args}`) carries constructor arguments — arity is
|
|
5189
|
+
* the argument count. An array declarator's braces hold ELEMENTS, not
|
|
5190
|
+
* constructor arguments, so each braced element has its own arity;
|
|
5191
|
+
* - pointer / reference / function declarators construct nothing:
|
|
5192
|
+
* `T* p{}` is a null pointer, `T& r{x}` binds a reference, and the
|
|
5193
|
+
* most-vexing-parse `T c();` is a function declaration.
|
|
5194
|
+
*
|
|
5195
|
+
* `instantiates` (the type) is retained for initialized declarations,
|
|
5196
|
+
* preserving the #1035 dependency edges. `calls` (`T::T/arity`, resolved to
|
|
5197
|
+
* the constructor by src/resolution/cpp-constructor.ts, #1839) is emitted
|
|
5198
|
+
* for every declarator with an arity, default construction included.
|
|
5199
|
+
* Mirrored in the kernel (ccpp/mod.rs cpp_stack_constructions).
|
|
4686
5200
|
*/
|
|
4687
|
-
|
|
5201
|
+
cppStackConstructions(node) {
|
|
5202
|
+
const none = { instantiates: false, arities: [] };
|
|
4688
5203
|
const typeNode = (0, tree_sitter_helpers_1.getChildByField)(node, 'type');
|
|
4689
5204
|
if (!typeNode ||
|
|
4690
5205
|
(typeNode.type !== 'type_identifier' &&
|
|
4691
5206
|
typeNode.type !== 'template_type' &&
|
|
4692
5207
|
typeNode.type !== 'qualified_identifier')) {
|
|
4693
|
-
return
|
|
5208
|
+
return none;
|
|
4694
5209
|
}
|
|
5210
|
+
let instantiates = false;
|
|
5211
|
+
const arities = [];
|
|
4695
5212
|
for (let i = 0; i < node.namedChildCount; i++) {
|
|
4696
5213
|
const child = node.namedChild(i);
|
|
4697
|
-
if (child
|
|
5214
|
+
if (!child)
|
|
5215
|
+
continue;
|
|
5216
|
+
if (child.type === 'storage_class_specifier' && (0, tree_sitter_helpers_1.getNodeText)(child, this.source) === 'extern')
|
|
5217
|
+
return none;
|
|
5218
|
+
if (child.type === 'identifier' || child.type === 'array_declarator') {
|
|
5219
|
+
if (child.type === 'array_declarator' && !this.cppObjectArray(child))
|
|
5220
|
+
continue;
|
|
5221
|
+
arities.push(0);
|
|
5222
|
+
continue;
|
|
5223
|
+
}
|
|
5224
|
+
if (child.type !== 'init_declarator')
|
|
5225
|
+
continue;
|
|
5226
|
+
const declarator = (0, tree_sitter_helpers_1.getChildByField)(child, 'declarator');
|
|
5227
|
+
if (declarator?.type !== 'identifier' && declarator?.type !== 'array_declarator')
|
|
4698
5228
|
continue;
|
|
4699
5229
|
const value = (0, tree_sitter_helpers_1.getChildByField)(child, 'value');
|
|
4700
|
-
if (value
|
|
4701
|
-
|
|
5230
|
+
if (!value || (value.type !== 'argument_list' && value.type !== 'initializer_list'))
|
|
5231
|
+
continue;
|
|
5232
|
+
instantiates = true;
|
|
5233
|
+
if (declarator.type === 'identifier') {
|
|
5234
|
+
arities.push(value.namedChildren.filter((c) => c.type !== 'comment').length);
|
|
5235
|
+
}
|
|
5236
|
+
else if (this.cppObjectArray(declarator)) {
|
|
5237
|
+
const dimensions = [];
|
|
5238
|
+
let array = declarator;
|
|
5239
|
+
while (array?.type === 'array_declarator') {
|
|
5240
|
+
const size = (0, tree_sitter_helpers_1.getChildByField)(array, 'size')?.text ?? '';
|
|
5241
|
+
dimensions.unshift(/^\d+$/.test(size) && Number.isSafeInteger(Number(size)) ? Number(size) : NaN);
|
|
5242
|
+
array = (0, tree_sitter_helpers_1.getChildByField)(array, 'declarator');
|
|
5243
|
+
}
|
|
5244
|
+
const elements = (list, depth) => {
|
|
5245
|
+
const entries = list.namedChildren.filter((c) => c.type !== 'comment');
|
|
5246
|
+
let elided = false;
|
|
5247
|
+
for (const entry of entries) {
|
|
5248
|
+
if (depth + 1 < dimensions.length) {
|
|
5249
|
+
if (entry.type === 'initializer_list')
|
|
5250
|
+
elements(entry, depth + 1);
|
|
5251
|
+
else
|
|
5252
|
+
elided = true; // Unbraced multidimensional layout needs type information.
|
|
5253
|
+
}
|
|
5254
|
+
else {
|
|
5255
|
+
arities.push(entry.type === 'initializer_list'
|
|
5256
|
+
? entry.namedChildren.filter((c) => c.type !== 'comment').length : 1);
|
|
5257
|
+
}
|
|
5258
|
+
}
|
|
5259
|
+
if (!elided && (entries.length === 0 || dimensions[depth] > entries.length))
|
|
5260
|
+
arities.push(0);
|
|
5261
|
+
};
|
|
5262
|
+
elements(value, 0);
|
|
4702
5263
|
}
|
|
4703
5264
|
}
|
|
4704
|
-
return
|
|
5265
|
+
return { instantiates, arities };
|
|
5266
|
+
}
|
|
5267
|
+
cppObjectArray(node) {
|
|
5268
|
+
let element = (0, tree_sitter_helpers_1.getChildByField)(node, 'declarator');
|
|
5269
|
+
while (element?.type === 'array_declarator')
|
|
5270
|
+
element = (0, tree_sitter_helpers_1.getChildByField)(element, 'declarator');
|
|
5271
|
+
return element?.type === 'identifier';
|
|
4705
5272
|
}
|
|
4706
5273
|
/**
|
|
4707
5274
|
* Static-member / value-read pass. A type/enum/class used only via a member
|
|
@@ -4858,6 +5425,24 @@ class TreeSitterExtractor {
|
|
|
4858
5425
|
* (most non-decorator-using languages), the function is a no-op.
|
|
4859
5426
|
*/
|
|
4860
5427
|
extractDecoratorsFor(declNode, decoratedId) {
|
|
5428
|
+
// Rust outer attributes are siblings, not children of the function.
|
|
5429
|
+
// Preserve Tauri's runtime registration for the dead-code decorator rule.
|
|
5430
|
+
if (this.language === 'rust' && declNode.type === 'function_item') {
|
|
5431
|
+
for (let sibling = declNode.previousNamedSibling; sibling; sibling = sibling.previousNamedSibling) {
|
|
5432
|
+
if (sibling.type === 'line_comment' || sibling.type === 'block_comment')
|
|
5433
|
+
continue;
|
|
5434
|
+
if (sibling.type !== 'attribute_item')
|
|
5435
|
+
break;
|
|
5436
|
+
const attribute = sibling.namedChild(0);
|
|
5437
|
+
const name = attribute?.namedChild(0)?.text.replace(/\s/g, '');
|
|
5438
|
+
if (name === 'tauri::command') {
|
|
5439
|
+
const decorated = this.nodes.find(n => n.id === decoratedId);
|
|
5440
|
+
if (decorated)
|
|
5441
|
+
decorated.decorators = ['tauri::command'];
|
|
5442
|
+
break;
|
|
5443
|
+
}
|
|
5444
|
+
}
|
|
5445
|
+
}
|
|
4861
5446
|
const consider = (n) => {
|
|
4862
5447
|
if (!n)
|
|
4863
5448
|
return;
|
|
@@ -5097,11 +5682,166 @@ class TreeSitterExtractor {
|
|
|
5097
5682
|
}
|
|
5098
5683
|
targets.add(target);
|
|
5099
5684
|
}
|
|
5685
|
+
/**
|
|
5686
|
+
* Whether an anonymous function is the whole value of a `variable_declarator`
|
|
5687
|
+
* with a plain identifier name — `const NAME = () => {…}` / `= function () {…}`.
|
|
5688
|
+
* JS-family only.
|
|
5689
|
+
*/
|
|
5690
|
+
declaratorBoundFunction(node) {
|
|
5691
|
+
if (this.language !== 'typescript' &&
|
|
5692
|
+
this.language !== 'javascript' &&
|
|
5693
|
+
this.language !== 'tsx' &&
|
|
5694
|
+
this.language !== 'jsx') {
|
|
5695
|
+
return false;
|
|
5696
|
+
}
|
|
5697
|
+
if (node.type !== 'arrow_function' && node.type !== 'function_expression')
|
|
5698
|
+
return false;
|
|
5699
|
+
const declarator = node.parent;
|
|
5700
|
+
if (!declarator || declarator.type !== 'variable_declarator')
|
|
5701
|
+
return false;
|
|
5702
|
+
const value = (0, tree_sitter_helpers_1.getChildByField)(declarator, 'value');
|
|
5703
|
+
if (!value || value.startIndex !== node.startIndex || value.endIndex !== node.endIndex)
|
|
5704
|
+
return false;
|
|
5705
|
+
return (0, tree_sitter_helpers_1.getChildByField)(declarator, 'name')?.type === 'identifier';
|
|
5706
|
+
}
|
|
5707
|
+
/**
|
|
5708
|
+
* The property a CommonJS export assignment binds a function to —
|
|
5709
|
+
* `exports.NAME = <node>` or `module.exports.NAME = <node>` — or null for
|
|
5710
|
+
* any other assignment. JS-family only; the node must be the assignment's
|
|
5711
|
+
* whole right-hand side.
|
|
5712
|
+
*/
|
|
5713
|
+
commonJsExportName(assignment, value) {
|
|
5714
|
+
if (this.language !== 'typescript' &&
|
|
5715
|
+
this.language !== 'javascript' &&
|
|
5716
|
+
this.language !== 'tsx' &&
|
|
5717
|
+
this.language !== 'jsx') {
|
|
5718
|
+
return null;
|
|
5719
|
+
}
|
|
5720
|
+
const right = (0, tree_sitter_helpers_1.getChildByField)(assignment, 'right');
|
|
5721
|
+
if (!right || right.startIndex !== value.startIndex || right.endIndex !== value.endIndex)
|
|
5722
|
+
return null;
|
|
5723
|
+
const left = (0, tree_sitter_helpers_1.getChildByField)(assignment, 'left');
|
|
5724
|
+
if (!left || left.type !== 'member_expression')
|
|
5725
|
+
return null;
|
|
5726
|
+
const object = (0, tree_sitter_helpers_1.getChildByField)(left, 'object');
|
|
5727
|
+
const property = (0, tree_sitter_helpers_1.getChildByField)(left, 'property');
|
|
5728
|
+
if (!object || !property || property.type !== 'property_identifier')
|
|
5729
|
+
return null;
|
|
5730
|
+
const objectText = (0, tree_sitter_helpers_1.getNodeText)(object, this.source);
|
|
5731
|
+
if (objectText !== 'exports' && objectText !== 'module.exports')
|
|
5732
|
+
return null;
|
|
5733
|
+
return (0, tree_sitter_helpers_1.getNodeText)(property, this.source);
|
|
5734
|
+
}
|
|
5735
|
+
/**
|
|
5736
|
+
* The declarator name a React handler hook binds an anonymous function to —
|
|
5737
|
+
* `const NAME = useCallback(<node>, [...])` — or null for any other shape.
|
|
5738
|
+
* JS-family only; the node must be the hook call's FIRST argument, and the
|
|
5739
|
+
* call's value must be bound directly by a `variable_declarator`.
|
|
5740
|
+
*/
|
|
5741
|
+
reactHookBoundName(node) {
|
|
5742
|
+
if (this.language !== 'typescript' &&
|
|
5743
|
+
this.language !== 'javascript' &&
|
|
5744
|
+
this.language !== 'tsx' &&
|
|
5745
|
+
this.language !== 'jsx') {
|
|
5746
|
+
return null;
|
|
5747
|
+
}
|
|
5748
|
+
if (node.type !== 'arrow_function' && node.type !== 'function_expression')
|
|
5749
|
+
return null;
|
|
5750
|
+
const args = node.parent;
|
|
5751
|
+
if (!args || args.type !== 'arguments')
|
|
5752
|
+
return null;
|
|
5753
|
+
const first = args.namedChild(0);
|
|
5754
|
+
if (!first || first.startIndex !== node.startIndex || first.endIndex !== node.endIndex)
|
|
5755
|
+
return null;
|
|
5756
|
+
const call = args.parent;
|
|
5757
|
+
if (!call || call.type !== 'call_expression')
|
|
5758
|
+
return null;
|
|
5759
|
+
const callee = (0, tree_sitter_helpers_1.getChildByField)(call, 'function');
|
|
5760
|
+
if (!callee || !REACT_HANDLER_HOOKS.test((0, tree_sitter_helpers_1.getNodeText)(callee, this.source)))
|
|
5761
|
+
return null;
|
|
5762
|
+
const declarator = call.parent;
|
|
5763
|
+
if (!declarator || declarator.type !== 'variable_declarator')
|
|
5764
|
+
return null;
|
|
5765
|
+
const nameNode = (0, tree_sitter_helpers_1.getChildByField)(declarator, 'name');
|
|
5766
|
+
return nameNode?.type === 'identifier' ? (0, tree_sitter_helpers_1.getNodeText)(nameNode, this.source) : null;
|
|
5767
|
+
}
|
|
5768
|
+
/**
|
|
5769
|
+
* The declarator name for an anonymous function passed to a CURRIED wrapper
|
|
5770
|
+
* call — `const NAME = factory(...)(function () {…})` — or the property key
|
|
5771
|
+
* when the call is an object member, `{ NAME: factory(...)(fn) }`; else null.
|
|
5772
|
+
*
|
|
5773
|
+
* `reactHookBoundName` above already names a function through the declarator
|
|
5774
|
+
* that binds it; the shape is general, but that method is deliberately
|
|
5775
|
+
* bounded to the three React handler hooks. This is the same shape with a
|
|
5776
|
+
* different, equally decidable bound: the callee is itself a call, i.e. a
|
|
5777
|
+
* factory that returns the wrapper (#1747).
|
|
5778
|
+
*
|
|
5779
|
+
* Requiring the callee to be a call is what keeps this narrow. It admits
|
|
5780
|
+
* `Effect.fn("Session.run")(function* () {…})`, `connect(mapState)(fn)` and
|
|
5781
|
+
* a project's own `wrap("name")(fn)`, and it does not admit the one-call
|
|
5782
|
+
* forms where the argument is a computation rather than a body worth a node
|
|
5783
|
+
* of its own — `useMemo(() => 1 + 1, [])`, `arr.map(() => …)` — which stay
|
|
5784
|
+
* anonymous exactly as before.
|
|
5785
|
+
*
|
|
5786
|
+
* Generators are included here and not in `reactHookBoundName`: a React
|
|
5787
|
+
* handler is never a generator, while `function*` is the common form in the
|
|
5788
|
+
* ecosystem this shape comes from.
|
|
5789
|
+
*/
|
|
5790
|
+
curriedWrapperBoundName(node) {
|
|
5791
|
+
if (this.language !== 'typescript' &&
|
|
5792
|
+
this.language !== 'javascript' &&
|
|
5793
|
+
this.language !== 'tsx' &&
|
|
5794
|
+
this.language !== 'jsx') {
|
|
5795
|
+
return null;
|
|
5796
|
+
}
|
|
5797
|
+
if (node.type !== 'arrow_function' &&
|
|
5798
|
+
node.type !== 'function_expression' &&
|
|
5799
|
+
node.type !== 'generator_function') {
|
|
5800
|
+
return null;
|
|
5801
|
+
}
|
|
5802
|
+
const args = node.parent;
|
|
5803
|
+
if (!args || args.type !== 'arguments')
|
|
5804
|
+
return null;
|
|
5805
|
+
const first = args.namedChild(0);
|
|
5806
|
+
if (!first || first.startIndex !== node.startIndex || first.endIndex !== node.endIndex)
|
|
5807
|
+
return null;
|
|
5808
|
+
const call = args.parent;
|
|
5809
|
+
if (!call || call.type !== 'call_expression')
|
|
5810
|
+
return null;
|
|
5811
|
+
// The bound that replaces the hook allowlist: the thing being called is
|
|
5812
|
+
// itself a call, so this is the second application of a curried wrapper.
|
|
5813
|
+
const callee = (0, tree_sitter_helpers_1.getChildByField)(call, 'function');
|
|
5814
|
+
if (!callee || callee.type !== 'call_expression')
|
|
5815
|
+
return null;
|
|
5816
|
+
const binder = call.parent;
|
|
5817
|
+
if (!binder)
|
|
5818
|
+
return null;
|
|
5819
|
+
// `{ getMode: Effect.fn("…")(function* () {…}) }` — a service is often an
|
|
5820
|
+
// object a factory returns, so the wrapper's result lands in a `pair`. The
|
|
5821
|
+
// property key names it, as extractObjectLiteralFunctions names
|
|
5822
|
+
// `key: () => {}`.
|
|
5823
|
+
if (binder.type === 'pair') {
|
|
5824
|
+
const key = (0, tree_sitter_helpers_1.getChildByField)(binder, 'key');
|
|
5825
|
+
const value = (0, tree_sitter_helpers_1.getChildByField)(binder, 'value');
|
|
5826
|
+
if (!key || !value || value.startIndex !== call.startIndex || value.endIndex !== call.endIndex)
|
|
5827
|
+
return null;
|
|
5828
|
+
return this.objectKeyName(key);
|
|
5829
|
+
}
|
|
5830
|
+
if (binder.type !== 'variable_declarator')
|
|
5831
|
+
return null;
|
|
5832
|
+
const nameNode = (0, tree_sitter_helpers_1.getChildByField)(binder, 'name');
|
|
5833
|
+
return nameNode?.type === 'identifier' ? (0, tree_sitter_helpers_1.getNodeText)(nameNode, this.source) : null;
|
|
5834
|
+
}
|
|
5100
5835
|
visitFunctionBody(body, _functionId) {
|
|
5101
5836
|
if (!this.extractor)
|
|
5102
5837
|
return;
|
|
5103
5838
|
const visitForCallsAndStructure = (node) => {
|
|
5104
5839
|
const nodeType = node.type;
|
|
5840
|
+
// A function-like macro defined inside a body is still a macro (#1838).
|
|
5841
|
+
if ((this.language === 'c' || this.language === 'cpp') && nodeType === 'preproc_function_def') {
|
|
5842
|
+
this.visitNode(node);
|
|
5843
|
+
return;
|
|
5844
|
+
}
|
|
5105
5845
|
// Function-as-value capture (#756) — function bodies are walked here,
|
|
5106
5846
|
// not in visitNode, so the capture hook must fire in both walkers.
|
|
5107
5847
|
this.maybeCaptureFnRefs(node, nodeType);
|
|
@@ -5151,8 +5891,30 @@ class TreeSitterExtractor {
|
|
|
5151
5891
|
// (which strips template args / namespace and emits the `instantiates`
|
|
5152
5892
|
// ref). Children still recurse below, so a nested ctor-arg call
|
|
5153
5893
|
// (`Calculator calc(make())`) keeps its own `calls` ref.
|
|
5154
|
-
if (nodeType === 'declaration' && this.language === 'cpp'
|
|
5155
|
-
this.
|
|
5894
|
+
if (nodeType === 'declaration' && this.language === 'cpp') {
|
|
5895
|
+
const { instantiates, arities } = this.cppStackConstructions(node);
|
|
5896
|
+
if (instantiates)
|
|
5897
|
+
this.extractInstantiation(node);
|
|
5898
|
+
// One `calls` ref per constructed object, naming the constructor and
|
|
5899
|
+
// its argument count (`ns::T::T/1`) so the resolver can pick the
|
|
5900
|
+
// overload — a type is not a callee (#1839).
|
|
5901
|
+
const callerId = this.nodeStack[this.nodeStack.length - 1];
|
|
5902
|
+
const typeNode = (0, tree_sitter_helpers_1.getChildByField)(node, 'type');
|
|
5903
|
+
if (callerId && typeNode && arities.length) {
|
|
5904
|
+
const className = (0, c_cpp_1.stripCppTemplateArgs)((0, tree_sitter_helpers_1.getNodeText)(typeNode, this.source));
|
|
5905
|
+
const name = className.split('::').filter(Boolean).pop();
|
|
5906
|
+
if (name) {
|
|
5907
|
+
for (const arity of arities) {
|
|
5908
|
+
this.unresolvedReferences.push({
|
|
5909
|
+
fromNodeId: callerId,
|
|
5910
|
+
referenceName: `${className}::${name}/${arity}`,
|
|
5911
|
+
referenceKind: 'calls',
|
|
5912
|
+
line: node.startPosition.row + 1,
|
|
5913
|
+
column: node.startPosition.column,
|
|
5914
|
+
});
|
|
5915
|
+
}
|
|
5916
|
+
}
|
|
5917
|
+
}
|
|
5156
5918
|
}
|
|
5157
5919
|
// C++ local function-pointer bindings (see cppLocalFnPtrs): record
|
|
5158
5920
|
// `auto kernel = &fn<…>;` declarations and `kernel = &other_fn<…>;`
|
|
@@ -5210,6 +5972,43 @@ class TreeSitterExtractor {
|
|
|
5210
5972
|
this.extractFunction(node);
|
|
5211
5973
|
return;
|
|
5212
5974
|
}
|
|
5975
|
+
// `const handleSubmit = useCallback(() => {…}, [deps])` — React's
|
|
5976
|
+
// memoised handler. The function is anonymous only syntactically: the
|
|
5977
|
+
// arrow is the first argument of a call whose result the declarator
|
|
5978
|
+
// binds, and that binding is the name every `onPress={handleSubmit}`
|
|
5979
|
+
// and `addListener('x', handleSubmit)` uses. Without a node of its own
|
|
5980
|
+
// the handler's calls attribute to the component and the JSX prop or
|
|
5981
|
+
// event registration has nothing to resolve to — the trigger of a flow
|
|
5982
|
+
// is invisible. Bounded to the hooks React documents for handlers
|
|
5983
|
+
// (`useCallback`, `useEffectEvent`, the experimental `useEvent`):
|
|
5984
|
+
// `useMemo` / `useEffect` callbacks are computations, not handlers.
|
|
5985
|
+
const hookBound = this.reactHookBoundName(node);
|
|
5986
|
+
if (hookBound) {
|
|
5987
|
+
this.extractFunction(node, hookBound);
|
|
5988
|
+
return;
|
|
5989
|
+
}
|
|
5990
|
+
// `const run = Effect.fn("Session.run")(function* () {…})` (#1747) —
|
|
5991
|
+
// the same declarator binding through a curried wrapper. Without a node
|
|
5992
|
+
// the body's calls attribute to the enclosing container, so the file or
|
|
5993
|
+
// the outer function picks up an outgoing edge that belongs to this
|
|
5994
|
+
// function and the callee's caller list names the wrong thing.
|
|
5995
|
+
const wrapperBound = this.curriedWrapperBoundName(node);
|
|
5996
|
+
if (wrapperBound) {
|
|
5997
|
+
this.extractFunction(node, wrapperBound);
|
|
5998
|
+
return;
|
|
5999
|
+
}
|
|
6000
|
+
// `const handleClear = () => {…}` inside a body (#1669) — the same
|
|
6001
|
+
// binding that names a function at module scope names one here, and in
|
|
6002
|
+
// a React component it is how every handler that skips `useCallback`
|
|
6003
|
+
// is written. Without a node the handler is absent from callers /
|
|
6004
|
+
// impact ("Symbol not found" reads like "no callers") and its calls
|
|
6005
|
+
// attribute to the component. extractFunction resolves the name from
|
|
6006
|
+
// the declarator; a destructuring or otherwise unnamed binding stays
|
|
6007
|
+
// anonymous and falls through.
|
|
6008
|
+
if (this.declaratorBoundFunction(node)) {
|
|
6009
|
+
this.extractFunction(node);
|
|
6010
|
+
return;
|
|
6011
|
+
}
|
|
5213
6012
|
}
|
|
5214
6013
|
// Extract structural nodes found inside function bodies.
|
|
5215
6014
|
// Each extract method visits its own children, so we return after extracting.
|
|
@@ -5223,6 +6022,8 @@ class TreeSitterExtractor {
|
|
|
5223
6022
|
this.extractInterface(node);
|
|
5224
6023
|
else if (classification === 'trait')
|
|
5225
6024
|
this.extractClass(node, 'trait');
|
|
6025
|
+
else if (classification === 'module')
|
|
6026
|
+
this.extractClass(node, 'module');
|
|
5226
6027
|
else
|
|
5227
6028
|
this.extractClass(node);
|
|
5228
6029
|
return;
|
|
@@ -5231,6 +6032,10 @@ class TreeSitterExtractor {
|
|
|
5231
6032
|
this.extractStruct(node);
|
|
5232
6033
|
return;
|
|
5233
6034
|
}
|
|
6035
|
+
if (this.extractor.unionTypes?.includes(nodeType)) {
|
|
6036
|
+
this.extractUnion(node);
|
|
6037
|
+
return;
|
|
6038
|
+
}
|
|
5234
6039
|
if (this.extractor.enumTypes.includes(nodeType)) {
|
|
5235
6040
|
this.extractEnum(node);
|
|
5236
6041
|
return;
|
|
@@ -5639,31 +6444,20 @@ class TreeSitterExtractor {
|
|
|
5639
6444
|
* For plain `impl Type { ... }` (no trait), no inheritance edge is needed.
|
|
5640
6445
|
*/
|
|
5641
6446
|
extractRustImplItem(node) {
|
|
5642
|
-
//
|
|
5643
|
-
|
|
5644
|
-
|
|
6447
|
+
// `impl Trait for Type` carries the trait in the grammar's `trait` field;
|
|
6448
|
+
// an inherent `impl Type { … }` has none and needs no inheritance edge.
|
|
6449
|
+
const traitNode = (0, tree_sitter_helpers_1.getChildByField)(node, 'trait');
|
|
6450
|
+
if (!traitNode)
|
|
5645
6451
|
return;
|
|
5646
|
-
//
|
|
5647
|
-
//
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
6452
|
+
// Full text, so a scoped path (`std::fmt::Display`) and a generic trait
|
|
6453
|
+
// (`From<u32>`) keep their spelling.
|
|
6454
|
+
const traitName = (0, tree_sitter_helpers_1.getNodeText)(traitNode, this.source);
|
|
6455
|
+
// The implementing type from the `type` field (#1588). The old positional
|
|
6456
|
+
// scan took the LAST type-shaped child, which for a parameterized
|
|
6457
|
+
// implementing type (`BufSource<T>`, `Parents<'a>`, `&Foo`) was the trait.
|
|
6458
|
+
const typeName = (0, rust_1.rustImplTypeName)((0, tree_sitter_helpers_1.getChildByField)(node, 'type'), this.source);
|
|
6459
|
+
if (!typeName)
|
|
5651
6460
|
return;
|
|
5652
|
-
const traitNode = typeIdents[0];
|
|
5653
|
-
const typeNode = typeIdents[typeIdents.length - 1];
|
|
5654
|
-
// Get the trait name (handle scoped paths like std::fmt::Display)
|
|
5655
|
-
const traitName = traitNode.type === 'scoped_type_identifier'
|
|
5656
|
-
? this.source.substring(traitNode.startIndex, traitNode.endIndex)
|
|
5657
|
-
: (0, tree_sitter_helpers_1.getNodeText)(traitNode, this.source);
|
|
5658
|
-
// Get the implementing type name (extract inner type_identifier for generics)
|
|
5659
|
-
let typeName;
|
|
5660
|
-
if (typeNode.type === 'generic_type') {
|
|
5661
|
-
const inner = typeNode.namedChildren.find((c) => c.type === 'type_identifier');
|
|
5662
|
-
typeName = inner ? (0, tree_sitter_helpers_1.getNodeText)(inner, this.source) : (0, tree_sitter_helpers_1.getNodeText)(typeNode, this.source);
|
|
5663
|
-
}
|
|
5664
|
-
else {
|
|
5665
|
-
typeName = (0, tree_sitter_helpers_1.getNodeText)(typeNode, this.source);
|
|
5666
|
-
}
|
|
5667
6461
|
// Find the struct/type node for the implementing type
|
|
5668
6462
|
const typeNodeId = this.findNodeByName(typeName);
|
|
5669
6463
|
if (typeNodeId) {
|
|
@@ -5681,7 +6475,7 @@ class TreeSitterExtractor {
|
|
|
5681
6475
|
*/
|
|
5682
6476
|
findNodeByName(name) {
|
|
5683
6477
|
for (const node of this.nodes) {
|
|
5684
|
-
if (node.name === name && (node.kind === 'struct' || node.kind === 'enum' || node.kind === 'class')) {
|
|
6478
|
+
if (node.name === name && (node.kind === 'struct' || node.kind === 'union' || node.kind === 'enum' || node.kind === 'class')) {
|
|
5685
6479
|
return node.id;
|
|
5686
6480
|
}
|
|
5687
6481
|
}
|