@lzehrung/codegraph 2.3.31 → 3.0.0
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/README.md +33 -141
- package/codegraph-skill/codegraph/SKILL.md +8 -6
- package/dist/agent/artifact.d.ts +2 -0
- package/dist/agent/artifact.d.ts.map +1 -1
- package/dist/agent/artifact.js.map +1 -1
- package/dist/agent/call-hierarchy.js +2 -4
- package/dist/agent/call-hierarchy.js.map +1 -1
- package/dist/agent/explore.d.ts +1 -1
- package/dist/agent/explore.d.ts.map +1 -1
- package/dist/agent/explore.js +3 -2
- package/dist/agent/explore.js.map +1 -1
- package/dist/agent/refactor-plan.js +2 -4
- package/dist/agent/refactor-plan.js.map +1 -1
- package/dist/agent/rename-preview.d.ts.map +1 -1
- package/dist/agent/rename-preview.js +4 -3
- package/dist/agent/rename-preview.js.map +1 -1
- package/dist/agent/search.d.ts.map +1 -1
- package/dist/agent/search.js +5 -3
- package/dist/agent/search.js.map +1 -1
- package/dist/agent/semantic-symbols.d.ts.map +1 -1
- package/dist/agent/semantic-symbols.js +2 -3
- package/dist/agent/semantic-symbols.js.map +1 -1
- package/dist/agent/session.d.ts +3 -0
- package/dist/agent/session.d.ts.map +1 -1
- package/dist/agent/session.js +10 -2
- package/dist/agent/session.js.map +1 -1
- package/dist/agent/type-hierarchy.js +2 -4
- package/dist/agent/type-hierarchy.js.map +1 -1
- package/dist/agent/workspace-symbols.d.ts.map +1 -1
- package/dist/agent/workspace-symbols.js +2 -3
- package/dist/agent/workspace-symbols.js.map +1 -1
- package/dist/agent-tools.d.ts +0 -4
- package/dist/agent-tools.d.ts.map +1 -1
- package/dist/agent-tools.js +3 -6
- package/dist/agent-tools.js.map +1 -1
- package/dist/analysis-summary.d.ts +8 -4
- package/dist/analysis-summary.d.ts.map +1 -1
- package/dist/analysis-summary.js +15 -66
- package/dist/analysis-summary.js.map +1 -1
- package/dist/bin/cli.js +51145 -41770
- package/dist/bin/query-index-worker.js +122 -82
- package/dist/cli/affected.d.ts.map +1 -1
- package/dist/cli/affected.js +4 -1
- package/dist/cli/affected.js.map +1 -1
- package/dist/cli/command-catalog.js +1 -1
- package/dist/cli/command-catalog.js.map +1 -1
- package/dist/cli/command-table.d.ts.map +1 -1
- package/dist/cli/command-table.js +9 -17
- package/dist/cli/command-table.js.map +1 -1
- package/dist/cli/context.js +10 -10
- package/dist/cli/context.js.map +1 -1
- package/dist/cli/drift.d.ts +0 -2
- package/dist/cli/drift.d.ts.map +1 -1
- package/dist/cli/drift.js +0 -1
- package/dist/cli/drift.js.map +1 -1
- package/dist/cli/graph-delta.d.ts +0 -2
- package/dist/cli/graph-delta.d.ts.map +1 -1
- package/dist/cli/graph-delta.js +0 -4
- package/dist/cli/graph-delta.js.map +1 -1
- package/dist/cli/graph-queries.d.ts.map +1 -1
- package/dist/cli/graph-queries.js +27 -1
- package/dist/cli/graph-queries.js.map +1 -1
- package/dist/cli/graph.d.ts +0 -3
- package/dist/cli/graph.d.ts.map +1 -1
- package/dist/cli/graph.js +4 -14
- package/dist/cli/graph.js.map +1 -1
- package/dist/cli/help.d.ts +34 -34
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +9 -14
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/impact.d.ts +0 -2
- package/dist/cli/impact.d.ts.map +1 -1
- package/dist/cli/impact.js +0 -1
- package/dist/cli/impact.js.map +1 -1
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +5 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/inspect.d.ts +0 -2
- package/dist/cli/inspect.d.ts.map +1 -1
- package/dist/cli/inspect.js +5 -8
- package/dist/cli/inspect.js.map +1 -1
- package/dist/cli/invocation-context.d.ts +0 -3
- package/dist/cli/invocation-context.d.ts.map +1 -1
- package/dist/cli/invocation-context.js +4 -16
- package/dist/cli/invocation-context.js.map +1 -1
- package/dist/cli/navigation.d.ts +0 -2
- package/dist/cli/navigation.d.ts.map +1 -1
- package/dist/cli/navigation.js +0 -1
- package/dist/cli/navigation.js.map +1 -1
- package/dist/cli/options.d.ts.map +1 -1
- package/dist/cli/options.js +4 -14
- package/dist/cli/options.js.map +1 -1
- package/dist/cli/review.d.ts +0 -2
- package/dist/cli/review.d.ts.map +1 -1
- package/dist/cli/review.js +0 -5
- package/dist/cli/review.js.map +1 -1
- package/dist/cli/root-policy.d.ts +0 -2
- package/dist/cli/root-policy.d.ts.map +1 -1
- package/dist/cli/root-policy.js +0 -8
- package/dist/cli/root-policy.js.map +1 -1
- package/dist/cli/server.d.ts.map +1 -1
- package/dist/cli/server.js +0 -2
- package/dist/cli/server.js.map +1 -1
- package/dist/drift/artifact.d.ts.map +1 -1
- package/dist/drift/artifact.js +15 -18
- package/dist/drift/artifact.js.map +1 -1
- package/dist/drift/compare.js +1 -1
- package/dist/drift/compare.js.map +1 -1
- package/dist/drift/git.d.ts.map +1 -1
- package/dist/drift/git.js +0 -1
- package/dist/drift/git.js.map +1 -1
- package/dist/drift/snapshot.d.ts.map +1 -1
- package/dist/drift/snapshot.js +5 -7
- package/dist/drift/snapshot.js.map +1 -1
- package/dist/drift/types.d.ts +2 -2
- package/dist/drift/types.d.ts.map +1 -1
- package/dist/drift/types.js.map +1 -1
- package/dist/duplicates/unit-cache.d.ts +0 -1
- package/dist/duplicates/unit-cache.d.ts.map +1 -1
- package/dist/duplicates/unit-cache.js +3 -11
- package/dist/duplicates/unit-cache.js.map +1 -1
- package/dist/duplicates/units.d.ts +5 -5
- package/dist/duplicates/units.d.ts.map +1 -1
- package/dist/duplicates/units.js +25 -88
- package/dist/duplicates/units.js.map +1 -1
- package/dist/graph-builder.d.ts +0 -6
- package/dist/graph-builder.d.ts.map +1 -1
- package/dist/graph-builder.js +6 -11
- package/dist/graph-builder.js.map +1 -1
- package/dist/graph-edge-collector.d.ts +4 -6
- package/dist/graph-edge-collector.d.ts.map +1 -1
- package/dist/graph-edge-collector.js +31 -26
- package/dist/graph-edge-collector.js.map +1 -1
- package/dist/graphs/angularjs.d.ts.map +1 -1
- package/dist/graphs/angularjs.js +2 -1
- package/dist/graphs/angularjs.js.map +1 -1
- package/dist/graphs/edge-resolution.d.ts +4 -1
- package/dist/graphs/edge-resolution.d.ts.map +1 -1
- package/dist/graphs/edge-resolution.js +24 -76
- package/dist/graphs/edge-resolution.js.map +1 -1
- package/dist/graphs/specifiers.d.ts +4 -13
- package/dist/graphs/specifiers.d.ts.map +1 -1
- package/dist/graphs/specifiers.js +80 -173
- package/dist/graphs/specifiers.js.map +1 -1
- package/dist/graphs/symbol-graph-detailed/ast.d.ts +20 -0
- package/dist/graphs/symbol-graph-detailed/ast.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed/ast.js +154 -15
- package/dist/graphs/symbol-graph-detailed/ast.js.map +1 -1
- package/dist/graphs/symbol-graph-detailed/edge-passes.d.ts +60 -8
- package/dist/graphs/symbol-graph-detailed/edge-passes.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed/edge-passes.js +997 -168
- package/dist/graphs/symbol-graph-detailed/edge-passes.js.map +1 -1
- package/dist/graphs/symbol-graph-detailed/import-aliases.d.ts +2 -1
- package/dist/graphs/symbol-graph-detailed/import-aliases.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed/import-aliases.js +150 -7
- package/dist/graphs/symbol-graph-detailed/import-aliases.js.map +1 -1
- package/dist/graphs/symbol-graph-detailed/member-chains.d.ts +1 -0
- package/dist/graphs/symbol-graph-detailed/member-chains.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed/member-chains.js +3 -1
- package/dist/graphs/symbol-graph-detailed/member-chains.js.map +1 -1
- package/dist/graphs/symbol-graph-detailed/receiver-calls.d.ts +141 -25
- package/dist/graphs/symbol-graph-detailed/receiver-calls.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed/receiver-calls.js +1015 -166
- package/dist/graphs/symbol-graph-detailed/receiver-calls.js.map +1 -1
- package/dist/graphs/symbol-graph-detailed.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed.js +449 -46
- package/dist/graphs/symbol-graph-detailed.js.map +1 -1
- package/dist/graphs/symbol-graph.d.ts +2 -0
- package/dist/graphs/symbol-graph.d.ts.map +1 -1
- package/dist/graphs/symbol-graph.js +34 -16
- package/dist/graphs/symbol-graph.js.map +1 -1
- package/dist/graphs/types.d.ts +0 -4
- package/dist/graphs/types.d.ts.map +1 -1
- package/dist/graphs.d.ts +1 -1
- package/dist/graphs.d.ts.map +1 -1
- package/dist/impact/call-compatibility/providers/index.d.ts +4 -4
- package/dist/impact/call-compatibility/providers/index.d.ts.map +1 -1
- package/dist/impact/call-compatibility/providers/index.js +6 -6
- package/dist/impact/call-compatibility/providers/index.js.map +1 -1
- package/dist/impact/call-compatibility/providers/types.d.ts +2 -0
- package/dist/impact/call-compatibility/providers/types.d.ts.map +1 -1
- package/dist/impact/call-compatibility/types.d.ts +6 -0
- package/dist/impact/call-compatibility/types.d.ts.map +1 -1
- package/dist/impact/call-compatibility.d.ts.map +1 -1
- package/dist/impact/call-compatibility.js +316 -526
- package/dist/impact/call-compatibility.js.map +1 -1
- package/dist/impact/map.js +1 -0
- package/dist/impact/map.js.map +1 -1
- package/dist/impact/reference-cache.d.ts.map +1 -1
- package/dist/impact/reference-cache.js +2 -2
- package/dist/impact/reference-cache.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/indexer/ambiguous-resolution.d.ts +11 -0
- package/dist/indexer/ambiguous-resolution.d.ts.map +1 -0
- package/dist/indexer/ambiguous-resolution.js +19 -0
- package/dist/indexer/ambiguous-resolution.js.map +1 -0
- package/dist/indexer/build-cache/module-cache.d.ts +39 -1
- package/dist/indexer/build-cache/module-cache.d.ts.map +1 -1
- package/dist/indexer/build-cache/module-cache.js +218 -21
- package/dist/indexer/build-cache/module-cache.js.map +1 -1
- package/dist/indexer/build-cache/options.d.ts +30 -44
- package/dist/indexer/build-cache/options.d.ts.map +1 -1
- package/dist/indexer/build-cache/options.js +32 -71
- package/dist/indexer/build-cache/options.js.map +1 -1
- package/dist/indexer/build-cache/project-snapshot.d.ts +3 -3
- package/dist/indexer/build-cache/project-snapshot.d.ts.map +1 -1
- package/dist/indexer/build-cache/project-snapshot.js +164 -84
- package/dist/indexer/build-cache/project-snapshot.js.map +1 -1
- package/dist/indexer/build-cache/reports.d.ts +0 -2
- package/dist/indexer/build-cache/reports.d.ts.map +1 -1
- package/dist/indexer/build-cache/reports.js +0 -97
- package/dist/indexer/build-cache/reports.js.map +1 -1
- package/dist/indexer/build-cache/resolver-environment.d.ts.map +1 -1
- package/dist/indexer/build-cache/resolver-environment.js +32 -2
- package/dist/indexer/build-cache/resolver-environment.js.map +1 -1
- package/dist/indexer/build-cache.d.ts +2 -2
- package/dist/indexer/build-cache.d.ts.map +1 -1
- package/dist/indexer/build-cache.js +2 -2
- package/dist/indexer/build-cache.js.map +1 -1
- package/dist/indexer/build-index.d.ts.map +1 -1
- package/dist/indexer/build-index.js +656 -71
- package/dist/indexer/build-index.js.map +1 -1
- package/dist/indexer/build-workers.d.ts.map +1 -1
- package/dist/indexer/build-workers.js +9 -9
- package/dist/indexer/build-workers.js.map +1 -1
- package/dist/indexer/call-hierarchy.js +1 -1
- package/dist/indexer/call-hierarchy.js.map +1 -1
- package/dist/indexer/callable-identity.d.ts +24 -0
- package/dist/indexer/callable-identity.d.ts.map +1 -0
- package/dist/indexer/callable-identity.js +111 -0
- package/dist/indexer/callable-identity.js.map +1 -0
- package/dist/indexer/compilation-units.d.ts +103 -0
- package/dist/indexer/compilation-units.d.ts.map +1 -0
- package/dist/indexer/compilation-units.js +607 -0
- package/dist/indexer/compilation-units.js.map +1 -0
- package/dist/indexer/cpp-callables.d.ts +25 -0
- package/dist/indexer/cpp-callables.d.ts.map +1 -0
- package/dist/indexer/cpp-callables.js +562 -0
- package/dist/indexer/cpp-callables.js.map +1 -0
- package/dist/indexer/declaration-visibility.d.ts +43 -2
- package/dist/indexer/declaration-visibility.d.ts.map +1 -1
- package/dist/indexer/declaration-visibility.js +158 -2
- package/dist/indexer/declaration-visibility.js.map +1 -1
- package/dist/indexer/expand-star-imports.d.ts +6 -1
- package/dist/indexer/expand-star-imports.d.ts.map +1 -1
- package/dist/indexer/expand-star-imports.js +131 -37
- package/dist/indexer/expand-star-imports.js.map +1 -1
- package/dist/indexer/finalize.d.ts.map +1 -1
- package/dist/indexer/finalize.js +0 -1
- package/dist/indexer/finalize.js.map +1 -1
- package/dist/indexer/import-resolution-tables.d.ts +72 -0
- package/dist/indexer/import-resolution-tables.d.ts.map +1 -0
- package/dist/indexer/import-resolution-tables.js +137 -0
- package/dist/indexer/import-resolution-tables.js.map +1 -0
- package/dist/indexer/import-types.d.ts +54 -0
- package/dist/indexer/import-types.d.ts.map +1 -1
- package/dist/indexer/import-types.js +24 -1
- package/dist/indexer/import-types.js.map +1 -1
- package/dist/indexer/imports/context.d.ts +16 -1
- package/dist/indexer/imports/context.d.ts.map +1 -1
- package/dist/indexer/imports/import-binding-tables.d.ts +13 -1
- package/dist/indexer/imports/import-binding-tables.d.ts.map +1 -1
- package/dist/indexer/imports/import-binding-tables.js +149 -30
- package/dist/indexer/imports/import-binding-tables.js.map +1 -1
- package/dist/indexer/imports/js-text-imports.js +4 -4
- package/dist/indexer/imports/js-text-imports.js.map +1 -1
- package/dist/indexer/imports/native-captures.d.ts.map +1 -1
- package/dist/indexer/imports/native-captures.js +24 -6
- package/dist/indexer/imports/native-captures.js.map +1 -1
- package/dist/indexer/imports/python.d.ts +10 -2
- package/dist/indexer/imports/python.d.ts.map +1 -1
- package/dist/indexer/imports/python.js +128 -112
- package/dist/indexer/imports/python.js.map +1 -1
- package/dist/indexer/imports/text-import-extractors.d.ts.map +1 -1
- package/dist/indexer/imports/text-import-extractors.js +68 -19
- package/dist/indexer/imports/text-import-extractors.js.map +1 -1
- package/dist/indexer/imports.d.ts +3 -4
- package/dist/indexer/imports.d.ts.map +1 -1
- package/dist/indexer/imports.js +116 -72
- package/dist/indexer/imports.js.map +1 -1
- package/dist/indexer/incremental-plan.d.ts +33 -0
- package/dist/indexer/incremental-plan.d.ts.map +1 -1
- package/dist/indexer/incremental-plan.js +203 -1
- package/dist/indexer/incremental-plan.js.map +1 -1
- package/dist/indexer/locals-and-exports.d.ts +3 -2
- package/dist/indexer/locals-and-exports.d.ts.map +1 -1
- package/dist/indexer/locals-and-exports.js +659 -78
- package/dist/indexer/locals-and-exports.js.map +1 -1
- package/dist/indexer/member-selection.d.ts +46 -0
- package/dist/indexer/member-selection.d.ts.map +1 -0
- package/dist/indexer/member-selection.js +169 -0
- package/dist/indexer/member-selection.js.map +1 -0
- package/dist/indexer/name-lookup-policies/c-family.d.ts +7 -0
- package/dist/indexer/name-lookup-policies/c-family.d.ts.map +1 -0
- package/dist/indexer/name-lookup-policies/c-family.js +137 -0
- package/dist/indexer/name-lookup-policies/c-family.js.map +1 -0
- package/dist/indexer/name-lookup-policies/csharp-using-static.d.ts +11 -0
- package/dist/indexer/name-lookup-policies/csharp-using-static.d.ts.map +1 -0
- package/dist/indexer/name-lookup-policies/csharp-using-static.js +136 -0
- package/dist/indexer/name-lookup-policies/csharp-using-static.js.map +1 -0
- package/dist/indexer/name-lookup-policies/implicit-self.d.ts +10 -0
- package/dist/indexer/name-lookup-policies/implicit-self.d.ts.map +1 -0
- package/dist/indexer/name-lookup-policies/implicit-self.js +119 -0
- package/dist/indexer/name-lookup-policies/implicit-self.js.map +1 -0
- package/dist/indexer/name-lookup-policies/index.d.ts +3 -0
- package/dist/indexer/name-lookup-policies/index.d.ts.map +1 -0
- package/dist/indexer/name-lookup-policies/index.js +132 -0
- package/dist/indexer/name-lookup-policies/index.js.map +1 -0
- package/dist/indexer/name-lookup-policies/php.d.ts +3 -0
- package/dist/indexer/name-lookup-policies/php.d.ts.map +1 -0
- package/dist/indexer/name-lookup-policies/php.js +82 -0
- package/dist/indexer/name-lookup-policies/php.js.map +1 -0
- package/dist/indexer/name-resolution-types.d.ts +101 -0
- package/dist/indexer/name-resolution-types.d.ts.map +1 -0
- package/dist/indexer/name-resolution-types.js +2 -0
- package/dist/indexer/name-resolution-types.js.map +1 -0
- package/dist/indexer/name-resolution.d.ts +57 -0
- package/dist/indexer/name-resolution.d.ts.map +1 -0
- package/dist/indexer/name-resolution.js +204 -0
- package/dist/indexer/name-resolution.js.map +1 -0
- package/dist/indexer/navigation-cpp.d.ts +58 -0
- package/dist/indexer/navigation-cpp.d.ts.map +1 -0
- package/dist/indexer/navigation-cpp.js +935 -0
- package/dist/indexer/navigation-cpp.js.map +1 -0
- package/dist/indexer/navigation-goto.d.ts +115 -3
- package/dist/indexer/navigation-goto.d.ts.map +1 -1
- package/dist/indexer/navigation-goto.js +2469 -190
- package/dist/indexer/navigation-goto.js.map +1 -1
- package/dist/indexer/navigation-local.d.ts +21 -2
- package/dist/indexer/navigation-local.d.ts.map +1 -1
- package/dist/indexer/navigation-local.js +520 -63
- package/dist/indexer/navigation-local.js.map +1 -1
- package/dist/indexer/navigation-php.d.ts +66 -0
- package/dist/indexer/navigation-php.d.ts.map +1 -1
- package/dist/indexer/navigation-php.js +287 -4
- package/dist/indexer/navigation-php.js.map +1 -1
- package/dist/indexer/navigation-provenance.d.ts +1 -1
- package/dist/indexer/navigation-provenance.d.ts.map +1 -1
- package/dist/indexer/navigation-provenance.js +4 -13
- package/dist/indexer/navigation-provenance.js.map +1 -1
- package/dist/indexer/navigation-references.d.ts +73 -6
- package/dist/indexer/navigation-references.d.ts.map +1 -1
- package/dist/indexer/navigation-references.js +661 -67
- package/dist/indexer/navigation-references.js.map +1 -1
- package/dist/indexer/navigation-resolve.d.ts +46 -2
- package/dist/indexer/navigation-resolve.d.ts.map +1 -1
- package/dist/indexer/navigation-resolve.js +599 -193
- package/dist/indexer/navigation-resolve.js.map +1 -1
- package/dist/indexer/navigation.d.ts +29 -2
- package/dist/indexer/navigation.d.ts.map +1 -1
- package/dist/indexer/navigation.js +1092 -153
- package/dist/indexer/navigation.js.map +1 -1
- package/dist/indexer/parse-context.d.ts +2 -3
- package/dist/indexer/parse-context.d.ts.map +1 -1
- package/dist/indexer/parse-context.js +8 -21
- package/dist/indexer/parse-context.js.map +1 -1
- package/dist/indexer/php-namespace-symbols.d.ts +66 -0
- package/dist/indexer/php-namespace-symbols.d.ts.map +1 -0
- package/dist/indexer/php-namespace-symbols.js +342 -0
- package/dist/indexer/php-namespace-symbols.js.map +1 -0
- package/dist/indexer/reference-candidates.d.ts.map +1 -1
- package/dist/indexer/reference-candidates.js +13 -7
- package/dist/indexer/reference-candidates.js.map +1 -1
- package/dist/indexer/reference-context.d.ts +2 -0
- package/dist/indexer/reference-context.d.ts.map +1 -1
- package/dist/indexer/reference-context.js +4 -0
- package/dist/indexer/reference-context.js.map +1 -1
- package/dist/indexer/scope-nodes.d.ts +92 -13
- package/dist/indexer/scope-nodes.d.ts.map +1 -1
- package/dist/indexer/scope-nodes.js +212 -20
- package/dist/indexer/scope-nodes.js.map +1 -1
- package/dist/indexer/scope-types.d.ts +29 -1
- package/dist/indexer/scope-types.d.ts.map +1 -1
- package/dist/indexer/scope.d.ts +2 -3
- package/dist/indexer/scope.d.ts.map +1 -1
- package/dist/indexer/scope.js +968 -47
- package/dist/indexer/scope.js.map +1 -1
- package/dist/indexer/shared-owner-identity.d.ts +53 -0
- package/dist/indexer/shared-owner-identity.d.ts.map +1 -0
- package/dist/indexer/shared-owner-identity.js +460 -0
- package/dist/indexer/shared-owner-identity.js.map +1 -0
- package/dist/indexer/shared.d.ts +1 -1
- package/dist/indexer/shared.d.ts.map +1 -1
- package/dist/indexer/shared.js +1 -1
- package/dist/indexer/shared.js.map +1 -1
- package/dist/indexer/star-import-precedence.d.ts +113 -0
- package/dist/indexer/star-import-precedence.d.ts.map +1 -0
- package/dist/indexer/star-import-precedence.js +402 -0
- package/dist/indexer/star-import-precedence.js.map +1 -0
- package/dist/indexer/symbols.d.ts +3 -1
- package/dist/indexer/symbols.d.ts.map +1 -1
- package/dist/indexer/symbols.js +58 -18
- package/dist/indexer/symbols.js.map +1 -1
- package/dist/indexer/ts-callables.d.ts +42 -0
- package/dist/indexer/ts-callables.d.ts.map +1 -0
- package/dist/indexer/ts-callables.js +233 -0
- package/dist/indexer/ts-callables.js.map +1 -0
- package/dist/indexer/types.d.ts +41 -26
- package/dist/indexer/types.d.ts.map +1 -1
- package/dist/indexer/unused-exports.d.ts +13 -0
- package/dist/indexer/unused-exports.d.ts.map +1 -0
- package/dist/indexer/unused-exports.js +159 -0
- package/dist/indexer/unused-exports.js.map +1 -0
- package/dist/indexer/workspace-symbols.d.ts.map +1 -1
- package/dist/indexer/workspace-symbols.js +3 -2
- package/dist/indexer/workspace-symbols.js.map +1 -1
- package/dist/indexer.d.ts +3 -8
- package/dist/indexer.d.ts.map +1 -1
- package/dist/indexer.js +1 -1
- package/dist/indexer.js.map +1 -1
- package/dist/languages/callable-arity.d.ts +223 -0
- package/dist/languages/callable-arity.d.ts.map +1 -0
- package/dist/languages/callable-arity.js +1199 -0
- package/dist/languages/callable-arity.js.map +1 -0
- package/dist/languages/definitions/c-family.d.ts.map +1 -1
- package/dist/languages/definitions/c-family.js +30 -1
- package/dist/languages/definitions/c-family.js.map +1 -1
- package/dist/languages/definitions/c.d.ts +4 -0
- package/dist/languages/definitions/c.d.ts.map +1 -1
- package/dist/languages/definitions/c.js +19 -0
- package/dist/languages/definitions/c.js.map +1 -1
- package/dist/languages/definitions/cpp.d.ts.map +1 -1
- package/dist/languages/definitions/cpp.js +12 -0
- package/dist/languages/definitions/cpp.js.map +1 -1
- package/dist/languages/definitions/csharp.d.ts.map +1 -1
- package/dist/languages/definitions/csharp.js +2 -8
- package/dist/languages/definitions/csharp.js.map +1 -1
- package/dist/languages/definitions/go.d.ts.map +1 -1
- package/dist/languages/definitions/go.js +3 -0
- package/dist/languages/definitions/go.js.map +1 -1
- package/dist/languages/definitions/javascript.d.ts.map +1 -1
- package/dist/languages/definitions/javascript.js +10 -1
- package/dist/languages/definitions/javascript.js.map +1 -1
- package/dist/languages/definitions/js-family.d.ts +1 -1
- package/dist/languages/definitions/js-family.d.ts.map +1 -1
- package/dist/languages/definitions/js-family.js +7 -1
- package/dist/languages/definitions/js-family.js.map +1 -1
- package/dist/languages/definitions/php.d.ts.map +1 -1
- package/dist/languages/definitions/php.js +5 -1
- package/dist/languages/definitions/php.js.map +1 -1
- package/dist/languages/definitions/typescript.d.ts.map +1 -1
- package/dist/languages/definitions/typescript.js +8 -1
- package/dist/languages/definitions/typescript.js.map +1 -1
- package/dist/languages/definitions/zig.d.ts.map +1 -1
- package/dist/languages/definitions/zig.js +8 -0
- package/dist/languages/definitions/zig.js.map +1 -1
- package/dist/lifecycle/manifest.d.ts.map +1 -1
- package/dist/lifecycle/manifest.js +0 -1
- package/dist/lifecycle/manifest.js.map +1 -1
- package/dist/mcp/handlers.js +14 -7
- package/dist/mcp/handlers.js.map +1 -1
- package/dist/native/byte-index.d.ts +6 -0
- package/dist/native/byte-index.d.ts.map +1 -1
- package/dist/native/byte-index.js +11 -6
- package/dist/native/byte-index.js.map +1 -1
- package/dist/native/contracts.d.ts +2 -3
- package/dist/native/contracts.d.ts.map +1 -1
- package/dist/native/execution.d.ts +9 -9
- package/dist/native/execution.d.ts.map +1 -1
- package/dist/native/execution.js +37 -77
- package/dist/native/execution.js.map +1 -1
- package/dist/native/js-bridge.d.ts +2 -15
- package/dist/native/js-bridge.d.ts.map +1 -1
- package/dist/native/js-bridge.js +2 -15
- package/dist/native/js-bridge.js.map +1 -1
- package/dist/native/query-results.js +2 -2
- package/dist/native/query-results.js.map +1 -1
- package/dist/native/runtime.d.ts +12 -12
- package/dist/native/runtime.d.ts.map +1 -1
- package/dist/native/runtime.js +24 -69
- package/dist/native/runtime.js.map +1 -1
- package/dist/native/tree-sitter-native.d.ts +3 -3
- package/dist/native/tree-sitter-native.d.ts.map +1 -1
- package/dist/native/tree-sitter-native.js +2 -2
- package/dist/native/tree-sitter-native.js.map +1 -1
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js +0 -4
- package/dist/presets.js.map +1 -1
- package/dist/review/candidates.d.ts.map +1 -1
- package/dist/review/candidates.js +1 -1
- package/dist/review/candidates.js.map +1 -1
- package/dist/review/deleted.d.ts +3 -3
- package/dist/review/deleted.d.ts.map +1 -1
- package/dist/review/deleted.js +82 -32
- package/dist/review/deleted.js.map +1 -1
- package/dist/review/report.d.ts +1 -0
- package/dist/review/report.d.ts.map +1 -1
- package/dist/review/report.js +1 -1
- package/dist/review/report.js.map +1 -1
- package/dist/review.d.ts.map +1 -1
- package/dist/review.js +3 -20
- package/dist/review.js.map +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +0 -5
- package/dist/session.js.map +1 -1
- package/dist/sql/navigation.d.ts.map +1 -1
- package/dist/sql/navigation.js +2 -1
- package/dist/sql/navigation.js.map +1 -1
- package/dist/sql/source-graph.d.ts.map +1 -1
- package/dist/sql/source-graph.js +2 -2
- package/dist/sql/source-graph.js.map +1 -1
- package/dist/sqlite/schema.d.ts +1 -1
- package/dist/sqlite/schema.d.ts.map +1 -1
- package/dist/sqlite/schema.js +8 -2
- package/dist/sqlite/schema.js.map +1 -1
- package/dist/sqlite/write.js +2 -2
- package/dist/sqlite/write.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/util/bloom-filter.d.ts +8 -1
- package/dist/util/bloom-filter.d.ts.map +1 -1
- package/dist/util/bloom-filter.js +15 -2
- package/dist/util/bloom-filter.js.map +1 -1
- package/dist/util/glob.d.ts +32 -0
- package/dist/util/glob.d.ts.map +1 -0
- package/dist/util/glob.js +137 -0
- package/dist/util/glob.js.map +1 -0
- package/dist/util/graph-edges.d.ts +19 -1
- package/dist/util/graph-edges.d.ts.map +1 -1
- package/dist/util/graph-edges.js +30 -4
- package/dist/util/graph-edges.js.map +1 -1
- package/dist/util/identifiers.d.ts +15 -0
- package/dist/util/identifiers.d.ts.map +1 -1
- package/dist/util/identifiers.js +35 -0
- package/dist/util/identifiers.js.map +1 -1
- package/dist/util/member-access-tables.d.ts +61 -4
- package/dist/util/member-access-tables.d.ts.map +1 -1
- package/dist/util/member-access-tables.js +139 -19
- package/dist/util/member-access-tables.js.map +1 -1
- package/dist/util/member-access.d.ts +17 -0
- package/dist/util/member-access.d.ts.map +1 -1
- package/dist/util/member-access.js +98 -3
- package/dist/util/member-access.js.map +1 -1
- package/dist/util/project-files.d.ts +2 -10
- package/dist/util/project-files.d.ts.map +1 -1
- package/dist/util/project-files.js +29 -51
- package/dist/util/project-files.js.map +1 -1
- package/dist/util/python-type-checking.d.ts +18 -0
- package/dist/util/python-type-checking.d.ts.map +1 -0
- package/dist/util/python-type-checking.js +160 -0
- package/dist/util/python-type-checking.js.map +1 -0
- package/dist/util/resolution/cargo-targets.d.ts +11 -0
- package/dist/util/resolution/cargo-targets.d.ts.map +1 -1
- package/dist/util/resolution/cargo-targets.js +174 -13
- package/dist/util/resolution/cargo-targets.js.map +1 -1
- package/dist/util/resolution/csharp.d.ts +33 -1
- package/dist/util/resolution/csharp.d.ts.map +1 -1
- package/dist/util/resolution/csharp.js +145 -30
- package/dist/util/resolution/csharp.js.map +1 -1
- package/dist/util/resolution/jvm.d.ts +7 -3
- package/dist/util/resolution/jvm.d.ts.map +1 -1
- package/dist/util/resolution/jvm.js +56 -38
- package/dist/util/resolution/jvm.js.map +1 -1
- package/dist/util/resolution/php.d.ts.map +1 -1
- package/dist/util/resolution/php.js +35 -8
- package/dist/util/resolution/php.js.map +1 -1
- package/dist/util/resolution/python.d.ts +9 -0
- package/dist/util/resolution/python.d.ts.map +1 -1
- package/dist/util/resolution/python.js +46 -0
- package/dist/util/resolution/python.js.map +1 -1
- package/dist/util/resolution/rust.d.ts +0 -1
- package/dist/util/resolution/rust.d.ts.map +1 -1
- package/dist/util/resolution/rust.js +95 -35
- package/dist/util/resolution/rust.js.map +1 -1
- package/dist/util/resolution/specifier-targets.d.ts +44 -0
- package/dist/util/resolution/specifier-targets.d.ts.map +1 -0
- package/dist/util/resolution/specifier-targets.js +152 -0
- package/dist/util/resolution/specifier-targets.js.map +1 -0
- package/dist/util/resolution-candidates.d.ts +5 -0
- package/dist/util/resolution-candidates.d.ts.map +1 -1
- package/dist/util/resolution-candidates.js +16 -3
- package/dist/util/resolution-candidates.js.map +1 -1
- package/dist/util/resolution.d.ts +2 -1
- package/dist/util/resolution.d.ts.map +1 -1
- package/dist/util/resolution.js +101 -15
- package/dist/util/resolution.js.map +1 -1
- package/dist/util/specifiers.d.ts +29 -1
- package/dist/util/specifiers.d.ts.map +1 -1
- package/dist/util/specifiers.js +56 -8
- package/dist/util/specifiers.js.map +1 -1
- package/dist/util/trivia.d.ts.map +1 -1
- package/dist/util/trivia.js +49 -30
- package/dist/util/trivia.js.map +1 -1
- package/dist/util/workspace.d.ts.map +1 -1
- package/dist/util/workspace.js +32 -4
- package/dist/util/workspace.js.map +1 -1
- package/docs/mcp.md +3 -2
- package/package.json +5 -7
- package/dist/impact/call-compatibility/providers/profiles.d.ts +0 -80
- package/dist/impact/call-compatibility/providers/profiles.d.ts.map +0 -1
- package/dist/impact/call-compatibility/providers/profiles.js +0 -164
- package/dist/impact/call-compatibility/providers/profiles.js.map +0 -1
|
@@ -1,17 +1,38 @@
|
|
|
1
|
+
import { cTagRole } from "../languages/definitions/c.js";
|
|
1
2
|
import { isGraphOnlyLanguage } from "../document-links.js";
|
|
2
3
|
import { capturesByName, capturesNamed, rangeFromNativeCapture } from "../native/query-results.js";
|
|
3
4
|
import { buildByteToStringIndexMap } from "../native/byte-index.js";
|
|
4
5
|
import { ProjectedSyntaxTree } from "../native/projected-tree.js";
|
|
5
|
-
import { assertNativeRequiredAvailable, getNativeSyntaxTreeExecution, isNativeRequiredUnavailableError, } from "../native/tree-sitter-native.js";
|
|
6
|
-
import { maskJsLikeCommentsAndStrings } from "../util/comments.js";
|
|
6
|
+
import { assertNativeRequiredAvailable, getNativeSyntaxTreeExecution, getNativeQueryExecution, isNativeRequiredUnavailableError, } from "../native/tree-sitter-native.js";
|
|
7
|
+
import { maskJsLikeCommentsAndStrings, maskJsLikeCommentsStringsAndRegex } from "../util/comments.js";
|
|
7
8
|
import { sliceText, toRange, unquote } from "../util/ast.js";
|
|
9
|
+
import { callableIdentityForDeclaration, propagateCppInternalLinkage } from "./callable-identity.js";
|
|
8
10
|
import { bindingKindToSymbolKind } from "./declarations.js";
|
|
9
11
|
import { buildScopeIndexFromSource } from "./scope.js";
|
|
12
|
+
import { findClosestScopeBinding } from "./navigation-local.js";
|
|
10
13
|
import { SymbolKind } from "./types.js";
|
|
11
14
|
import { isPythonInstanceAttributeDeclaration } from "../languages/definitions/python.js";
|
|
15
|
+
import { phpConstructorPromotedVariable, phpPropertyPromotionParameter } from "./navigation-php.js";
|
|
12
16
|
import { importCapture } from "../languages/graph-captures.js";
|
|
13
17
|
import { ECMASCRIPT_IDENTIFIER_SOURCE, XID_IDENTIFIER_SOURCE } from "../util/identifiers.js";
|
|
14
|
-
import { isExportedDeclaration } from "./declaration-visibility.js";
|
|
18
|
+
import { isExportedDeclaration, isJavaProtectedDeclaration, isJavaPublicDeclaration, } from "./declaration-visibility.js";
|
|
19
|
+
import { cppQualifiedNameSegments } from "../graphs/symbol-graph-detailed/receiver-calls.js";
|
|
20
|
+
import { typescriptCollapsedOverloadTarget } from "./ts-callables.js";
|
|
21
|
+
// Missing captured comments prove missing documentation only for these languages.
|
|
22
|
+
// Python captures # comments but not triple-quoted function/class docstrings.
|
|
23
|
+
/** Languages whose parsers capture docstrings onto local definitions. */
|
|
24
|
+
export const DOCSTRING_CAPTURE_LANGUAGES = new Set([
|
|
25
|
+
"ts",
|
|
26
|
+
"tsx",
|
|
27
|
+
"js",
|
|
28
|
+
"go",
|
|
29
|
+
"java",
|
|
30
|
+
"csharp",
|
|
31
|
+
"kotlin",
|
|
32
|
+
"rust",
|
|
33
|
+
"zig",
|
|
34
|
+
"scss",
|
|
35
|
+
]);
|
|
15
36
|
/**
|
|
16
37
|
* Matches one `exportScopeBlockers` entry against an ancestor node. A plain entry compares the
|
|
17
38
|
* node type; a `parent>node` entry also requires that parent type, which is how Python separates a
|
|
@@ -30,6 +51,9 @@ const JS_FALLBACK_REEXPORT_SPECIFIER_PATTERN = new RegExp(String.raw `^(?:type\s
|
|
|
30
51
|
const JS_FALLBACK_REEXPORT_TYPE_SPECIFIER_PATTERN = new RegExp(String.raw `^type\s+(${ECMASCRIPT_IDENTIFIER_SOURCE})(?:\s+as\s+(${ECMASCRIPT_IDENTIFIER_SOURCE}))?$`, "u");
|
|
31
52
|
const JS_FALLBACK_REEXPORT_NAMESPACE_PATTERN = new RegExp(String.raw `\bexport\s*\*\s+as\s+(${ECMASCRIPT_IDENTIFIER_SOURCE})\s+from\s*("|')([^"']*)\2`, "gu");
|
|
32
53
|
const JS_FALLBACK_CJS_FUNCTION_PATTERN = new RegExp(String.raw `(?:^|[;\n\r])\s*(?:exports|module\.exports)\.(${ECMASCRIPT_IDENTIFIER_SOURCE})\s*=\s*(function\b|\([^)]*\)\s*=>)`, "gu");
|
|
54
|
+
const JS_FALLBACK_CJS_MODULE_FUNCTION_PATTERN = new RegExp(String.raw `(?:^|[;\n\r])\s*module\.exports\s*=\s*(?:async\s+)?(?:function\b\s*\*?\s*(${ECMASCRIPT_IDENTIFIER_SOURCE})?\s*\(|\([^)]*\)\s*=>|${ECMASCRIPT_IDENTIFIER_SOURCE}\s*=>)`, "gu");
|
|
55
|
+
const JS_FALLBACK_CJS_MODULE_IDENTIFIER_PATTERN = new RegExp(String.raw `(?:^|[;\n\r])\s*module\.exports\s*=\s*(${ECMASCRIPT_IDENTIFIER_SOURCE})(?![$_\p{ID_Continue}\u200c\u200d])(?=\s*(?:;|$|\r|\n))`, "gu");
|
|
56
|
+
const JS_FALLBACK_TOP_LEVEL_LOCAL_PATTERN = new RegExp(String.raw `(?:^|[;{}\n\r])\s*(?:export\s+)?(?:default\s+)?(?:declare\s+)?((?:abstract\s+)?class|(?:async\s+)?function|const|let|var)\s+(${ECMASCRIPT_IDENTIFIER_SOURCE})(?![$_\p{ID_Continue}\u200c\u200d])`, "gu");
|
|
33
57
|
const JS_FALLBACK_CJS_OBJECT_FUNCTION_PATTERN = new RegExp(String.raw `(${ECMASCRIPT_IDENTIFIER_SOURCE})\s*:\s*(function\b|\([^)]*\)\s*=>)`, "gu");
|
|
34
58
|
const JS_DEFAULT_FUNCTION_PATTERN = new RegExp(String.raw `\bexport\s+default\s+(?:async\s+)?function\b\s*\*?\s*(${ECMASCRIPT_IDENTIFIER_SOURCE})`, "u");
|
|
35
59
|
const JS_DEFAULT_CLASS_PATTERN = new RegExp(String.raw `\bexport\s+default\s+(?:abstract\s+)?class\s+(${ECMASCRIPT_IDENTIFIER_SOURCE})`, "u");
|
|
@@ -57,12 +81,21 @@ const MEMBER_CONTAINER_NODE_TYPES = {
|
|
|
57
81
|
class_declaration: true,
|
|
58
82
|
abstract_class_declaration: true,
|
|
59
83
|
class_definition: true,
|
|
84
|
+
class_specifier: true,
|
|
85
|
+
struct_specifier: true,
|
|
86
|
+
union_specifier: true,
|
|
60
87
|
class: true,
|
|
61
88
|
interface_declaration: true,
|
|
62
89
|
impl_item: true,
|
|
63
90
|
trait_item: true,
|
|
64
91
|
enum_declaration: true,
|
|
65
92
|
enum_item: true,
|
|
93
|
+
// Zig has no implicit member scope of its own; a function nested in one of these container
|
|
94
|
+
// forms is a method, matching the receiver-call detection in receiver-calls.ts's
|
|
95
|
+
// MEMBER_CONTAINER_TYPES, which already lists all three.
|
|
96
|
+
struct_declaration: true,
|
|
97
|
+
union_declaration: true,
|
|
98
|
+
opaque_declaration: true,
|
|
66
99
|
};
|
|
67
100
|
const CALLABLE_DECLARATION_NODE_TYPES = {
|
|
68
101
|
function_declaration: true,
|
|
@@ -77,6 +110,8 @@ const CALLABLE_DECLARATION_NODE_TYPES = {
|
|
|
77
110
|
function isTypeMemberDeclaration(node) {
|
|
78
111
|
if (isPythonInstanceAttributeDeclaration(node))
|
|
79
112
|
return true;
|
|
113
|
+
if (phpConstructorPromotedVariable(node))
|
|
114
|
+
return true;
|
|
80
115
|
let current = node.parent?.parent ?? null;
|
|
81
116
|
while (current) {
|
|
82
117
|
if (MEMBER_CONTAINER_NODE_TYPES[current.type])
|
|
@@ -87,6 +122,119 @@ function isTypeMemberDeclaration(node) {
|
|
|
87
122
|
}
|
|
88
123
|
return false;
|
|
89
124
|
}
|
|
125
|
+
function enclosingJvmTypeDeclaration(node) {
|
|
126
|
+
let current = node.parent?.parent ?? null;
|
|
127
|
+
while (current) {
|
|
128
|
+
if (current.type === "class_declaration" ||
|
|
129
|
+
current.type === "interface_declaration" ||
|
|
130
|
+
current.type === "enum_declaration" ||
|
|
131
|
+
current.type === "record_declaration" ||
|
|
132
|
+
current.type === "annotation_type_declaration" ||
|
|
133
|
+
current.type === "object_declaration") {
|
|
134
|
+
return current;
|
|
135
|
+
}
|
|
136
|
+
current = current.parent;
|
|
137
|
+
}
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
function cppQualifiedExportName(nameNode, source, name, omitInlineNamespaces = false) {
|
|
141
|
+
const namespaceSegments = [];
|
|
142
|
+
let qualifiedSegments = null;
|
|
143
|
+
let current = nameNode;
|
|
144
|
+
while (current) {
|
|
145
|
+
if (!qualifiedSegments && current.type === "qualified_identifier") {
|
|
146
|
+
// `a::C::run` nests `C::run` inside `a::(...)`; the outermost node carries the full path.
|
|
147
|
+
while (current.parent?.type === "qualified_identifier")
|
|
148
|
+
current = current.parent;
|
|
149
|
+
if (current.parent?.type !== "using_declaration") {
|
|
150
|
+
const segments = cppQualifiedNameSegments(current, source);
|
|
151
|
+
if (segments.length > 1)
|
|
152
|
+
qualifiedSegments = segments;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (current.type === "namespace_definition") {
|
|
156
|
+
const namespaceName = current.childForFieldName("name");
|
|
157
|
+
if (!namespaceName) {
|
|
158
|
+
current = current.parent;
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
const declaresNamespaceSegment = namespaceName.startIndex <= nameNode.startIndex && namespaceName.endIndex >= nameNode.endIndex;
|
|
162
|
+
if (declaresNamespaceSegment) {
|
|
163
|
+
qualifiedSegments =
|
|
164
|
+
namespaceName.type === "nested_namespace_specifier"
|
|
165
|
+
? namespaceName.namedChildren
|
|
166
|
+
.filter((child) => child.type === "namespace_identifier" && child.endIndex <= nameNode.endIndex)
|
|
167
|
+
.map((child) => sliceText(child, source))
|
|
168
|
+
: [name];
|
|
169
|
+
}
|
|
170
|
+
else if (!omitInlineNamespaces || current.child(0)?.type !== "inline") {
|
|
171
|
+
namespaceSegments.unshift(cppQualifiedNameSegments(namespaceName, source));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
current = current.parent;
|
|
175
|
+
}
|
|
176
|
+
return [...namespaceSegments.flat(), ...(qualifiedSegments ?? [name])].join("::");
|
|
177
|
+
}
|
|
178
|
+
const RUBY_CONTAINER_TYPES = new Set(["class", "module"]);
|
|
179
|
+
/** Whether `container`'s own body (not a nested class or module) declares `name`. */
|
|
180
|
+
function rubyContainerDeclares(container, name, source) {
|
|
181
|
+
const visit = (node) => {
|
|
182
|
+
for (const child of node.namedChildren) {
|
|
183
|
+
if (RUBY_CONTAINER_TYPES.has(child.type)) {
|
|
184
|
+
const childName = child.childForFieldName("name");
|
|
185
|
+
if (childName && sliceText(childName, source) === name)
|
|
186
|
+
return true;
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
if (visit(child))
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
return false;
|
|
193
|
+
};
|
|
194
|
+
return visit(container);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Nested Ruby constants are not top-level names. `module Outer; class Base`
|
|
198
|
+
* exports as `Outer::Base`, so a `require` cannot bind bare `Base`. A `scope_resolution`
|
|
199
|
+
* name (`class Inner::Tool`) looks up its first segment lexically, as Ruby does: the
|
|
200
|
+
* innermost enclosing class or module that declares `Inner` in this file supplies the
|
|
201
|
+
* prefix (`Outer::Inner::Tool`); otherwise the path is top-level. A leading `::` is absolute.
|
|
202
|
+
*/
|
|
203
|
+
function rubyQualifiedExportName(nameNode, source, name) {
|
|
204
|
+
if (name.startsWith("::"))
|
|
205
|
+
return name.slice(2);
|
|
206
|
+
const containers = [];
|
|
207
|
+
for (let current = nameNode.parent; current; current = current.parent) {
|
|
208
|
+
if (!RUBY_CONTAINER_TYPES.has(current.type))
|
|
209
|
+
continue;
|
|
210
|
+
const containerName = current.childForFieldName("name");
|
|
211
|
+
if (!containerName)
|
|
212
|
+
continue;
|
|
213
|
+
const ownsExport = containerName.startIndex <= nameNode.startIndex && containerName.endIndex >= nameNode.endIndex;
|
|
214
|
+
if (ownsExport)
|
|
215
|
+
continue;
|
|
216
|
+
const text = sliceText(containerName, source);
|
|
217
|
+
if (text)
|
|
218
|
+
containers.push({ node: current, text });
|
|
219
|
+
}
|
|
220
|
+
// `containers` is innermost first. A plain constant is owned by the innermost container; a
|
|
221
|
+
// scope-resolution name by the innermost container that declares its first segment.
|
|
222
|
+
let ownerIndex = 0;
|
|
223
|
+
if (nameNode.type === "scope_resolution") {
|
|
224
|
+
const firstSegment = name.split("::")[0] ?? name;
|
|
225
|
+
ownerIndex = containers.findIndex((container) => rubyContainerDeclares(container.node, firstSegment, source));
|
|
226
|
+
if (ownerIndex < 0)
|
|
227
|
+
return name;
|
|
228
|
+
}
|
|
229
|
+
else if (nameNode.type !== "constant") {
|
|
230
|
+
return name;
|
|
231
|
+
}
|
|
232
|
+
const prefix = containers
|
|
233
|
+
.slice(ownerIndex)
|
|
234
|
+
.reverse()
|
|
235
|
+
.map((container) => container.text);
|
|
236
|
+
return prefix.length ? `${prefix.join("::")}::${name}` : name;
|
|
237
|
+
}
|
|
90
238
|
const C_DECLARATOR_IDENTIFIER_PATTERN = new RegExp(`^${XID_IDENTIFIER_SOURCE}`, "u");
|
|
91
239
|
const C_DECLARATOR_QUALIFIER_PATTERN = /^(?:const|volatile|restrict|_Atomic)\b/;
|
|
92
240
|
function cDeclaratorDeclaredName(text) {
|
|
@@ -128,40 +276,89 @@ function declaratorNameNode(node) {
|
|
|
128
276
|
}
|
|
129
277
|
return undefined;
|
|
130
278
|
}
|
|
131
|
-
function
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
279
|
+
// C function and tag redeclarations share an identity. Tags remain separate from
|
|
280
|
+
// typedefs and other ordinary names, even when both are classified as TypeAlias.
|
|
281
|
+
function localExportDedupeKey(entry, languageId) {
|
|
282
|
+
if (languageId === "c") {
|
|
283
|
+
if (entry.target.kind === SymbolKind.Function)
|
|
284
|
+
return `${entry.exportedAs}\0function`;
|
|
285
|
+
if (entry.target.cTag) {
|
|
286
|
+
return `${entry.exportedAs}\0tag`;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
140
289
|
return `${entry.exportedAs}\0${entry.target.localName}\0${entry.target.range.start.index ?? 0}\0${entry.target.range.end.index ?? 0}`;
|
|
141
290
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
291
|
+
function collapseTypeScriptCallableExports(exports, languageId) {
|
|
292
|
+
if (languageId !== "ts" && languageId !== "tsx")
|
|
293
|
+
return exports;
|
|
294
|
+
const groups = new Map();
|
|
295
|
+
for (const entry of exports) {
|
|
296
|
+
if (entry.type !== "local" || entry.target.kind !== SymbolKind.Function)
|
|
297
|
+
continue;
|
|
298
|
+
const callable = entry.target.callable;
|
|
299
|
+
if (!callable || callable.role === "other")
|
|
300
|
+
continue;
|
|
301
|
+
const key = `${callable.key}\0${entry.exportedAs}`;
|
|
302
|
+
const group = groups.get(key) ?? [];
|
|
303
|
+
group.push(entry);
|
|
304
|
+
groups.set(key, group);
|
|
305
|
+
}
|
|
306
|
+
const drop = new Set();
|
|
307
|
+
for (const group of groups.values()) {
|
|
308
|
+
if (group.length < 2)
|
|
309
|
+
continue;
|
|
310
|
+
const canonical = typescriptCollapsedOverloadTarget(group, (entry) => entry.target.callable);
|
|
311
|
+
if (!canonical)
|
|
312
|
+
continue;
|
|
313
|
+
if (!canonical.target.docstring?.trim()) {
|
|
314
|
+
const documented = group.find((entry) => entry.target.docstring?.trim());
|
|
315
|
+
if (documented?.target.docstring)
|
|
316
|
+
canonical.target.docstring = documented.target.docstring;
|
|
317
|
+
}
|
|
318
|
+
for (const entry of group) {
|
|
319
|
+
if (entry !== canonical)
|
|
320
|
+
drop.add(entry);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (drop.size === 0)
|
|
324
|
+
return exports;
|
|
325
|
+
return exports.filter((entry) => !drop.has(entry));
|
|
326
|
+
}
|
|
327
|
+
function dedupeExportEntries(entries, languageId) {
|
|
328
|
+
const seen = new Map();
|
|
144
329
|
const out = [];
|
|
145
330
|
for (const entry of entries) {
|
|
146
331
|
if (entry.type !== "local") {
|
|
147
332
|
out.push(entry);
|
|
148
333
|
continue;
|
|
149
334
|
}
|
|
150
|
-
const key = localExportDedupeKey(entry);
|
|
151
|
-
|
|
335
|
+
const key = localExportDedupeKey(entry, languageId);
|
|
336
|
+
const previousIndex = seen.get(key);
|
|
337
|
+
if (previousIndex !== undefined) {
|
|
338
|
+
const previous = out[previousIndex];
|
|
339
|
+
if (languageId === "c" &&
|
|
340
|
+
entry.target.cTag === "declaration" &&
|
|
341
|
+
previous?.type === "local" &&
|
|
342
|
+
previous.target.cTag &&
|
|
343
|
+
previous.target.cTag !== "declaration") {
|
|
344
|
+
out[previousIndex] = entry;
|
|
345
|
+
}
|
|
152
346
|
continue;
|
|
153
|
-
|
|
347
|
+
}
|
|
348
|
+
seen.set(key, out.length);
|
|
154
349
|
out.push(entry);
|
|
155
350
|
}
|
|
156
351
|
return out;
|
|
157
352
|
}
|
|
158
|
-
function appendJsLikeRegexFallbackExports(file, source, locals, exports) {
|
|
159
|
-
const maskedSource = maskJsLikeCommentsAndStrings(source);
|
|
353
|
+
function appendJsLikeRegexFallbackExports(file, source, locals, exports, leadingDocstringAt, tree, maskedSource) {
|
|
160
354
|
JS_FALLBACK_DECLARATION_PATTERN.lastIndex = 0;
|
|
161
355
|
JS_FALLBACK_DEFAULT_PATTERN.lastIndex = 0;
|
|
162
356
|
JS_FALLBACK_EXPORT_ASSIGN_PATTERN.lastIndex = 0;
|
|
163
357
|
JS_FALLBACK_REEXPORT_NAMESPACE_PATTERN.lastIndex = 0;
|
|
164
358
|
JS_FALLBACK_CJS_FUNCTION_PATTERN.lastIndex = 0;
|
|
359
|
+
JS_FALLBACK_CJS_MODULE_FUNCTION_PATTERN.lastIndex = 0;
|
|
360
|
+
JS_FALLBACK_CJS_MODULE_IDENTIFIER_PATTERN.lastIndex = 0;
|
|
361
|
+
JS_FALLBACK_TOP_LEVEL_LOCAL_PATTERN.lastIndex = 0;
|
|
165
362
|
JS_FALLBACK_CJS_OBJECT_FUNCTION_PATTERN.lastIndex = 0;
|
|
166
363
|
const reDecl = JS_FALLBACK_DECLARATION_PATTERN;
|
|
167
364
|
const reDefault = JS_FALLBACK_DEFAULT_PATTERN;
|
|
@@ -170,8 +367,67 @@ function appendJsLikeRegexFallbackExports(file, source, locals, exports) {
|
|
|
170
367
|
const reReexportNs = JS_FALLBACK_REEXPORT_NAMESPACE_PATTERN;
|
|
171
368
|
const reStar = /\bexport\s*\*\s*from\s*("|')([^"']*)\1/gu;
|
|
172
369
|
const reCjsFn = JS_FALLBACK_CJS_FUNCTION_PATTERN;
|
|
370
|
+
const reCjsModuleFn = JS_FALLBACK_CJS_MODULE_FUNCTION_PATTERN;
|
|
371
|
+
const reCjsModuleIdentifier = JS_FALLBACK_CJS_MODULE_IDENTIFIER_PATTERN;
|
|
372
|
+
const reTopLevelLocal = JS_FALLBACK_TOP_LEVEL_LOCAL_PATTERN;
|
|
173
373
|
const reCjsObjFn = JS_FALLBACK_CJS_OBJECT_FUNCTION_PATTERN;
|
|
174
374
|
const moduleExportsObject = /module\.exports\s*=\s*\{([^}]*)\}/su;
|
|
375
|
+
const capturedCommonJsFunctionAt = (exportedAs, propertyIndex) => {
|
|
376
|
+
const root = tree?.rootNode;
|
|
377
|
+
if (!root || propertyIndex < 0 || propertyIndex >= source.length)
|
|
378
|
+
return undefined;
|
|
379
|
+
let node = root.descendantForIndex(propertyIndex, propertyIndex + 1);
|
|
380
|
+
while (node && node !== root && node.type !== "assignment_expression" && node.type !== "pair") {
|
|
381
|
+
node = node.parent;
|
|
382
|
+
}
|
|
383
|
+
if (!node || node === root)
|
|
384
|
+
return undefined;
|
|
385
|
+
const value = node.childForFieldName(node.type === "pair" ? "value" : "right");
|
|
386
|
+
if (!value)
|
|
387
|
+
return undefined;
|
|
388
|
+
const headerEnd = value.childForFieldName("body")?.startIndex ?? value.endIndex;
|
|
389
|
+
// A native function export points into this RHS header, not at an earlier same-named local.
|
|
390
|
+
return exports.find((entry) => {
|
|
391
|
+
if (entry.type !== "local" || entry.exportedAs !== exportedAs || entry.target.file !== file)
|
|
392
|
+
return false;
|
|
393
|
+
if (entry.target.kind !== SymbolKind.Function)
|
|
394
|
+
return false;
|
|
395
|
+
const start = entry.target.range.start.index;
|
|
396
|
+
return start !== undefined && start >= value.startIndex && start < headerEnd;
|
|
397
|
+
});
|
|
398
|
+
};
|
|
399
|
+
const appendCommonJsFunction = (exportedAs, propertyIndex, moduleValue = false) => {
|
|
400
|
+
const docstring = leadingDocstringAt(propertyIndex);
|
|
401
|
+
const existing = capturedCommonJsFunctionAt(exportedAs, propertyIndex);
|
|
402
|
+
if (existing) {
|
|
403
|
+
if (docstring && !existing.target.docstring)
|
|
404
|
+
existing.target.docstring = docstring;
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
if (moduleValue && exports.some((entry) => entry.type === "local" && entry.mechanism === "cjs-module-value")) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
let line = 1;
|
|
411
|
+
let lineStart = 0;
|
|
412
|
+
for (let offset = 0; offset < propertyIndex; offset++) {
|
|
413
|
+
if (source.charCodeAt(offset) === 10) {
|
|
414
|
+
line++;
|
|
415
|
+
lineStart = offset + 1;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
const start = { line, column: propertyIndex - lineStart + 1, index: propertyIndex };
|
|
419
|
+
const end = { ...start, column: start.column + exportedAs.length, index: propertyIndex + exportedAs.length };
|
|
420
|
+
const target = { file, localName: exportedAs, kind: SymbolKind.Function, range: { start, end } };
|
|
421
|
+
if (docstring)
|
|
422
|
+
target.docstring = docstring;
|
|
423
|
+
locals.push(target);
|
|
424
|
+
if (moduleValue) {
|
|
425
|
+
exports.push({ type: "local", exportedAs, target, mechanism: "cjs-module-value" });
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
exports.push({ type: "local", exportedAs, target });
|
|
429
|
+
}
|
|
430
|
+
};
|
|
175
431
|
let match;
|
|
176
432
|
while ((match = reDecl.exec(maskedSource))) {
|
|
177
433
|
const name = match[1];
|
|
@@ -203,6 +459,7 @@ function appendJsLikeRegexFallbackExports(file, source, locals, exports) {
|
|
|
203
459
|
type: "local",
|
|
204
460
|
exportedAs: "default",
|
|
205
461
|
target: { ...local, kind: SymbolKind.Default },
|
|
462
|
+
mechanism: "ts-export-assignment",
|
|
206
463
|
});
|
|
207
464
|
}
|
|
208
465
|
}
|
|
@@ -263,20 +520,97 @@ function appendJsLikeRegexFallbackExports(file, source, locals, exports) {
|
|
|
263
520
|
}
|
|
264
521
|
while ((match = reCjsFn.exec(maskedSource))) {
|
|
265
522
|
const exportedAs = match[1];
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
523
|
+
const propertyIndex = match.index + match[0].indexOf(exportedAs);
|
|
524
|
+
appendCommonJsFunction(exportedAs, propertyIndex);
|
|
525
|
+
}
|
|
526
|
+
while ((match = reCjsModuleFn.exec(maskedSource))) {
|
|
527
|
+
const propertyIndex = match.index + match[0].indexOf("exports");
|
|
528
|
+
appendCommonJsFunction("exports", propertyIndex, true);
|
|
529
|
+
}
|
|
530
|
+
let identifierMatch = reCjsModuleIdentifier.exec(maskedSource);
|
|
531
|
+
if (identifierMatch && !exports.some((entry) => entry.type === "local" && entry.exportedAs === "default")) {
|
|
532
|
+
const identifierAssignments = [identifierMatch];
|
|
533
|
+
while ((identifierMatch = reCjsModuleIdentifier.exec(maskedSource)))
|
|
534
|
+
identifierAssignments.push(identifierMatch);
|
|
535
|
+
// Only a single module-scope declaration can prove the value behind module.exports.
|
|
536
|
+
// The comments/strings/regex mask preserves offsets while keeping nested declarations out.
|
|
537
|
+
const scopeSource = maskJsLikeCommentsStringsAndRegex(source);
|
|
538
|
+
let scanIndex = 0;
|
|
539
|
+
let scanLine = 1;
|
|
540
|
+
let lastLineBreak = -1;
|
|
541
|
+
let scopeDepth = 0;
|
|
542
|
+
const depthAt = (index) => {
|
|
543
|
+
while (scanIndex < index) {
|
|
544
|
+
const ch = scopeSource[scanIndex++];
|
|
545
|
+
if (ch === "{")
|
|
546
|
+
scopeDepth++;
|
|
547
|
+
if (ch === "\n") {
|
|
548
|
+
scanLine++;
|
|
549
|
+
lastLineBreak = scanIndex - 1;
|
|
550
|
+
}
|
|
551
|
+
if (ch === "}")
|
|
552
|
+
scopeDepth--;
|
|
553
|
+
}
|
|
554
|
+
return scopeDepth;
|
|
555
|
+
};
|
|
556
|
+
const declarations = new Map();
|
|
557
|
+
const valueNames = new Set(identifierAssignments.map((assignment) => assignment[1]));
|
|
558
|
+
let declarationMatch;
|
|
559
|
+
while ((declarationMatch = reTopLevelLocal.exec(scopeSource))) {
|
|
560
|
+
const name = declarationMatch[2];
|
|
561
|
+
if (!valueNames.has(name))
|
|
562
|
+
continue;
|
|
563
|
+
const startIndex = declarationMatch.index + declarationMatch[0].lastIndexOf(name);
|
|
564
|
+
if (depthAt(startIndex))
|
|
565
|
+
continue;
|
|
566
|
+
const declaration = declarationMatch[1];
|
|
567
|
+
let kind = SymbolKind.Variable;
|
|
568
|
+
if (declaration.endsWith("function"))
|
|
569
|
+
kind = SymbolKind.Function;
|
|
570
|
+
if (declaration.endsWith("class"))
|
|
571
|
+
kind = SymbolKind.Class;
|
|
572
|
+
const start = { line: scanLine, column: startIndex - lastLineBreak, index: startIndex };
|
|
573
|
+
const local = locals.find((def) => def.localName === name && def.range.start.index === startIndex) ?? {
|
|
271
574
|
file,
|
|
272
|
-
localName:
|
|
273
|
-
kind
|
|
274
|
-
range: { start:
|
|
575
|
+
localName: name,
|
|
576
|
+
kind,
|
|
577
|
+
range: { start, end: { ...start, column: start.column + name.length, index: startIndex + name.length } },
|
|
275
578
|
};
|
|
276
|
-
|
|
579
|
+
const namedDeclarations = declarations.get(name) ?? [];
|
|
580
|
+
const docstring = leadingDocstringAt(startIndex);
|
|
581
|
+
if (docstring && !local.docstring)
|
|
582
|
+
local.docstring = docstring;
|
|
583
|
+
namedDeclarations.push(local);
|
|
584
|
+
declarations.set(name, namedDeclarations);
|
|
277
585
|
}
|
|
278
|
-
|
|
279
|
-
|
|
586
|
+
scanIndex = 0;
|
|
587
|
+
scopeDepth = 0;
|
|
588
|
+
const provenValue = (assignment) => {
|
|
589
|
+
const name = assignment[1];
|
|
590
|
+
const rhsIndex = assignment.index + assignment[0].lastIndexOf(name);
|
|
591
|
+
if (depthAt(rhsIndex))
|
|
592
|
+
return undefined;
|
|
593
|
+
// A line break before .method, [key] or a call still belongs to the RHS.
|
|
594
|
+
let afterRhs = rhsIndex + name.length;
|
|
595
|
+
while (/\s/u.test(maskedSource[afterRhs] ?? ""))
|
|
596
|
+
afterRhs++;
|
|
597
|
+
if (maskedSource[afterRhs] === "." || maskedSource[afterRhs] === "[" || maskedSource[afterRhs] === "(") {
|
|
598
|
+
return undefined;
|
|
599
|
+
}
|
|
600
|
+
const candidates = declarations.get(name);
|
|
601
|
+
return candidates?.length === 1 ? candidates[0] : undefined;
|
|
602
|
+
};
|
|
603
|
+
// As in the native path, a reassigned module.exports has no single proven value.
|
|
604
|
+
const selected = identifierAssignments.length === 1 ? provenValue(identifierAssignments[0]) : undefined;
|
|
605
|
+
if (selected) {
|
|
606
|
+
if (!locals.includes(selected))
|
|
607
|
+
locals.push(selected);
|
|
608
|
+
exports.push({
|
|
609
|
+
type: "local",
|
|
610
|
+
exportedAs: "default",
|
|
611
|
+
target: { ...selected, kind: SymbolKind.Default },
|
|
612
|
+
mechanism: "cjs-module-value",
|
|
613
|
+
});
|
|
280
614
|
}
|
|
281
615
|
}
|
|
282
616
|
const moduleExportsObjMatch = moduleExportsObject.exec(maskedSource);
|
|
@@ -284,31 +618,22 @@ function appendJsLikeRegexFallbackExports(file, source, locals, exports) {
|
|
|
284
618
|
return;
|
|
285
619
|
}
|
|
286
620
|
const objContent = moduleExportsObjMatch[1];
|
|
621
|
+
const objectStart = moduleExportsObjMatch.index + moduleExportsObjMatch[0].indexOf("{") + 1;
|
|
287
622
|
let objectMatch;
|
|
288
623
|
while ((objectMatch = reCjsObjFn.exec(objContent))) {
|
|
289
624
|
const exportedAs = objectMatch[1];
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
const idx = moduleExportsObjMatch.index + moduleExportsObjMatch[0].indexOf(exportedAs);
|
|
293
|
-
const pos = { line: 1, column: 1, index: idx };
|
|
294
|
-
local = {
|
|
295
|
-
file,
|
|
296
|
-
localName: exportedAs,
|
|
297
|
-
kind: SymbolKind.Function,
|
|
298
|
-
range: { start: pos, end: pos },
|
|
299
|
-
};
|
|
300
|
-
locals.push(local);
|
|
301
|
-
}
|
|
302
|
-
if (!exports.some((entry) => entry.type === "local" && entry.exportedAs === exportedAs)) {
|
|
303
|
-
exports.push({ type: "local", exportedAs, target: local });
|
|
304
|
-
}
|
|
625
|
+
const propertyIndex = objectStart + objectMatch.index + objectMatch[0].indexOf(exportedAs);
|
|
626
|
+
appendCommonJsFunction(exportedAs, propertyIndex);
|
|
305
627
|
}
|
|
306
628
|
}
|
|
307
629
|
export function collectLocalsAndExportsFromSource(file, source, support, imports = [], opts) {
|
|
308
630
|
if (isGraphOnlyLanguage(support.id)) {
|
|
309
631
|
return { file, exports: [], imports, locals: [] };
|
|
310
632
|
}
|
|
311
|
-
assertNativeRequiredAvailable(
|
|
633
|
+
assertNativeRequiredAvailable();
|
|
634
|
+
const nativeQueries = opts?.nativeQueries === undefined ? getNativeQueryExecution(source, support).results : opts.nativeQueries;
|
|
635
|
+
if (!nativeQueries)
|
|
636
|
+
return { file, exports: [], imports, locals: [] };
|
|
312
637
|
const normalizeDocstringLine = (line) => line.replace(/^\s*(?:\/\/\/?\s?|#\s?)/, "").replace(/^\s*\*\s?/, "");
|
|
313
638
|
const extractLeadingDocstring = (node) => {
|
|
314
639
|
if (!node)
|
|
@@ -385,7 +710,7 @@ export function collectLocalsAndExportsFromSource(file, source, support, imports
|
|
|
385
710
|
start: positionForIndex(start),
|
|
386
711
|
end: positionForIndex(end),
|
|
387
712
|
});
|
|
388
|
-
const buildSymbolDef = (localName, kind, range, node) => {
|
|
713
|
+
const buildSymbolDef = (localName, kind, range, node, callable) => {
|
|
389
714
|
let lineSpan;
|
|
390
715
|
if (typeof range.start.line === "number" &&
|
|
391
716
|
typeof range.end.line === "number" &&
|
|
@@ -403,9 +728,60 @@ export function collectLocalsAndExportsFromSource(file, source, support, imports
|
|
|
403
728
|
localName,
|
|
404
729
|
kind,
|
|
405
730
|
range,
|
|
731
|
+
...(kind === SymbolKind.Function
|
|
732
|
+
? {
|
|
733
|
+
callable: callable ??
|
|
734
|
+
callableIdentityForDeclaration({
|
|
735
|
+
file,
|
|
736
|
+
name: localName,
|
|
737
|
+
range,
|
|
738
|
+
languageId: support.id,
|
|
739
|
+
source,
|
|
740
|
+
...(node ? { node } : {}),
|
|
741
|
+
}),
|
|
742
|
+
}
|
|
743
|
+
: {}),
|
|
406
744
|
};
|
|
407
745
|
if (node && isTypeMemberDeclaration(node))
|
|
408
746
|
base.isMember = true;
|
|
747
|
+
const jvmOwner = node &&
|
|
748
|
+
(support.id === "java" || support.id === "kotlin") &&
|
|
749
|
+
(kind === SymbolKind.Class ||
|
|
750
|
+
kind === SymbolKind.Interface ||
|
|
751
|
+
(support.id === "java" && (kind === SymbolKind.TypeAlias || base.isMember)))
|
|
752
|
+
? enclosingJvmTypeDeclaration(node)
|
|
753
|
+
: undefined;
|
|
754
|
+
const jvmOwnerStartIndex = jvmOwner?.childForFieldName("name")?.startIndex;
|
|
755
|
+
if (jvmOwnerStartIndex !== undefined)
|
|
756
|
+
base.jvmTypeOwnerStartIndex = jvmOwnerStartIndex;
|
|
757
|
+
if (support.id === "java" && node && jvmOwner && base.isMember) {
|
|
758
|
+
const declaration = node.parent?.type === "variable_declarator" ? node.parent.parent : node.parent;
|
|
759
|
+
const implicitStatic = declaration?.type === "enum_declaration" ||
|
|
760
|
+
declaration?.type === "interface_declaration" ||
|
|
761
|
+
declaration?.type === "annotation_type_declaration" ||
|
|
762
|
+
declaration?.type === "enum_constant" ||
|
|
763
|
+
jvmOwner.type === "interface_declaration" ||
|
|
764
|
+
jvmOwner.type === "annotation_type_declaration";
|
|
765
|
+
const explicitStatic = declaration?.namedChildren.some((child) => child.type === "modifiers" && /\bstatic\b/u.test(child.text));
|
|
766
|
+
if (implicitStatic || explicitStatic)
|
|
767
|
+
base.jvmStaticMember = true;
|
|
768
|
+
}
|
|
769
|
+
if (support.id === "java" &&
|
|
770
|
+
node &&
|
|
771
|
+
(kind === SymbolKind.Class || kind === SymbolKind.Interface || kind === SymbolKind.TypeAlias || base.isMember)) {
|
|
772
|
+
if (base.isMember && isJavaProtectedDeclaration(node))
|
|
773
|
+
base.javaProtectedMember = true;
|
|
774
|
+
if (!isJavaPublicDeclaration(node) &&
|
|
775
|
+
jvmOwner?.type !== "interface_declaration" &&
|
|
776
|
+
jvmOwner?.type !== "annotation_type_declaration") {
|
|
777
|
+
base.javaPackagePrivate = true;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
if (support.id === "c" && node) {
|
|
781
|
+
const tagRole = cTagRole(node);
|
|
782
|
+
if (tagRole)
|
|
783
|
+
base.cTag = tagRole;
|
|
784
|
+
}
|
|
409
785
|
if (docstring)
|
|
410
786
|
base.docstring = docstring;
|
|
411
787
|
if (lineSpan)
|
|
@@ -414,29 +790,34 @@ export function collectLocalsAndExportsFromSource(file, source, support, imports
|
|
|
414
790
|
base.complexity = complexity;
|
|
415
791
|
return base;
|
|
416
792
|
};
|
|
417
|
-
const nativeQueries = opts?.nativeQueries ?? null;
|
|
418
793
|
let tree = opts?.tree ?? null;
|
|
419
794
|
let treeAttempted = !!tree;
|
|
420
|
-
//
|
|
421
|
-
// there is no grammar fallback; callers get reduced locals/exports instead.
|
|
795
|
+
// Syntax trees enrich successful native captures with declaration context and docstrings.
|
|
422
796
|
const ensureTree = () => {
|
|
423
797
|
if (tree || treeAttempted)
|
|
424
798
|
return tree;
|
|
425
799
|
treeAttempted = true;
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
tree = new ProjectedSyntaxTree(source, nativeTreeExecution.tree);
|
|
430
|
-
return tree;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
catch (error) {
|
|
434
|
-
if (isNativeRequiredUnavailableError(error))
|
|
435
|
-
throw error;
|
|
436
|
-
/* reduced mode: ignore */
|
|
437
|
-
}
|
|
800
|
+
const nativeTreeExecution = getNativeSyntaxTreeExecution(source, support);
|
|
801
|
+
if (nativeTreeExecution.tree)
|
|
802
|
+
tree = new ProjectedSyntaxTree(source, nativeTreeExecution.tree);
|
|
438
803
|
return tree;
|
|
439
804
|
};
|
|
805
|
+
const leadingDocstringAt = (index) => {
|
|
806
|
+
const root = ensureTree()?.rootNode;
|
|
807
|
+
if (!root || index < 0 || index >= source.length)
|
|
808
|
+
return undefined;
|
|
809
|
+
let node = root.descendantForIndex(index, index + 1);
|
|
810
|
+
if (node === root)
|
|
811
|
+
return undefined;
|
|
812
|
+
// Comments attach to the assignment statement or object member, not its function expression.
|
|
813
|
+
while (node.parent &&
|
|
814
|
+
node.parent.type !== "program" &&
|
|
815
|
+
node.parent.type !== "statement_block" &&
|
|
816
|
+
node.parent.type !== "object") {
|
|
817
|
+
node = node.parent;
|
|
818
|
+
}
|
|
819
|
+
return extractLeadingDocstring(node);
|
|
820
|
+
};
|
|
440
821
|
// Lazily build once: converts every native capture's UTF-8 byte offsets to UTF-16
|
|
441
822
|
// string indexes in O(1) per capture instead of rescanning the source per offset.
|
|
442
823
|
// `ensureTree()` builds the same map internally when native mode is active, so route
|
|
@@ -465,12 +846,12 @@ export function collectLocalsAndExportsFromSource(file, source, support, imports
|
|
|
465
846
|
return SymbolKind.TypeAlias;
|
|
466
847
|
return SymbolKind.Variable;
|
|
467
848
|
};
|
|
468
|
-
const pushLocal = (localName, kind, range, node) => {
|
|
849
|
+
const pushLocal = (localName, kind, range, node, callable) => {
|
|
469
850
|
const key = `${localName}:${range.start.index ?? 0}:${range.end.index ?? 0}`;
|
|
470
851
|
if (seenLocals.has(key))
|
|
471
852
|
return;
|
|
472
853
|
seenLocals.add(key);
|
|
473
|
-
locals.push(buildSymbolDef(localName, kind, range, node));
|
|
854
|
+
locals.push(buildSymbolDef(localName, kind, range, node, callable));
|
|
474
855
|
};
|
|
475
856
|
const symbolKindForDeclarationNode = (node) => {
|
|
476
857
|
if (node.type === "function_declaration" ||
|
|
@@ -522,6 +903,13 @@ export function collectLocalsAndExportsFromSource(file, source, support, imports
|
|
|
522
903
|
}
|
|
523
904
|
}
|
|
524
905
|
}
|
|
906
|
+
else if (node && phpPropertyPromotionParameter(node)) {
|
|
907
|
+
const promoted = phpConstructorPromotedVariable(node, source);
|
|
908
|
+
if (promoted) {
|
|
909
|
+
pushLocal(sliceText(promoted, source), SymbolKind.Variable, toRange(promoted), promoted);
|
|
910
|
+
capturedLocals = true;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
525
913
|
else {
|
|
526
914
|
pushLocal(capture.text, classifyLocalCapture(node), nativeRange, node);
|
|
527
915
|
}
|
|
@@ -536,16 +924,17 @@ export function collectLocalsAndExportsFromSource(file, source, support, imports
|
|
|
536
924
|
return false;
|
|
537
925
|
}
|
|
538
926
|
};
|
|
927
|
+
let scopeIndexForExports;
|
|
539
928
|
const usedQueryLocals = extractLocalsFromNativeQueries();
|
|
540
929
|
if (!usedQueryLocals) {
|
|
541
930
|
const scopeTree = ensureTree();
|
|
542
931
|
if (scopeTree) {
|
|
543
|
-
|
|
544
|
-
for (const b of
|
|
932
|
+
scopeIndexForExports = buildScopeIndexFromSource(file, source, support, imports, { tree: scopeTree });
|
|
933
|
+
for (const b of scopeIndexForExports.all) {
|
|
545
934
|
if (!b.def)
|
|
546
935
|
continue;
|
|
547
936
|
const kind = bindingKindToSymbolKind(b.kind);
|
|
548
|
-
pushLocal(b.name, kind, b.def, b.node);
|
|
937
|
+
pushLocal(b.name, kind, b.def, b.node, b.callable);
|
|
549
938
|
}
|
|
550
939
|
}
|
|
551
940
|
}
|
|
@@ -622,12 +1011,27 @@ export function collectLocalsAndExportsFromSource(file, source, support, imports
|
|
|
622
1011
|
const range = rangeFromNativeCapture(capture, ensureByteIndexMap());
|
|
623
1012
|
return treeForEnrichment.rootNode.descendantForIndex(range.start.index ?? 0, range.end.index ?? 0) ?? undefined;
|
|
624
1013
|
};
|
|
1014
|
+
const localVisibleAtCapture = (capture) => {
|
|
1015
|
+
const node = nodeForCapture(capture);
|
|
1016
|
+
if (!node || !treeForEnrichment)
|
|
1017
|
+
return undefined;
|
|
1018
|
+
scopeIndexForExports ??= buildScopeIndexFromSource(file, source, support, imports, { tree: treeForEnrichment });
|
|
1019
|
+
const binding = findClosestScopeBinding(scopeIndexForExports, capture.text, node, support);
|
|
1020
|
+
const definition = binding?.def;
|
|
1021
|
+
if (!definition)
|
|
1022
|
+
return undefined;
|
|
1023
|
+
return locals.find((local) => local.localName === binding.name &&
|
|
1024
|
+
local.range.start.index === definition.start.index &&
|
|
1025
|
+
local.range.end.index === definition.end.index);
|
|
1026
|
+
};
|
|
625
1027
|
const defaultDeclarationNameNode = (node) => {
|
|
626
1028
|
if (!node)
|
|
627
1029
|
return undefined;
|
|
628
1030
|
return (node.childForFieldName("name") ?? node.childForFieldName("declaration")?.childForFieldName("name") ?? undefined);
|
|
629
1031
|
};
|
|
630
1032
|
const hasDefaultExport = () => exports.some((entry) => entry.type === "local" && entry.exportedAs === "default");
|
|
1033
|
+
// A second `module.exports = X` makes the required value depend on control flow.
|
|
1034
|
+
let cjsModuleValueSeen = false;
|
|
631
1035
|
const excludedCaptures = [];
|
|
632
1036
|
for (const match of matches) {
|
|
633
1037
|
for (const capture of match.captures) {
|
|
@@ -800,6 +1204,25 @@ export function collectLocalsAndExportsFromSource(file, source, support, imports
|
|
|
800
1204
|
});
|
|
801
1205
|
continue;
|
|
802
1206
|
}
|
|
1207
|
+
if (map["cjs_module_value"]) {
|
|
1208
|
+
if (cjsModuleValueSeen) {
|
|
1209
|
+
const previous = exports.findIndex((entry) => entry.type === "local" && entry.exportedAs === "default" && entry.mechanism === "cjs-module-value");
|
|
1210
|
+
if (previous >= 0)
|
|
1211
|
+
exports.splice(previous, 1);
|
|
1212
|
+
continue;
|
|
1213
|
+
}
|
|
1214
|
+
cjsModuleValueSeen = true;
|
|
1215
|
+
const local = localVisibleAtCapture(map["cjs_module_value"]);
|
|
1216
|
+
if (local && !hasDefaultExport()) {
|
|
1217
|
+
exports.push({
|
|
1218
|
+
type: "local",
|
|
1219
|
+
exportedAs: "default",
|
|
1220
|
+
target: { ...local, kind: SymbolKind.Default },
|
|
1221
|
+
mechanism: "cjs-module-value",
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
continue;
|
|
1225
|
+
}
|
|
803
1226
|
if (map["cjs_shorthand"]) {
|
|
804
1227
|
const nameText = map["cjs_shorthand"].text;
|
|
805
1228
|
const local = locals.find((def) => def.localName === nameText);
|
|
@@ -823,9 +1246,19 @@ export function collectLocalsAndExportsFromSource(file, source, support, imports
|
|
|
823
1246
|
if (map["cjs_export_name"] && map["cjs_fn"]) {
|
|
824
1247
|
const exportedAs = map["cjs_export_name"].text;
|
|
825
1248
|
const fnNode = nodeForCapture(map["cjs_fn"]);
|
|
826
|
-
const
|
|
827
|
-
|
|
828
|
-
|
|
1249
|
+
const nameNode = fnNode?.childForFieldName("name");
|
|
1250
|
+
const range = nameNode ? toRange(nameNode) : rangeFromNativeCapture(map["cjs_fn"], ensureByteIndexMap());
|
|
1251
|
+
const existing = locals.find((def) => def.localName === exportedAs && def.range.start.index === range.start.index);
|
|
1252
|
+
const sym = existing ?? buildSymbolDef(exportedAs, SymbolKind.Function, range, nameNode ?? fnNode);
|
|
1253
|
+
if (!existing)
|
|
1254
|
+
locals.push(sym);
|
|
1255
|
+
const directModuleValue = exportedAs === "exports" && !!map["mod"] && !map["prop"];
|
|
1256
|
+
exports.push({
|
|
1257
|
+
type: "local",
|
|
1258
|
+
exportedAs,
|
|
1259
|
+
target: sym,
|
|
1260
|
+
...(directModuleValue ? { mechanism: "cjs-module-value" } : {}),
|
|
1261
|
+
});
|
|
829
1262
|
continue;
|
|
830
1263
|
}
|
|
831
1264
|
if (map["default"]) {
|
|
@@ -875,6 +1308,7 @@ export function collectLocalsAndExportsFromSource(file, source, support, imports
|
|
|
875
1308
|
type: "local",
|
|
876
1309
|
exportedAs: "default",
|
|
877
1310
|
target: { ...local, kind: SymbolKind.Default },
|
|
1311
|
+
mechanism: "ts-export-assignment",
|
|
878
1312
|
});
|
|
879
1313
|
}
|
|
880
1314
|
continue;
|
|
@@ -886,20 +1320,56 @@ export function collectLocalsAndExportsFromSource(file, source, support, imports
|
|
|
886
1320
|
const visibilityNameNode = nodeForCapture(nameCapture);
|
|
887
1321
|
if (visibilityNameNode && !isExportedDeclaration(support.id, visibilityNameNode))
|
|
888
1322
|
continue;
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
1323
|
+
let nameText = nameCapture.text;
|
|
1324
|
+
let nameRange = rangeFromNativeCapture(nameCapture, ensureByteIndexMap());
|
|
1325
|
+
if (map["declarator"]) {
|
|
1326
|
+
const namedNode = declaratorNameNode(visibilityNameNode);
|
|
1327
|
+
if (namedNode) {
|
|
1328
|
+
nameText = namedNode.text;
|
|
1329
|
+
nameRange = toRange(namedNode);
|
|
1330
|
+
}
|
|
1331
|
+
else {
|
|
1332
|
+
const extracted = cDeclaratorDeclaredName(nameCapture.text);
|
|
1333
|
+
if (!extracted)
|
|
1334
|
+
continue;
|
|
1335
|
+
nameText = extracted.name;
|
|
1336
|
+
const captureStart = nameRange.start.index ?? 0;
|
|
1337
|
+
nameRange = rangeFromOffsets(captureStart + extracted.start, captureStart + extracted.end);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
892
1340
|
if (!nameText)
|
|
893
1341
|
continue;
|
|
894
|
-
const local = locals.find((def) => def.localName === nameText
|
|
1342
|
+
const local = locals.find((def) => def.localName === nameText &&
|
|
1343
|
+
def.range.start.index === nameRange.start.index &&
|
|
1344
|
+
def.range.end.index === nameRange.end.index) ?? locals.find((def) => def.localName === nameText);
|
|
895
1345
|
if (local) {
|
|
896
1346
|
const isDefaultExport = /^\s*export\s+default\b/.test(stmtText);
|
|
1347
|
+
const qualifiedExportName = () => {
|
|
1348
|
+
if (!visibilityNameNode)
|
|
1349
|
+
return nameText;
|
|
1350
|
+
if (support.id === "cpp")
|
|
1351
|
+
return cppQualifiedExportName(visibilityNameNode, source, nameText);
|
|
1352
|
+
if (support.id === "ruby")
|
|
1353
|
+
return rubyQualifiedExportName(visibilityNameNode, source, nameText);
|
|
1354
|
+
return nameText;
|
|
1355
|
+
};
|
|
1356
|
+
const exportedName = qualifiedExportName();
|
|
897
1357
|
if (!isDefaultExport) {
|
|
898
1358
|
exports.push({
|
|
899
1359
|
type: "local",
|
|
900
|
-
exportedAs:
|
|
1360
|
+
exportedAs: exportedName,
|
|
901
1361
|
target: local,
|
|
902
1362
|
});
|
|
1363
|
+
if (support.id === "cpp" && visibilityNameNode && exportedName !== nameText) {
|
|
1364
|
+
const visibleAs = cppQualifiedExportName(visibilityNameNode, source, nameText, true);
|
|
1365
|
+
if (visibleAs !== exportedName) {
|
|
1366
|
+
exports.push({
|
|
1367
|
+
type: "local",
|
|
1368
|
+
exportedAs: visibleAs,
|
|
1369
|
+
target: local,
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
903
1373
|
}
|
|
904
1374
|
if (isDefaultExport && !hasDefaultExport()) {
|
|
905
1375
|
exports.push({
|
|
@@ -950,12 +1420,98 @@ export function collectLocalsAndExportsFromSource(file, source, support, imports
|
|
|
950
1420
|
throw error;
|
|
951
1421
|
}
|
|
952
1422
|
}
|
|
1423
|
+
if (support.id === "cpp") {
|
|
1424
|
+
const treeForUsingDeclarations = ensureTree();
|
|
1425
|
+
if (treeForUsingDeclarations) {
|
|
1426
|
+
const callableExports = new Map();
|
|
1427
|
+
let retainedCount = 0;
|
|
1428
|
+
for (const entry of exports) {
|
|
1429
|
+
if (entry.type === "local" && entry.target.kind === SymbolKind.Function) {
|
|
1430
|
+
const callable = entry.target.callable;
|
|
1431
|
+
if (callable?.signature) {
|
|
1432
|
+
const key = `${entry.exportedAs}\0${callable.signature}`;
|
|
1433
|
+
const isDefinition = callable.definition === true;
|
|
1434
|
+
const existing = callableExports.get(key);
|
|
1435
|
+
if (existing) {
|
|
1436
|
+
if (isDefinition && !existing.isDefinition) {
|
|
1437
|
+
exports[existing.index] = entry;
|
|
1438
|
+
existing.isDefinition = true;
|
|
1439
|
+
}
|
|
1440
|
+
continue;
|
|
1441
|
+
}
|
|
1442
|
+
callableExports.set(key, { index: retainedCount, isDefinition });
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
exports[retainedCount++] = entry;
|
|
1446
|
+
}
|
|
1447
|
+
exports.length = retainedCount;
|
|
1448
|
+
}
|
|
1449
|
+
const visitUsingDeclaration = (node) => {
|
|
1450
|
+
if (support.exportScopeBlockers.some((blocker) => matchesExportScopeBlocker(node, blocker)))
|
|
1451
|
+
return;
|
|
1452
|
+
if (node.type === "using_declaration") {
|
|
1453
|
+
const qualified = node.namedChildren.find((child) => child.type === "qualified_identifier") ??
|
|
1454
|
+
node.namedChildren
|
|
1455
|
+
.flatMap((child) => child.namedChildren)
|
|
1456
|
+
.find((child) => child.type === "qualified_identifier");
|
|
1457
|
+
if (qualified) {
|
|
1458
|
+
const importedSegments = cppQualifiedNameSegments(qualified, source);
|
|
1459
|
+
const importedName = importedSegments.join("::");
|
|
1460
|
+
const localName = importedSegments.at(-1);
|
|
1461
|
+
if (!localName)
|
|
1462
|
+
return;
|
|
1463
|
+
const exportedName = cppQualifiedExportName(node, source, localName);
|
|
1464
|
+
const exportedNames = [exportedName];
|
|
1465
|
+
if (exportedName !== localName) {
|
|
1466
|
+
const visibleAs = cppQualifiedExportName(node, source, localName, true);
|
|
1467
|
+
if (visibleAs !== exportedName)
|
|
1468
|
+
exportedNames.push(visibleAs);
|
|
1469
|
+
}
|
|
1470
|
+
const targets = exports.filter((entry) => entry.type === "local" && entry.exportedAs === importedName);
|
|
1471
|
+
for (const exportedAs of exportedNames) {
|
|
1472
|
+
// Included declarations are not available during per-file extraction.
|
|
1473
|
+
// Retain the qualified target for resolution against the completed index.
|
|
1474
|
+
for (const imp of imports) {
|
|
1475
|
+
if (imp.kind !== "star" || typeof imp.resolved !== "string")
|
|
1476
|
+
continue;
|
|
1477
|
+
exports.push({
|
|
1478
|
+
type: "reexport",
|
|
1479
|
+
exportedAs,
|
|
1480
|
+
fromModule: imp.resolved,
|
|
1481
|
+
sourceSpecifier: importedName,
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
for (const target of targets) {
|
|
1485
|
+
if (exports.some((entry) => entry.type === "local" &&
|
|
1486
|
+
entry.exportedAs === exportedAs &&
|
|
1487
|
+
entry.target.range.start.index === target.target.range.start.index)) {
|
|
1488
|
+
continue;
|
|
1489
|
+
}
|
|
1490
|
+
exports.push({
|
|
1491
|
+
type: "local",
|
|
1492
|
+
exportedAs,
|
|
1493
|
+
target: target.target,
|
|
1494
|
+
});
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
return;
|
|
1499
|
+
}
|
|
1500
|
+
for (const child of node.namedChildren)
|
|
1501
|
+
visitUsingDeclaration(child);
|
|
1502
|
+
};
|
|
1503
|
+
if (treeForUsingDeclarations)
|
|
1504
|
+
visitUsingDeclaration(treeForUsingDeclarations.rootNode);
|
|
1505
|
+
}
|
|
953
1506
|
// The native query does not cover CommonJS member assignments and some
|
|
954
1507
|
// re-export forms. Always run the deduplicating fallback for JS-like files:
|
|
955
1508
|
// source-form probes are too error-prone to risk silently dropping exports.
|
|
956
1509
|
const isJsLike = support.id === "ts" || support.id === "tsx" || support.id === "js";
|
|
1510
|
+
// Comment- and string-masked JS-like source, shared by the export fallbacks below.
|
|
1511
|
+
let jsMaskedSource;
|
|
1512
|
+
const maskedJsSource = () => (jsMaskedSource ??= maskJsLikeCommentsAndStrings(source));
|
|
957
1513
|
if (isJsLike) {
|
|
958
|
-
appendJsLikeRegexFallbackExports(file, source, locals, exports);
|
|
1514
|
+
appendJsLikeRegexFallbackExports(file, source, locals, exports, leadingDocstringAt, ensureTree(), maskedJsSource());
|
|
959
1515
|
}
|
|
960
1516
|
if (support.id === "python") {
|
|
961
1517
|
for (const binding of imports) {
|
|
@@ -1012,7 +1568,7 @@ export function collectLocalsAndExportsFromSource(file, source, support, imports
|
|
|
1012
1568
|
}
|
|
1013
1569
|
if ((support.id === "ts" || support.id === "tsx" || support.id === "js") &&
|
|
1014
1570
|
!exports.some((e) => e.type === "local" && e.exportedAs === "default")) {
|
|
1015
|
-
const maskedSource =
|
|
1571
|
+
const maskedSource = maskedJsSource();
|
|
1016
1572
|
const defFn = JS_DEFAULT_FUNCTION_PATTERN.exec(maskedSource);
|
|
1017
1573
|
const defCls = JS_DEFAULT_CLASS_PATTERN.exec(maskedSource);
|
|
1018
1574
|
const defIdent = JS_DEFAULT_IDENTIFIER_PATTERN.exec(maskedSource);
|
|
@@ -1040,6 +1596,31 @@ export function collectLocalsAndExportsFromSource(file, source, support, imports
|
|
|
1040
1596
|
}
|
|
1041
1597
|
}
|
|
1042
1598
|
}
|
|
1043
|
-
|
|
1599
|
+
// Complete CommonJS callables discovered after native local collection.
|
|
1600
|
+
if (isJsLike) {
|
|
1601
|
+
for (const local of locals) {
|
|
1602
|
+
if (local.kind !== SymbolKind.Function || local.callable)
|
|
1603
|
+
continue;
|
|
1604
|
+
const start = local.range.start.index;
|
|
1605
|
+
const node = start === undefined ? undefined : tree?.rootNode.descendantForIndex(start, local.range.end.index ?? start);
|
|
1606
|
+
local.callable = callableIdentityForDeclaration({
|
|
1607
|
+
file,
|
|
1608
|
+
name: local.localName,
|
|
1609
|
+
range: local.range,
|
|
1610
|
+
languageId: support.id,
|
|
1611
|
+
source,
|
|
1612
|
+
...(node ? { node } : {}),
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
if (support.id === "cpp")
|
|
1617
|
+
propagateCppInternalLinkage(file, locals);
|
|
1618
|
+
return {
|
|
1619
|
+
file,
|
|
1620
|
+
exports: dedupeExportEntries(collapseTypeScriptCallableExports(exports, support.id), support.id),
|
|
1621
|
+
imports,
|
|
1622
|
+
locals,
|
|
1623
|
+
...(tree && DOCSTRING_CAPTURE_LANGUAGES.has(support.id) ? { docstringsChecked: true } : {}),
|
|
1624
|
+
};
|
|
1044
1625
|
}
|
|
1045
1626
|
//# sourceMappingURL=locals-and-exports.js.map
|