gitnexus 1.6.6-rc.99 → 1.6.6
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 +122 -68
- package/dist/_shared/graph/types.d.ts +17 -1
- package/dist/_shared/graph/types.d.ts.map +1 -1
- package/dist/_shared/index.d.ts +3 -5
- package/dist/_shared/index.d.ts.map +1 -1
- package/dist/_shared/index.js +2 -4
- package/dist/_shared/index.js.map +1 -1
- package/dist/_shared/scope-resolution/module-scope-index.d.ts +1 -2
- package/dist/_shared/scope-resolution/module-scope-index.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/module-scope-index.js +1 -2
- package/dist/_shared/scope-resolution/module-scope-index.js.map +1 -1
- package/dist/_shared/scope-resolution/parsed-file.d.ts +24 -0
- package/dist/_shared/scope-resolution/parsed-file.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/reference-site.d.ts +13 -1
- package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/context.d.ts +1 -0
- package/dist/_shared/scope-resolution/registries/context.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/context.js +6 -0
- package/dist/_shared/scope-resolution/registries/context.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/evidence.d.ts +2 -3
- package/dist/_shared/scope-resolution/registries/evidence.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/evidence.js +2 -3
- package/dist/_shared/scope-resolution/registries/evidence.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/macro-registry.d.ts +29 -0
- package/dist/_shared/scope-resolution/registries/macro-registry.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/macro-registry.js +32 -0
- package/dist/_shared/scope-resolution/registries/macro-registry.js.map +1 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts +9 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/types.d.ts +1 -1
- package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
- package/dist/cli/ai-context.d.ts +35 -1
- package/dist/cli/ai-context.js +111 -12
- package/dist/cli/analyze-config.d.ts +92 -0
- package/dist/cli/analyze-config.js +364 -0
- package/dist/cli/analyze.d.ts +17 -1
- package/dist/cli/analyze.js +224 -71
- package/dist/cli/cli-message.d.ts +1 -1
- package/dist/cli/doctor.d.ts +18 -0
- package/dist/cli/doctor.js +32 -0
- package/dist/cli/i18n/en.d.ts +2 -2
- package/dist/cli/i18n/en.js +2 -2
- package/dist/cli/i18n/resources.d.ts +2 -2
- package/dist/cli/i18n/zh-CN.js +2 -2
- package/dist/cli/index.js +4 -2
- package/dist/cli/resolve-invocation.d.ts +21 -0
- package/dist/cli/resolve-invocation.js +68 -0
- package/dist/cli/setup.d.ts +33 -0
- package/dist/cli/setup.js +96 -35
- package/dist/cli/skill-gen.js +2 -2
- package/dist/cli/wiki.js +20 -4
- package/dist/core/embeddings/embedder.d.ts +1 -1
- package/dist/core/embeddings/embedder.js +14 -1
- package/dist/core/embeddings/runtime-support.d.ts +41 -0
- package/dist/core/embeddings/runtime-support.js +65 -0
- package/dist/core/group/extractors/grpc-patterns/proto.js +2 -1
- package/dist/core/group/extractors/http-patterns/java.js +15 -1
- package/dist/core/ingestion/call-processor.d.ts +57 -227
- package/dist/core/ingestion/call-processor.js +172 -2595
- package/dist/core/ingestion/call-routing.d.ts +6 -5
- package/dist/core/ingestion/call-routing.js +6 -6
- package/dist/core/ingestion/call-types.d.ts +0 -75
- package/dist/core/ingestion/class-extractors/configs/c-cpp.js +26 -1
- package/dist/core/ingestion/class-extractors/configs/ruby.js +3 -0
- package/dist/core/ingestion/class-extractors/generic.js +9 -11
- package/dist/core/ingestion/class-types.d.ts +23 -0
- package/dist/core/ingestion/cobol/cobol-preprocessor.d.ts +11 -0
- package/dist/core/ingestion/cobol/cobol-preprocessor.js +227 -73
- package/dist/core/ingestion/cobol-processor.d.ts +1 -0
- package/dist/core/ingestion/cobol-processor.js +51 -2
- package/dist/core/ingestion/emit-references.js +8 -2
- package/dist/core/ingestion/export-detection.d.ts +2 -1
- package/dist/core/ingestion/export-detection.js +2 -6
- package/dist/core/ingestion/field-extractors/configs/dart.d.ts +0 -6
- package/dist/core/ingestion/field-extractors/configs/dart.js +62 -44
- package/dist/core/ingestion/field-extractors/configs/go.d.ts +0 -9
- package/dist/core/ingestion/field-extractors/configs/go.js +40 -1
- package/dist/core/ingestion/field-extractors/configs/jvm.js +43 -4
- package/dist/core/ingestion/field-extractors/configs/php.js +1 -2
- package/dist/core/ingestion/field-extractors/configs/swift.d.ts +12 -1
- package/dist/core/ingestion/field-extractors/configs/swift.js +31 -6
- package/dist/core/ingestion/field-extractors/generic.d.ts +6 -0
- package/dist/core/ingestion/field-extractors/generic.js +5 -4
- package/dist/core/ingestion/field-extractors/typescript.js +0 -29
- package/dist/core/ingestion/filesystem-walker.d.ts +0 -9
- package/dist/core/ingestion/filesystem-walker.js +0 -11
- package/dist/core/ingestion/finalize-orchestrator.js +14 -2
- package/dist/core/ingestion/import-resolvers/configs/swift.d.ts +21 -0
- package/dist/core/ingestion/import-resolvers/configs/swift.js +72 -11
- package/dist/core/ingestion/import-resolvers/python.d.ts +1 -1
- package/dist/core/ingestion/import-resolvers/standard.d.ts +2 -2
- package/dist/core/ingestion/import-resolvers/standard.js +6 -5
- package/dist/core/ingestion/import-resolvers/utils.d.ts +2 -5
- package/dist/core/ingestion/import-resolvers/utils.js +1 -9
- package/dist/core/ingestion/language-provider.d.ts +39 -119
- package/dist/core/ingestion/language-provider.js +0 -2
- package/dist/core/ingestion/languages/c/capture-side-channel.d.ts +62 -0
- package/dist/core/ingestion/languages/c/capture-side-channel.js +65 -0
- package/dist/core/ingestion/languages/c/captures.js +41 -23
- package/dist/core/ingestion/languages/c/import-decomposer.d.ts +9 -0
- package/dist/core/ingestion/languages/c/import-decomposer.js +15 -0
- package/dist/core/ingestion/languages/c/import-target.js +52 -9
- package/dist/core/ingestion/languages/c/index.d.ts +2 -1
- package/dist/core/ingestion/languages/c/index.js +2 -1
- package/dist/core/ingestion/languages/c/query.js +15 -0
- package/dist/core/ingestion/languages/c/scope-resolver.js +47 -4
- package/dist/core/ingestion/languages/c/static-linkage.d.ts +8 -0
- package/dist/core/ingestion/languages/c/static-linkage.js +46 -1
- package/dist/core/ingestion/languages/c-cpp.js +16 -7
- package/dist/core/ingestion/languages/cobol/captures.js +25 -2
- package/dist/core/ingestion/languages/cpp/adl.d.ts +88 -4
- package/dist/core/ingestion/languages/cpp/adl.js +380 -160
- package/dist/core/ingestion/languages/cpp/arity-metadata.js +2 -8
- package/dist/core/ingestion/languages/cpp/capture-side-channel.d.ts +65 -0
- package/dist/core/ingestion/languages/cpp/capture-side-channel.js +78 -0
- package/dist/core/ingestion/languages/cpp/captures.js +162 -54
- package/dist/core/ingestion/languages/cpp/file-local-linkage.d.ts +18 -52
- package/dist/core/ingestion/languages/cpp/file-local-linkage.js +49 -1
- package/dist/core/ingestion/languages/cpp/import-decomposer.d.ts +7 -0
- package/dist/core/ingestion/languages/cpp/import-decomposer.js +12 -0
- package/dist/core/ingestion/languages/cpp/index.d.ts +1 -0
- package/dist/core/ingestion/languages/cpp/index.js +1 -0
- package/dist/core/ingestion/languages/cpp/inline-namespaces.d.ts +8 -0
- package/dist/core/ingestion/languages/cpp/inline-namespaces.js +21 -0
- package/dist/core/ingestion/languages/cpp/query.js +21 -0
- package/dist/core/ingestion/languages/cpp/range-bindings.js +20 -5
- package/dist/core/ingestion/languages/cpp/scope-resolver.js +52 -5
- package/dist/core/ingestion/languages/cpp/two-phase-lookup.d.ts +20 -0
- package/dist/core/ingestion/languages/cpp/two-phase-lookup.js +83 -3
- package/dist/core/ingestion/languages/csharp/captures.js +205 -41
- package/dist/core/ingestion/languages/csharp/index.d.ts +3 -4
- package/dist/core/ingestion/languages/csharp/index.js +3 -4
- package/dist/core/ingestion/languages/csharp/interpret.js +17 -3
- package/dist/core/ingestion/languages/csharp/namespace-siblings.d.ts +17 -7
- package/dist/core/ingestion/languages/csharp/namespace-siblings.js +129 -124
- package/dist/core/ingestion/languages/csharp/qualified-type-names.d.ts +14 -0
- package/dist/core/ingestion/languages/csharp/qualified-type-names.js +59 -0
- package/dist/core/ingestion/languages/csharp/query.js +13 -0
- package/dist/core/ingestion/languages/csharp/receiver-binding.js +10 -6
- package/dist/core/ingestion/languages/csharp/scope-resolver.js +8 -1
- package/dist/core/ingestion/languages/csharp.js +0 -5
- package/dist/core/ingestion/languages/dart/arity-metadata.d.ts +25 -0
- package/dist/core/ingestion/languages/dart/arity-metadata.js +35 -0
- package/dist/core/ingestion/languages/dart/arity.d.ts +19 -0
- package/dist/core/ingestion/languages/dart/arity.js +31 -0
- package/dist/core/ingestion/languages/dart/built-ins.d.ts +11 -0
- package/dist/core/ingestion/languages/dart/built-ins.js +34 -0
- package/dist/core/ingestion/languages/dart/cache-stats.d.ts +13 -0
- package/dist/core/ingestion/languages/dart/cache-stats.js +24 -0
- package/dist/core/ingestion/languages/dart/captures.d.ts +29 -0
- package/dist/core/ingestion/languages/dart/captures.js +445 -0
- package/dist/core/ingestion/languages/dart/expand-wildcards.d.ts +13 -0
- package/dist/core/ingestion/languages/dart/expand-wildcards.js +31 -0
- package/dist/core/ingestion/languages/dart/import-target.d.ts +15 -0
- package/dist/core/ingestion/languages/dart/import-target.js +65 -0
- package/dist/core/ingestion/languages/dart/index.d.ts +28 -0
- package/dist/core/ingestion/languages/dart/index.js +28 -0
- package/dist/core/ingestion/languages/dart/interpret.d.ts +24 -0
- package/dist/core/ingestion/languages/dart/interpret.js +95 -0
- package/dist/core/ingestion/languages/dart/merge-bindings.d.ts +10 -0
- package/dist/core/ingestion/languages/dart/merge-bindings.js +39 -0
- package/dist/core/ingestion/languages/dart/query.d.ts +26 -0
- package/dist/core/ingestion/languages/dart/query.js +142 -0
- package/dist/core/ingestion/languages/dart/receiver-binding.d.ts +24 -0
- package/dist/core/ingestion/languages/dart/receiver-binding.js +87 -0
- package/dist/core/ingestion/languages/dart/scope-resolver.d.ts +29 -0
- package/dist/core/ingestion/languages/dart/scope-resolver.js +194 -0
- package/dist/core/ingestion/languages/dart/signature-bindings.d.ts +23 -0
- package/dist/core/ingestion/languages/dart/signature-bindings.js +51 -0
- package/dist/core/ingestion/languages/dart/simple-hooks.d.ts +20 -0
- package/dist/core/ingestion/languages/dart/simple-hooks.js +47 -0
- package/dist/core/ingestion/languages/dart.d.ts +0 -1
- package/dist/core/ingestion/languages/dart.js +15 -29
- package/dist/core/ingestion/languages/go/arity-metadata.d.ts +1 -0
- package/dist/core/ingestion/languages/go/arity-metadata.js +31 -1
- package/dist/core/ingestion/languages/go/captures.js +162 -3
- package/dist/core/ingestion/languages/go/interface-impls.js +476 -50
- package/dist/core/ingestion/languages/go/interpret.js +21 -11
- package/dist/core/ingestion/languages/go/method-owners.js +20 -8
- package/dist/core/ingestion/languages/go/query.js +15 -7
- package/dist/core/ingestion/languages/go/range-binding.js +24 -9
- package/dist/core/ingestion/languages/go/receiver-binding.js +1 -1
- package/dist/core/ingestion/languages/go/scope-resolver.js +2 -2
- package/dist/core/ingestion/languages/go/simple-hooks.js +10 -5
- package/dist/core/ingestion/languages/go/type-binding.d.ts +1 -0
- package/dist/core/ingestion/languages/go/type-binding.js +40 -2
- package/dist/core/ingestion/languages/go.d.ts +0 -1
- package/dist/core/ingestion/languages/go.js +0 -5
- package/dist/core/ingestion/languages/index.d.ts +0 -5
- package/dist/core/ingestion/languages/index.js +0 -3
- package/dist/core/ingestion/languages/java/captures.js +252 -23
- package/dist/core/ingestion/languages/java/interpret.js +12 -6
- package/dist/core/ingestion/languages/java/package-siblings.js +18 -5
- package/dist/core/ingestion/languages/java/query.js +16 -1
- package/dist/core/ingestion/languages/java/scope-resolver.d.ts +2 -8
- package/dist/core/ingestion/languages/java/scope-resolver.js +2 -8
- package/dist/core/ingestion/languages/java.js +0 -5
- package/dist/core/ingestion/languages/javascript/captures.js +185 -11
- package/dist/core/ingestion/languages/javascript/query.js +107 -1
- package/dist/core/ingestion/languages/kotlin/capture-side-channel.d.ts +57 -0
- package/dist/core/ingestion/languages/kotlin/capture-side-channel.js +60 -0
- package/dist/core/ingestion/languages/kotlin/captures.js +213 -22
- package/dist/core/ingestion/languages/kotlin/companion-scopes.d.ts +7 -0
- package/dist/core/ingestion/languages/kotlin/companion-scopes.js +10 -0
- package/dist/core/ingestion/languages/kotlin/index.d.ts +1 -0
- package/dist/core/ingestion/languages/kotlin/index.js +1 -0
- package/dist/core/ingestion/languages/kotlin/query.js +30 -0
- package/dist/core/ingestion/languages/kotlin/scope-resolver.d.ts +5 -7
- package/dist/core/ingestion/languages/kotlin/scope-resolver.js +22 -7
- package/dist/core/ingestion/languages/kotlin.js +8 -5
- package/dist/core/ingestion/languages/php/captures.js +135 -19
- package/dist/core/ingestion/languages/php/import-decomposer.js +21 -63
- package/dist/core/ingestion/languages/php/index.d.ts +3 -4
- package/dist/core/ingestion/languages/php/index.js +3 -4
- package/dist/core/ingestion/languages/php/query.js +5 -0
- package/dist/core/ingestion/languages/php/receiver-binding.js +8 -4
- package/dist/core/ingestion/languages/php.js +0 -4
- package/dist/core/ingestion/languages/python/captures.js +128 -13
- package/dist/core/ingestion/languages/python/depends-references.js +1 -1
- package/dist/core/ingestion/languages/python/import-target.d.ts +4 -5
- package/dist/core/ingestion/languages/python/import-target.js +108 -16
- package/dist/core/ingestion/languages/python/index-stats.d.ts +18 -0
- package/dist/core/ingestion/languages/python/index-stats.js +25 -0
- package/dist/core/ingestion/languages/python/index.d.ts +3 -4
- package/dist/core/ingestion/languages/python/index.js +3 -4
- package/dist/core/ingestion/languages/python/query.js +17 -0
- package/dist/core/ingestion/languages/python/scope-resolver.js +7 -6
- package/dist/core/ingestion/languages/python.d.ts +0 -2
- package/dist/core/ingestion/languages/python.js +0 -7
- package/dist/core/ingestion/languages/ruby/captures.js +174 -31
- package/dist/core/ingestion/languages/ruby/import-target.js +2 -1
- package/dist/core/ingestion/languages/ruby/interpret.js +2 -1
- package/dist/core/ingestion/languages/ruby/query.js +10 -0
- package/dist/core/ingestion/languages/ruby/scope-resolver.js +61 -11
- package/dist/core/ingestion/languages/ruby.js +4 -53
- package/dist/core/ingestion/languages/rust/captures.js +95 -13
- package/dist/core/ingestion/languages/rust/query.js +64 -1
- package/dist/core/ingestion/languages/rust/range-binding.js +40 -12
- package/dist/core/ingestion/languages/rust/receiver-binding.js +9 -0
- package/dist/core/ingestion/languages/rust/scope-resolver.js +75 -1
- package/dist/core/ingestion/languages/rust.d.ts +0 -2
- package/dist/core/ingestion/languages/rust.js +0 -6
- package/dist/core/ingestion/languages/swift/arity-metadata.d.ts +24 -0
- package/dist/core/ingestion/languages/swift/arity-metadata.js +41 -0
- package/dist/core/ingestion/languages/swift/arity.d.ts +29 -0
- package/dist/core/ingestion/languages/swift/arity.js +42 -0
- package/dist/core/ingestion/languages/swift/base-type.d.ts +20 -0
- package/dist/core/ingestion/languages/swift/base-type.js +27 -0
- package/dist/core/ingestion/languages/swift/cache-stats.d.ts +15 -0
- package/dist/core/ingestion/languages/swift/cache-stats.js +26 -0
- package/dist/core/ingestion/languages/swift/captures.d.ts +35 -0
- package/dist/core/ingestion/languages/swift/captures.js +495 -0
- package/dist/core/ingestion/languages/swift/implicit-imports.d.ts +34 -0
- package/dist/core/ingestion/languages/swift/implicit-imports.js +57 -0
- package/dist/core/ingestion/languages/swift/import-decomposer.d.ts +24 -0
- package/dist/core/ingestion/languages/swift/import-decomposer.js +84 -0
- package/dist/core/ingestion/languages/swift/import-target.d.ts +33 -0
- package/dist/core/ingestion/languages/swift/import-target.js +81 -0
- package/dist/core/ingestion/languages/swift/index.d.ts +37 -0
- package/dist/core/ingestion/languages/swift/index.js +37 -0
- package/dist/core/ingestion/languages/swift/interpret.d.ts +15 -0
- package/dist/core/ingestion/languages/swift/interpret.js +89 -0
- package/dist/core/ingestion/languages/swift/merge-bindings.d.ts +20 -0
- package/dist/core/ingestion/languages/swift/merge-bindings.js +48 -0
- package/dist/core/ingestion/languages/swift/query.d.ts +46 -0
- package/dist/core/ingestion/languages/swift/query.js +194 -0
- package/dist/core/ingestion/languages/swift/receiver-binding.d.ts +40 -0
- package/dist/core/ingestion/languages/swift/receiver-binding.js +161 -0
- package/dist/core/ingestion/languages/swift/scope-resolver.d.ts +50 -0
- package/dist/core/ingestion/languages/swift/scope-resolver.js +189 -0
- package/dist/core/ingestion/languages/swift/sibling-type-bindings.d.ts +34 -0
- package/dist/core/ingestion/languages/swift/sibling-type-bindings.js +65 -0
- package/dist/core/ingestion/languages/swift/signature-bindings.d.ts +25 -0
- package/dist/core/ingestion/languages/swift/signature-bindings.js +66 -0
- package/dist/core/ingestion/languages/swift/simple-hooks.d.ts +37 -0
- package/dist/core/ingestion/languages/swift/simple-hooks.js +60 -0
- package/dist/core/ingestion/languages/swift/target-grouping.d.ts +51 -0
- package/dist/core/ingestion/languages/swift/target-grouping.js +93 -0
- package/dist/core/ingestion/languages/swift/target-siblings.d.ts +30 -0
- package/dist/core/ingestion/languages/swift/target-siblings.js +71 -0
- package/dist/core/ingestion/languages/swift.d.ts +0 -5
- package/dist/core/ingestion/languages/swift.js +11 -87
- package/dist/core/ingestion/languages/typescript/array-callback.d.ts +3 -29
- package/dist/core/ingestion/languages/typescript/array-callback.js +4 -43
- package/dist/core/ingestion/languages/typescript/captures.js +147 -17
- package/dist/core/ingestion/languages/typescript/index.d.ts +3 -4
- package/dist/core/ingestion/languages/typescript/index.js +3 -4
- package/dist/core/ingestion/languages/typescript/query.d.ts +2 -3
- package/dist/core/ingestion/languages/typescript/query.js +125 -4
- package/dist/core/ingestion/languages/typescript/receiver-binding.js +0 -1
- package/dist/core/ingestion/languages/typescript.d.ts +2 -3
- package/dist/core/ingestion/languages/typescript.js +46 -23
- package/dist/core/ingestion/languages/vue/captures.d.ts +46 -0
- package/dist/core/ingestion/languages/vue/captures.js +67 -0
- package/dist/core/ingestion/languages/vue/import-target.d.ts +27 -0
- package/dist/core/ingestion/languages/vue/import-target.js +58 -0
- package/dist/core/ingestion/languages/vue/index.d.ts +49 -0
- package/dist/core/ingestion/languages/vue/index.js +49 -0
- package/dist/core/ingestion/languages/vue/scope-resolver.d.ts +55 -0
- package/dist/core/ingestion/languages/vue/scope-resolver.js +292 -0
- package/dist/core/ingestion/languages/vue.js +12 -4
- package/dist/core/ingestion/local-symbol-pruner.d.ts +11 -0
- package/dist/core/ingestion/local-symbol-pruner.js +63 -0
- package/dist/core/ingestion/method-extractors/configs/dart.js +14 -1
- package/dist/core/ingestion/method-extractors/configs/jvm.js +37 -20
- package/dist/core/ingestion/method-extractors/configs/php.js +0 -1
- package/dist/core/ingestion/method-extractors/configs/swift.js +11 -4
- package/dist/core/ingestion/method-types.d.ts +2 -2
- package/dist/core/ingestion/model/index.d.ts +0 -3
- package/dist/core/ingestion/model/index.js +0 -8
- package/dist/core/ingestion/model/resolve.d.ts +7 -43
- package/dist/core/ingestion/model/resolve.js +7 -226
- package/dist/core/ingestion/model/scope-resolution-indexes.d.ts +46 -1
- package/dist/core/ingestion/model/semantic-model.d.ts +4 -6
- package/dist/core/ingestion/model/semantic-model.js +1 -1
- package/dist/core/ingestion/model/symbol-table.d.ts +3 -4
- package/dist/core/ingestion/model/symbol-table.js +3 -4
- package/dist/core/ingestion/parsing-processor.d.ts +30 -24
- package/dist/core/ingestion/parsing-processor.js +76 -640
- package/dist/core/ingestion/pipeline-phases/communities.d.ts +1 -1
- package/dist/core/ingestion/pipeline-phases/communities.js +5 -2
- package/dist/core/ingestion/pipeline-phases/cross-file.d.ts +9 -8
- package/dist/core/ingestion/pipeline-phases/cross-file.js +16 -12
- package/dist/core/ingestion/pipeline-phases/index.d.ts +1 -0
- package/dist/core/ingestion/pipeline-phases/index.js +1 -0
- package/dist/core/ingestion/pipeline-phases/mro.d.ts +1 -1
- package/dist/core/ingestion/pipeline-phases/mro.js +2 -2
- package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +44 -22
- package/dist/core/ingestion/pipeline-phases/parse-impl.js +426 -565
- package/dist/core/ingestion/pipeline-phases/parse.d.ts +13 -33
- package/dist/core/ingestion/pipeline-phases/parse.js +2 -2
- package/dist/core/ingestion/pipeline-phases/processes.d.ts +1 -1
- package/dist/core/ingestion/pipeline-phases/processes.js +5 -3
- package/dist/core/ingestion/pipeline-phases/prune-local-symbols.d.ts +14 -0
- package/dist/core/ingestion/pipeline-phases/prune-local-symbols.js +26 -0
- package/dist/core/ingestion/pipeline.d.ts +27 -19
- package/dist/core/ingestion/pipeline.js +4 -2
- package/dist/core/ingestion/resolve-references.js +15 -3
- package/dist/core/ingestion/route-extractors/laravel.d.ts +10 -0
- package/dist/core/ingestion/route-extractors/laravel.js +88 -9
- package/dist/core/ingestion/scope-extractor-bridge.d.ts +2 -1
- package/dist/core/ingestion/scope-extractor-bridge.js +2 -2
- package/dist/core/ingestion/scope-extractor.js +13 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +181 -15
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.js +21 -10
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.js +10 -2
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.d.ts +7 -1
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +58 -6
- package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +24 -5
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +68 -1
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +189 -29
- package/dist/core/ingestion/scope-resolution/passes/imported-return-types.js +21 -1
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +1 -1
- package/dist/core/ingestion/scope-resolution/pipeline/phase.d.ts +8 -11
- package/dist/core/ingestion/scope-resolution/pipeline/phase.js +171 -50
- package/dist/core/ingestion/scope-resolution/pipeline/registry.d.ts +3 -4
- package/dist/core/ingestion/scope-resolution/pipeline/registry.js +9 -4
- package/dist/core/ingestion/scope-resolution/pipeline/run.d.ts +28 -5
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +191 -24
- package/dist/core/ingestion/scope-resolution/pipeline/validate-bindings-immutability.js +31 -0
- package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +72 -0
- package/dist/core/ingestion/scope-resolution/scope/walkers.js +440 -39
- package/dist/core/ingestion/scope-resolution/workspace-index.d.ts +18 -2
- package/dist/core/ingestion/scope-resolution/workspace-index.js +94 -7
- package/dist/core/ingestion/tree-sitter-queries.d.ts +14 -14
- package/dist/core/ingestion/tree-sitter-queries.js +380 -158
- package/dist/core/ingestion/ts-js-hoc-utils.d.ts +12 -0
- package/dist/core/ingestion/ts-js-hoc-utils.js +105 -0
- package/dist/core/ingestion/type-env.d.ts +2 -1
- package/dist/core/ingestion/type-env.js +6 -8
- package/dist/core/ingestion/type-extractors/c-cpp.js +8 -10
- package/dist/core/ingestion/type-extractors/csharp.js +18 -34
- package/dist/core/ingestion/type-extractors/go.js +2 -10
- package/dist/core/ingestion/type-extractors/jvm.js +6 -5
- package/dist/core/ingestion/type-extractors/php.js +1 -1
- package/dist/core/ingestion/type-extractors/python.js +1 -1
- package/dist/core/ingestion/type-extractors/ruby.js +2 -2
- package/dist/core/ingestion/type-extractors/rust.js +0 -16
- package/dist/core/ingestion/type-extractors/shared.d.ts +2 -2
- package/dist/core/ingestion/type-extractors/shared.js +25 -11
- package/dist/core/ingestion/type-extractors/swift.js +5 -5
- package/dist/core/ingestion/type-extractors/types.d.ts +1 -1
- package/dist/core/ingestion/type-extractors/typescript.js +1 -1
- package/dist/core/ingestion/utils/ast-helpers.d.ts +119 -1
- package/dist/core/ingestion/utils/ast-helpers.js +260 -13
- package/dist/core/ingestion/utils/callable-labels.d.ts +13 -0
- package/dist/core/ingestion/utils/callable-labels.js +14 -0
- package/dist/core/ingestion/utils/deferred-resolution-profile.d.ts +10 -0
- package/dist/core/ingestion/utils/deferred-resolution-profile.js +30 -0
- package/dist/core/ingestion/utils/heap-probe.d.ts +20 -0
- package/dist/core/ingestion/utils/heap-probe.js +39 -0
- package/dist/core/ingestion/utils/heritage-marker.d.ts +33 -0
- package/dist/core/ingestion/utils/heritage-marker.js +41 -0
- package/dist/core/ingestion/utils/qualified-name.d.ts +37 -0
- package/dist/core/ingestion/utils/qualified-name.js +67 -0
- package/dist/core/ingestion/variable-extractors/configs/c-cpp.js +49 -0
- package/dist/core/ingestion/variable-extractors/configs/dart.js +76 -62
- package/dist/core/ingestion/variable-extractors/configs/go.js +74 -7
- package/dist/core/ingestion/variable-extractors/configs/jvm.js +35 -8
- package/dist/core/ingestion/variable-extractors/generic.js +40 -12
- package/dist/core/ingestion/variable-types.d.ts +9 -0
- package/dist/core/ingestion/vue-sfc-extractor.d.ts +97 -7
- package/dist/core/ingestion/vue-sfc-extractor.js +433 -11
- package/dist/core/ingestion/workers/parse-worker.d.ts +0 -11
- package/dist/core/ingestion/workers/parse-worker.js +358 -187
- package/dist/core/ingestion/workers/worker-pool.d.ts +78 -9
- package/dist/core/ingestion/workers/worker-pool.js +346 -49
- package/dist/core/lbug/csv-generator.js +20 -2
- package/dist/core/lbug/lbug-adapter.js +29 -10
- package/dist/core/lbug/native-check.js +17 -5
- package/dist/core/lbug/pool-adapter.d.ts +0 -19
- package/dist/core/lbug/pool-adapter.js +40 -77
- package/dist/core/lbug/query-result-utils.d.ts +19 -0
- package/dist/core/lbug/query-result-utils.js +28 -0
- package/dist/core/run-analyze.d.ts +9 -2
- package/dist/core/run-analyze.js +24 -3
- package/dist/core/tree-sitter/parser-loader.d.ts +13 -0
- package/dist/core/tree-sitter/parser-loader.js +4 -0
- package/dist/core/tree-sitter/safe-parse.d.ts +70 -3
- package/dist/core/tree-sitter/safe-parse.js +214 -11
- package/dist/core/wiki/generator.js +13 -5
- package/dist/core/wiki/graph-queries.d.ts +3 -0
- package/dist/core/wiki/graph-queries.js +9 -1
- package/dist/core/wiki/llm-client.d.ts +1 -1
- package/dist/core/wiki/llm-client.js +7 -2
- package/dist/core/wiki/local-cli-client.d.ts +2 -1
- package/dist/core/wiki/local-cli-client.js +62 -4
- package/dist/mcp/compatible-stdio-transport.d.ts +3 -0
- package/dist/mcp/compatible-stdio-transport.js +22 -0
- package/dist/mcp/core/embedder.d.ts +1 -1
- package/dist/mcp/core/embedder.js +13 -1
- package/dist/mcp/local/local-backend.d.ts +37 -5
- package/dist/mcp/local/local-backend.js +227 -129
- package/dist/mcp/resources.js +3 -3
- package/dist/mcp/server.js +9 -1
- package/dist/storage/git.d.ts +11 -0
- package/dist/storage/git.js +30 -0
- package/dist/storage/parse-cache.d.ts +23 -1
- package/dist/storage/parse-cache.js +138 -32
- package/dist/storage/parsedfile-store.d.ts +142 -0
- package/dist/storage/parsedfile-store.js +367 -0
- package/dist/storage/repo-manager.d.ts +2 -1
- package/dist/storage/scope-index-store.d.ts +114 -0
- package/dist/storage/scope-index-store.js +236 -0
- package/dist/types/pipeline.d.ts +6 -3
- package/hooks/antigravity/gitnexus-antigravity-hook.cjs +2 -1
- package/hooks/claude/gitnexus-hook.cjs +2 -1
- package/hooks/claude/resolve-analyze-cmd.cjs +323 -0
- package/package.json +4 -5
- package/scripts/bench-scope-resolution.ts +1 -3
- package/scripts/cross-platform-tests.ts +4 -1
- package/skills/gitnexus-cli.md +8 -6
- package/skills/gitnexus-debugging.md +15 -15
- package/skills/gitnexus-exploring.md +11 -11
- package/skills/gitnexus-guide.md +1 -1
- package/skills/gitnexus-impact-analysis.md +10 -10
- package/skills/gitnexus-pr-review.md +19 -19
- package/skills/gitnexus-refactoring.md +25 -25
- package/web/assets/{agent-BRX-afm3.js → agent-EkX7webX.js} +156 -131
- package/web/assets/{architectureDiagram-UL44E2DR-B1oYB8-c.js → architectureDiagram-UL44E2DR-BoczH8cv.js} +1 -1
- package/web/assets/{chunk-LCXTWHL2-SPC6pgWI.js → chunk-LCXTWHL2-By5HB3b-.js} +1 -1
- package/web/assets/{chunk-RG4AUYOV-DZXr4Yv3.js → chunk-RG4AUYOV-BQE_DkpL.js} +1 -1
- package/web/assets/{classDiagram-KGZ6W3CR-BqpOj8L9.js → classDiagram-KGZ6W3CR-Dj_02GUH.js} +1 -1
- package/web/assets/{classDiagram-v2-72OJOZXJ-FmElywK2.js → classDiagram-v2-72OJOZXJ-D-NArMpf.js} +1 -1
- package/web/assets/{diagram-3NCE3AQN-BWtJXMDq.js → diagram-3NCE3AQN-VXtXDO95.js} +1 -1
- package/web/assets/{diagram-GF46GFSD-Hh-fChxU.js → diagram-GF46GFSD-B1qab2Ah.js} +1 -1
- package/web/assets/{diagram-QXG6HAR7-DYeQHxGU.js → diagram-QXG6HAR7-BSCHGzzT.js} +1 -1
- package/web/assets/{diagram-WEQXMOUZ-DYGU4T0y.js → diagram-WEQXMOUZ-DHtknmNT.js} +1 -1
- package/web/assets/{erDiagram-L5TCEMPS-bN3wlP2A.js → erDiagram-L5TCEMPS-Db-IYTmm.js} +1 -1
- package/web/assets/{flowDiagram-H6V6AXG4-YACVtF3-.js → flowDiagram-H6V6AXG4-BHDoyVoW.js} +1 -1
- package/web/assets/{index-BhnAdWTt.js → index-BR0IhgbR.js} +10 -10
- package/web/assets/{infoDiagram-3YFTVSEB-BWBzD28-.js → infoDiagram-3YFTVSEB-6h8wbWEe.js} +1 -1
- package/web/assets/{ishikawaDiagram-BNXS4ZKH-B8qYT-j9.js → ishikawaDiagram-BNXS4ZKH-Dx2OkPk1.js} +1 -1
- package/web/assets/{kanban-definition-75IXJCU3-BeoPr5Tl.js → kanban-definition-75IXJCU3-CIIEZfqV.js} +1 -1
- package/web/assets/{mindmap-definition-2TDM6QVE-CdLLN_so.js → mindmap-definition-2TDM6QVE-DUAqydRq.js} +1 -1
- package/web/assets/{pieDiagram-CU6KROY3-DEd2a_k_.js → pieDiagram-CU6KROY3-BntYuYZa.js} +1 -1
- package/web/assets/{requirementDiagram-JXO7QTGE-QNeTo5C_.js → requirementDiagram-JXO7QTGE-QCD6I29n.js} +1 -1
- package/web/assets/{sequenceDiagram-VS2MUI6T-BHC7q7yJ.js → sequenceDiagram-VS2MUI6T-DScFwLz2.js} +1 -1
- package/web/assets/{stateDiagram-7D4R322I-KONnc2Px.js → stateDiagram-7D4R322I-AkRAm6Hl.js} +1 -1
- package/web/assets/{stateDiagram-v2-36443NZ5-C2QfuMlu.js → stateDiagram-v2-36443NZ5-BCK1vigR.js} +1 -1
- package/web/assets/{timeline-definition-O6YCAMPW-D4t4NJx1.js → timeline-definition-O6YCAMPW-BvpIVXjX.js} +1 -1
- package/web/assets/{vennDiagram-MWXL3ELB-6bctC9Yg.js → vennDiagram-MWXL3ELB-BYGWk6dK.js} +1 -1
- package/web/assets/{wardleyDiagram-CUQ6CDDI-BPZYNTvC.js → wardleyDiagram-CUQ6CDDI-Dk1z7H2T.js} +1 -1
- package/web/assets/{xychartDiagram-N2JHSOCM-lBI9O6DW.js → xychartDiagram-N2JHSOCM-2N6NCSWN.js} +1 -1
- package/web/index.html +1 -1
- package/dist/_shared/scope-resolution/shadow/aggregate.d.ts +0 -63
- package/dist/_shared/scope-resolution/shadow/aggregate.d.ts.map +0 -1
- package/dist/_shared/scope-resolution/shadow/aggregate.js +0 -122
- package/dist/_shared/scope-resolution/shadow/aggregate.js.map +0 -1
- package/dist/_shared/scope-resolution/shadow/diff.d.ts +0 -59
- package/dist/_shared/scope-resolution/shadow/diff.d.ts.map +0 -1
- package/dist/_shared/scope-resolution/shadow/diff.js +0 -79
- package/dist/_shared/scope-resolution/shadow/diff.js.map +0 -1
- package/dist/core/ingestion/ast-cache.d.ts +0 -26
- package/dist/core/ingestion/ast-cache.js +0 -48
- package/dist/core/ingestion/heritage-extractors/configs/go.d.ts +0 -13
- package/dist/core/ingestion/heritage-extractors/configs/go.js +0 -20
- package/dist/core/ingestion/heritage-extractors/configs/ruby.d.ts +0 -18
- package/dist/core/ingestion/heritage-extractors/configs/ruby.js +0 -65
- package/dist/core/ingestion/heritage-extractors/generic.d.ts +0 -23
- package/dist/core/ingestion/heritage-extractors/generic.js +0 -47
- package/dist/core/ingestion/heritage-processor.d.ts +0 -54
- package/dist/core/ingestion/heritage-processor.js +0 -367
- package/dist/core/ingestion/heritage-types.d.ts +0 -73
- package/dist/core/ingestion/heritage-types.js +0 -2
- package/dist/core/ingestion/import-processor.d.ts +0 -23
- package/dist/core/ingestion/import-processor.js +0 -377
- package/dist/core/ingestion/model/heritage-map.d.ts +0 -105
- package/dist/core/ingestion/model/heritage-map.js +0 -294
- package/dist/core/ingestion/model/resolution-context.d.ts +0 -93
- package/dist/core/ingestion/model/resolution-context.js +0 -337
- package/dist/core/ingestion/named-bindings/csharp.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/csharp.js +0 -37
- package/dist/core/ingestion/named-bindings/java.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/java.js +0 -29
- package/dist/core/ingestion/named-bindings/kotlin.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/kotlin.js +0 -36
- package/dist/core/ingestion/named-bindings/php.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/php.js +0 -61
- package/dist/core/ingestion/named-bindings/python.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/python.js +0 -49
- package/dist/core/ingestion/named-bindings/rust.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/rust.js +0 -66
- package/dist/core/ingestion/named-bindings/types.d.ts +0 -16
- package/dist/core/ingestion/named-bindings/types.js +0 -6
- package/dist/core/ingestion/named-bindings/typescript.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/typescript.js +0 -58
- package/dist/core/ingestion/pipeline-phases/cross-file-impl.d.ts +0 -17
- package/dist/core/ingestion/pipeline-phases/cross-file-impl.js +0 -209
- package/dist/core/ingestion/pipeline-phases/orm-extraction.d.ts +0 -22
- package/dist/core/ingestion/pipeline-phases/orm-extraction.js +0 -92
- package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.d.ts +0 -70
- package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.js +0 -312
- package/dist/core/ingestion/registry-primary-flag.d.ts +0 -89
- package/dist/core/ingestion/registry-primary-flag.js +0 -122
- package/dist/core/ingestion/shadow-harness.d.ts +0 -113
- package/dist/core/ingestion/shadow-harness.js +0 -148
- package/dist/core/ingestion/utils/ruby-self-call.d.ts +0 -52
- package/dist/core/ingestion/utils/ruby-self-call.js +0 -59
- package/scripts/ci-list-migrated-languages.ts +0 -24
- package/scripts/run-parity.ts +0 -128
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kotlin capture-time side-channel serialization (#1983).
|
|
3
|
+
*
|
|
4
|
+
* `emitKotlinScopeCaptures` populates one MODULE-LEVEL, per-file map as a side
|
|
5
|
+
* effect that is NOT part of the returned `ParsedFile`'s scopes/defs:
|
|
6
|
+
*
|
|
7
|
+
* - `companionScopesByFile` (companion-scopes.ts) — the `ScopeId`s that came
|
|
8
|
+
* from a `companion_object` AST node, recorded via `markCompanionScope`
|
|
9
|
+
* from the `@scope.companion` marker capture.
|
|
10
|
+
*
|
|
11
|
+
* On the worker path that map is filled in the WORKER process and lost across
|
|
12
|
+
* the worker→main MessageChannel (and the disk-backed parsedfile-store),
|
|
13
|
+
* because scope-resolution reuses the serialized `ParsedFile` and SKIPS the
|
|
14
|
+
* main-thread re-extraction (the #1983 fix that avoids a main-thread
|
|
15
|
+
* tree-sitter re-parse / OOM on huge repos). The main thread then reads the map
|
|
16
|
+
* empty in `isKotlinStaticOnly` / `populateCompanionMembersOnEnclosingClass`
|
|
17
|
+
* (owners.ts) — so companion methods aren't identified as static and
|
|
18
|
+
* companion/static dispatch emits no CALLS edges.
|
|
19
|
+
*
|
|
20
|
+
* This module snapshots the per-file slice of that map into a plain,
|
|
21
|
+
* JSON-serializable object (carried on `ParsedFile.captureSideChannel`) and
|
|
22
|
+
* restores it on the main thread WITHOUT any parse. It mirrors the C++ pattern
|
|
23
|
+
* in `cpp/capture-side-channel.ts`.
|
|
24
|
+
*
|
|
25
|
+
* The single generic `ParsedFile.captureSideChannel` field is shared with C++,
|
|
26
|
+
* which is safe because each file is one language (a `.kt` file uses the kotlin
|
|
27
|
+
* provider, a `.cpp` file the cpp provider). The payload is self-describing
|
|
28
|
+
* (`{ kind: 'kotlin', companionScopes }`) so `applyKotlinCaptureSideChannel`
|
|
29
|
+
* only restores kotlin state and ignores a foreign-shaped snapshot.
|
|
30
|
+
*/
|
|
31
|
+
import type { ParsedFile, ScopeId } from '../../../../_shared/index.js';
|
|
32
|
+
/**
|
|
33
|
+
* Plain JSON-serializable snapshot of the per-file Kotlin capture-time
|
|
34
|
+
* side-channel. Carried opaquely on `ParsedFile.captureSideChannel`. The
|
|
35
|
+
* `kind` tag makes the payload self-describing so `apply` can distinguish a
|
|
36
|
+
* kotlin snapshot from another language's (C++ shares the same field).
|
|
37
|
+
*/
|
|
38
|
+
export interface KotlinCaptureSideChannel {
|
|
39
|
+
readonly kind: 'kotlin';
|
|
40
|
+
/** Companion-object scope ids recorded for this file. */
|
|
41
|
+
readonly companionScopes: readonly ScopeId[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* `LanguageProvider.collectCaptureSideChannel` implementation for Kotlin.
|
|
45
|
+
* Returns `undefined` when this file recorded no companion scopes at all, so
|
|
46
|
+
* the produced `ParsedFile` carries the field only when there's data to ship.
|
|
47
|
+
*/
|
|
48
|
+
export declare function collectKotlinCaptureSideChannel(filePath: string): KotlinCaptureSideChannel | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* `ScopeResolver.applyCaptureSideChannel` implementation for Kotlin. Reads the
|
|
51
|
+
* worker-serialized snapshot from `parsed.captureSideChannel` and re-populates
|
|
52
|
+
* the module-level companion-scope map via `markCompanionScope`. Tolerant of
|
|
53
|
+
* `undefined` (file carried no data) and of an unexpected / foreign shape
|
|
54
|
+
* (defensive — the `kind` tag guards against restoring a non-kotlin payload).
|
|
55
|
+
* Does NO tree-sitter parse.
|
|
56
|
+
*/
|
|
57
|
+
export declare function applyKotlinCaptureSideChannel(parsed: ParsedFile): void;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kotlin capture-time side-channel serialization (#1983).
|
|
3
|
+
*
|
|
4
|
+
* `emitKotlinScopeCaptures` populates one MODULE-LEVEL, per-file map as a side
|
|
5
|
+
* effect that is NOT part of the returned `ParsedFile`'s scopes/defs:
|
|
6
|
+
*
|
|
7
|
+
* - `companionScopesByFile` (companion-scopes.ts) — the `ScopeId`s that came
|
|
8
|
+
* from a `companion_object` AST node, recorded via `markCompanionScope`
|
|
9
|
+
* from the `@scope.companion` marker capture.
|
|
10
|
+
*
|
|
11
|
+
* On the worker path that map is filled in the WORKER process and lost across
|
|
12
|
+
* the worker→main MessageChannel (and the disk-backed parsedfile-store),
|
|
13
|
+
* because scope-resolution reuses the serialized `ParsedFile` and SKIPS the
|
|
14
|
+
* main-thread re-extraction (the #1983 fix that avoids a main-thread
|
|
15
|
+
* tree-sitter re-parse / OOM on huge repos). The main thread then reads the map
|
|
16
|
+
* empty in `isKotlinStaticOnly` / `populateCompanionMembersOnEnclosingClass`
|
|
17
|
+
* (owners.ts) — so companion methods aren't identified as static and
|
|
18
|
+
* companion/static dispatch emits no CALLS edges.
|
|
19
|
+
*
|
|
20
|
+
* This module snapshots the per-file slice of that map into a plain,
|
|
21
|
+
* JSON-serializable object (carried on `ParsedFile.captureSideChannel`) and
|
|
22
|
+
* restores it on the main thread WITHOUT any parse. It mirrors the C++ pattern
|
|
23
|
+
* in `cpp/capture-side-channel.ts`.
|
|
24
|
+
*
|
|
25
|
+
* The single generic `ParsedFile.captureSideChannel` field is shared with C++,
|
|
26
|
+
* which is safe because each file is one language (a `.kt` file uses the kotlin
|
|
27
|
+
* provider, a `.cpp` file the cpp provider). The payload is self-describing
|
|
28
|
+
* (`{ kind: 'kotlin', companionScopes }`) so `applyKotlinCaptureSideChannel`
|
|
29
|
+
* only restores kotlin state and ignores a foreign-shaped snapshot.
|
|
30
|
+
*/
|
|
31
|
+
import { getCompanionScopesForFile, markCompanionScope } from './companion-scopes.js';
|
|
32
|
+
/**
|
|
33
|
+
* `LanguageProvider.collectCaptureSideChannel` implementation for Kotlin.
|
|
34
|
+
* Returns `undefined` when this file recorded no companion scopes at all, so
|
|
35
|
+
* the produced `ParsedFile` carries the field only when there's data to ship.
|
|
36
|
+
*/
|
|
37
|
+
export function collectKotlinCaptureSideChannel(filePath) {
|
|
38
|
+
const companionScopes = getCompanionScopesForFile(filePath);
|
|
39
|
+
if (companionScopes.length === 0)
|
|
40
|
+
return undefined;
|
|
41
|
+
return { kind: 'kotlin', companionScopes };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* `ScopeResolver.applyCaptureSideChannel` implementation for Kotlin. Reads the
|
|
45
|
+
* worker-serialized snapshot from `parsed.captureSideChannel` and re-populates
|
|
46
|
+
* the module-level companion-scope map via `markCompanionScope`. Tolerant of
|
|
47
|
+
* `undefined` (file carried no data) and of an unexpected / foreign shape
|
|
48
|
+
* (defensive — the `kind` tag guards against restoring a non-kotlin payload).
|
|
49
|
+
* Does NO tree-sitter parse.
|
|
50
|
+
*/
|
|
51
|
+
export function applyKotlinCaptureSideChannel(parsed) {
|
|
52
|
+
const data = parsed.captureSideChannel;
|
|
53
|
+
if (data === undefined || data === null || typeof data !== 'object')
|
|
54
|
+
return;
|
|
55
|
+
if (data.kind !== 'kotlin' || !Array.isArray(data.companionScopes))
|
|
56
|
+
return;
|
|
57
|
+
for (const scopeId of data.companionScopes) {
|
|
58
|
+
markCompanionScope(parsed.filePath, scopeId);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { makeScopeId } from '../../../../_shared/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { nodeIfType, nodeToCapture, syntheticCapture, } from '../../utils/ast-helpers.js';
|
|
3
3
|
import { getTreeSitterBufferSize } from '../../constants.js';
|
|
4
4
|
import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
|
|
5
5
|
import { computeKotlinArityMetadata } from './arity-metadata.js';
|
|
@@ -27,11 +27,20 @@ export function emitKotlinScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
27
27
|
out.push(...synthesizeKotlinLoopBindings(tree.rootNode, returnTypes));
|
|
28
28
|
out.push(...synthesizeKotlinSmartCastBindings(tree.rootNode));
|
|
29
29
|
out.push(...synthesizeKotlinLambdaBindings(tree.rootNode, returnTypes));
|
|
30
|
+
out.push(...synthesizeKotlinInheritanceReferences(tree.rootNode));
|
|
31
|
+
out.push(...synthesizeKotlinSecondaryConstructorDeclarations(tree.rootNode));
|
|
30
32
|
for (const match of getKotlinScopeQuery().matches(tree.rootNode)) {
|
|
31
33
|
const grouped = {};
|
|
34
|
+
// Parallel tag -> captured SyntaxNode map. The query hands us each matched
|
|
35
|
+
// node as capture.node, so anchors resolve via a type-guarded lookup
|
|
36
|
+
// (nodeIfType) instead of re-deriving them with
|
|
37
|
+
// findNodeAtRange(tree.rootNode, ...) per match — the O(matches x N)
|
|
38
|
+
// root-walk fixed for go #1915 / python #1918 / csharp, mirrored here.
|
|
39
|
+
const groupedNodes = {};
|
|
32
40
|
for (const capture of match.captures) {
|
|
33
41
|
const tag = '@' + capture.name;
|
|
34
42
|
grouped[tag] = nodeToCapture(tag, capture.node);
|
|
43
|
+
groupedNodes[tag] = capture.node;
|
|
35
44
|
}
|
|
36
45
|
if (Object.keys(grouped).length === 0)
|
|
37
46
|
continue;
|
|
@@ -56,7 +65,7 @@ export function emitKotlinScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
56
65
|
continue;
|
|
57
66
|
}
|
|
58
67
|
if (grouped['@import.statement'] !== undefined) {
|
|
59
|
-
const importNode =
|
|
68
|
+
const importNode = nodeIfType(groupedNodes['@import.statement'], 'import_header');
|
|
60
69
|
if (importNode !== null) {
|
|
61
70
|
const decomposed = splitKotlinImportHeader(importNode);
|
|
62
71
|
if (decomposed !== null) {
|
|
@@ -65,13 +74,46 @@ export function emitKotlinScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
65
74
|
}
|
|
66
75
|
}
|
|
67
76
|
}
|
|
77
|
+
// Callable references (`::method`, `Type::new`, `obj::m`) — F47 (#1919).
|
|
78
|
+
// The query captures the referenced member as `@reference.name`, an
|
|
79
|
+
// optional receiver type as `@reference.receiver`, and the whole node as
|
|
80
|
+
// `@reference.callable`. Rewrite into a call reference so it participates
|
|
81
|
+
// in call-graph resolution: a bare `::member` resolves as a free call;
|
|
82
|
+
// a `Receiver::member` resolves as a member call against the receiver
|
|
83
|
+
// type. The function/constructor is referenced (not invoked), so no
|
|
84
|
+
// arity/argument metadata is attached.
|
|
85
|
+
if (grouped['@reference.callable'] !== undefined) {
|
|
86
|
+
const nameCap = grouped['@reference.name'];
|
|
87
|
+
const callableNode = groupedNodes['@reference.callable'];
|
|
88
|
+
if (nameCap !== undefined && callableNode !== undefined) {
|
|
89
|
+
const receiverCap = grouped['@reference.receiver'];
|
|
90
|
+
// The anchor Capture must carry the call-form tag as its `name` —
|
|
91
|
+
// the scope-extractor reads `Capture.name` (not the map key) to
|
|
92
|
+
// classify the reference kind, so re-wrap via nodeToCapture rather
|
|
93
|
+
// than reusing the `@reference.callable`-named Capture (whose head
|
|
94
|
+
// `callable` resolves to no ReferenceKind and silently drops it).
|
|
95
|
+
if (receiverCap !== undefined) {
|
|
96
|
+
out.push({
|
|
97
|
+
'@reference.call.member': nodeToCapture('@reference.call.member', callableNode),
|
|
98
|
+
'@reference.name': nameCap,
|
|
99
|
+
'@reference.receiver': receiverCap,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
out.push({
|
|
104
|
+
'@reference.call.free': nodeToCapture('@reference.call.free', callableNode),
|
|
105
|
+
'@reference.name': nameCap,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
68
111
|
if (grouped['@reference.call.free'] !== undefined &&
|
|
69
112
|
grouped['@reference.receiver'] !== undefined) {
|
|
70
113
|
continue;
|
|
71
114
|
}
|
|
72
115
|
if (grouped['@reference.read.member'] !== undefined) {
|
|
73
|
-
const
|
|
74
|
-
const navNode = findNodeAtRange(tree.rootNode, anchor.range, 'navigation_expression');
|
|
116
|
+
const navNode = nodeIfType(groupedNodes['@reference.read.member'], 'navigation_expression');
|
|
75
117
|
if (navNode === null || !shouldEmitReadMember(navNode))
|
|
76
118
|
continue;
|
|
77
119
|
}
|
|
@@ -91,14 +133,14 @@ export function emitKotlinScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
91
133
|
if (grouped['@type-binding.annotation'] !== undefined &&
|
|
92
134
|
grouped['@type-binding.name'] !== undefined &&
|
|
93
135
|
grouped['@type-binding.type'] !== undefined) {
|
|
94
|
-
const
|
|
95
|
-
if (propertyDeclHasConstructorValue(
|
|
136
|
+
const propNode = nodeIfType(groupedNodes['@type-binding.annotation'], 'property_declaration');
|
|
137
|
+
if (propNode !== null && propertyDeclHasConstructorValue(propNode)) {
|
|
96
138
|
continue;
|
|
97
139
|
}
|
|
98
140
|
}
|
|
99
141
|
if (grouped['@scope.function'] !== undefined) {
|
|
100
142
|
out.push(grouped);
|
|
101
|
-
const fnNode =
|
|
143
|
+
const fnNode = nodeIfType(groupedNodes['@scope.function'], 'function_declaration');
|
|
102
144
|
if (fnNode !== null) {
|
|
103
145
|
out.push(...synthesizeKotlinReceiverBinding(fnNode));
|
|
104
146
|
}
|
|
@@ -106,7 +148,7 @@ export function emitKotlinScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
106
148
|
}
|
|
107
149
|
const declTag = FUNCTION_DECL_TAGS.find((tag) => grouped[tag] !== undefined);
|
|
108
150
|
if (declTag !== undefined) {
|
|
109
|
-
const fnNode =
|
|
151
|
+
const fnNode = nodeIfType(groupedNodes[declTag], 'function_declaration');
|
|
110
152
|
if (fnNode !== null) {
|
|
111
153
|
const arity = computeKotlinArityMetadata(fnNode);
|
|
112
154
|
if (arity.parameterCount !== undefined) {
|
|
@@ -122,7 +164,7 @@ export function emitKotlinScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
122
164
|
}
|
|
123
165
|
const callTag = ['@reference.call.free', '@reference.call.member', '@reference.call.constructor'].find((tag) => grouped[tag] !== undefined);
|
|
124
166
|
if (callTag !== undefined && grouped['@reference.arity'] === undefined) {
|
|
125
|
-
const callNode =
|
|
167
|
+
const callNode = nodeIfType(groupedNodes[callTag], 'call_expression');
|
|
126
168
|
if (callNode !== null) {
|
|
127
169
|
const args = callArguments(callNode);
|
|
128
170
|
grouped['@reference.arity'] = syntheticCapture('@reference.arity', callNode, String(args.length));
|
|
@@ -130,12 +172,161 @@ export function emitKotlinScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
130
172
|
}
|
|
131
173
|
}
|
|
132
174
|
out.push(grouped);
|
|
133
|
-
const extensionFallback = extensionFreeCallFallback(grouped,
|
|
175
|
+
const extensionFallback = extensionFreeCallFallback(grouped, groupedNodes);
|
|
134
176
|
if (extensionFallback !== null)
|
|
135
177
|
out.push(extensionFallback);
|
|
136
178
|
}
|
|
137
179
|
return out;
|
|
138
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Synthesize `@reference.inherits` captures from Kotlin `class_declaration`
|
|
183
|
+
* delegation specifiers so the registry-primary scope-resolution path emits
|
|
184
|
+
* EXTENDS / IMPLEMENTS edges (mirrors C# `synthesizeCsharpInheritanceReferences`
|
|
185
|
+
* and C++ `emitCppInheritanceCaptures`). Without this, Kotlin inheritance edges
|
|
186
|
+
* came only from the legacy heritage-capture leg (removed in #942), which the
|
|
187
|
+
* worker pipeline drops for registry-primary languages → 0 inheritance edges in
|
|
188
|
+
* worker mode (#1951).
|
|
189
|
+
*
|
|
190
|
+
* Scope mirrors the legacy KOTLIN_QUERIES heritage patterns exactly
|
|
191
|
+
* (the config-driven `kotlinHeritageShapes`: `user_type`,
|
|
192
|
+
* `constructor_invocation`, `explicit_delegation`). Each `delegation_specifier`
|
|
193
|
+
* child of a `class_declaration`, in one of three forms —
|
|
194
|
+
* - bare interface/superclass: `class Foo : Bar`
|
|
195
|
+
* `(delegation_specifier (user_type (type_identifier)))`
|
|
196
|
+
* - constructor-call superclass: `class Foo : Bar()`
|
|
197
|
+
* `(delegation_specifier (constructor_invocation (user_type (type_identifier))))`
|
|
198
|
+
* - interface delegation: `class Foo : Bar by delegate`
|
|
199
|
+
* `(delegation_specifier (explicit_delegation (user_type (type_identifier)) …))`
|
|
200
|
+
* — the delegated interface is the LEADING `user_type`; the trailing
|
|
201
|
+
* delegate expression (`by delegate`) is NOT a supertype (#1951). This is
|
|
202
|
+
* the dropped shape the registry-primary synth previously skipped, leaving
|
|
203
|
+
* `class F : Iface by d` with no IMPLEMENTS edge in worker mode.
|
|
204
|
+
*
|
|
205
|
+
* Kotlin uses `:` for BOTH superclass and interfaces — the EXTENDS-vs-IMPLEMENTS
|
|
206
|
+
* split is decided downstream from the resolved target's symbol kind
|
|
207
|
+
* (`preEmitInheritanceEdges`), so every base is emitted with the same `inherits`
|
|
208
|
+
* kind here. The bare lookup name is normalized to the simple identifier
|
|
209
|
+
* (`Base()` → `Base`, `Base<T>` → `Base`, `pkg.Base` → `Base`,
|
|
210
|
+
* `Iface by d` → `Iface`) so V1's simple-name `findClassBindingInScope`
|
|
211
|
+
* resolves it. The extracted bare name agrees with the legacy leg's
|
|
212
|
+
* `normalizeSupertypeName` for every shape (verified by real-parse).
|
|
213
|
+
*/
|
|
214
|
+
function synthesizeKotlinInheritanceReferences(rootNode) {
|
|
215
|
+
const out = [];
|
|
216
|
+
for (const classNode of descendantsOfType(rootNode, 'class_declaration')) {
|
|
217
|
+
for (const child of classNode.namedChildren) {
|
|
218
|
+
if (child.type !== 'delegation_specifier')
|
|
219
|
+
continue;
|
|
220
|
+
// Three wrappers, all resolving to a leading `user_type` →
|
|
221
|
+
// `type_identifier`:
|
|
222
|
+
// - `(delegation_specifier (constructor_invocation (user_type …)))` for `Base()`
|
|
223
|
+
// - `(delegation_specifier (explicit_delegation (user_type …) <delegate>))`
|
|
224
|
+
// for `Iface by d` — the supertype is the FIRST `user_type`; the
|
|
225
|
+
// delegate expression that trails `by` is ignored.
|
|
226
|
+
// - `(delegation_specifier (user_type …))` for a bare interface/superclass.
|
|
227
|
+
const ctor = child.namedChildren.find((n) => n.type === 'constructor_invocation');
|
|
228
|
+
const delegation = child.namedChildren.find((n) => n.type === 'explicit_delegation');
|
|
229
|
+
const userType = ctor?.namedChildren.find((n) => n.type === 'user_type') ??
|
|
230
|
+
delegation?.namedChildren.find((n) => n.type === 'user_type') ??
|
|
231
|
+
child.namedChildren.find((n) => n.type === 'user_type');
|
|
232
|
+
if (userType === undefined)
|
|
233
|
+
continue;
|
|
234
|
+
const nameNode = kotlinUserTypeNameNode(userType);
|
|
235
|
+
if (nameNode === null)
|
|
236
|
+
continue;
|
|
237
|
+
out.push({
|
|
238
|
+
'@reference.inherits': nodeToCapture('@reference.inherits', child),
|
|
239
|
+
'@reference.name': nodeToCapture('@reference.name', nameNode),
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return out;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The enclosing type name for a node nested in a class/object/companion body.
|
|
247
|
+
* Walks up to the first `class_declaration` / `object_declaration` /
|
|
248
|
+
* `companion_object` ancestor and returns its `type_identifier` name node.
|
|
249
|
+
* Used to qualify a secondary-constructor declaration as `<ClassName>.constructor`.
|
|
250
|
+
*/
|
|
251
|
+
function kotlinEnclosingTypeNameNode(node) {
|
|
252
|
+
for (let cur = node.parent; cur !== null; cur = cur.parent) {
|
|
253
|
+
if (cur.type === 'class_declaration' ||
|
|
254
|
+
cur.type === 'object_declaration' ||
|
|
255
|
+
cur.type === 'companion_object') {
|
|
256
|
+
const nameNode = cur.namedChildren.find((c) => c.type === 'type_identifier');
|
|
257
|
+
return nameNode ?? null;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Synthesize a `@declaration.constructor` capture for each Kotlin
|
|
264
|
+
* `secondary_constructor` (issue #1919 review CF1). The structure phase already
|
|
265
|
+
* materializes a `Constructor` graph node (`Constructor:file:Class.constructor#<arity>`),
|
|
266
|
+
* but the registry-primary scope-resolution path had no Constructor *def* in the
|
|
267
|
+
* scope tree — so a call inside the constructor body resolved its caller anchor
|
|
268
|
+
* up to the enclosing Class def, mis-attributing the CALLS edge to the class.
|
|
269
|
+
*
|
|
270
|
+
* Paired with `(secondary_constructor) @scope.function` in query.ts: that rule
|
|
271
|
+
* makes the constructor body its own Function scope; this declaration places a
|
|
272
|
+
* Constructor def in that scope so `pickCallerCallableDef` anchors calls on the
|
|
273
|
+
* Constructor. The def is keyed to match the structure-phase node id:
|
|
274
|
+
* - `@declaration.qualified_name` = `<ClassName>.constructor` so the bridge's
|
|
275
|
+
* qualified key (`<q>:file::Constructor::Class.constructor`) hits the node.
|
|
276
|
+
* - `@declaration.parameter-types` so two same-name secondary constructors are
|
|
277
|
+
* disambiguated by the bridge's parameter-types key (`~Int,Int`), matching
|
|
278
|
+
* the `#<arity>`-suffixed structure node for the overload with the same
|
|
279
|
+
* parameter shape. (The zero-arg overload carries no parameter types and
|
|
280
|
+
* resolves via the qualified/simple key to the `#0` node.)
|
|
281
|
+
*
|
|
282
|
+
* The anchor spans the whole `secondary_constructor` node — same range as the
|
|
283
|
+
* `@scope.function` it pairs with — so the def is owned by that Function scope
|
|
284
|
+
* and the constructor name auto-hoists to the enclosing class scope (exactly the
|
|
285
|
+
* binding shape a normal method declaration produces).
|
|
286
|
+
*/
|
|
287
|
+
function synthesizeKotlinSecondaryConstructorDeclarations(rootNode) {
|
|
288
|
+
const out = [];
|
|
289
|
+
for (const ctorNode of descendantsOfType(rootNode, 'secondary_constructor')) {
|
|
290
|
+
const keyword = ctorNode.namedChildren.find((c) => c.type === 'constructor');
|
|
291
|
+
// The `constructor` keyword is an anonymous token; fall back to the node
|
|
292
|
+
// itself for the name capture position when the named-child lookup misses.
|
|
293
|
+
const nameAnchor = keyword ?? ctorNode;
|
|
294
|
+
const classNameNode = kotlinEnclosingTypeNameNode(ctorNode);
|
|
295
|
+
const qualifiedName = classNameNode !== null ? `${classNameNode.text}.constructor` : 'constructor';
|
|
296
|
+
const match = {
|
|
297
|
+
'@declaration.constructor': nodeToCapture('@declaration.constructor', ctorNode),
|
|
298
|
+
'@declaration.name': syntheticCapture('@declaration.name', nameAnchor, 'constructor'),
|
|
299
|
+
'@declaration.qualified_name': syntheticCapture('@declaration.qualified_name', ctorNode, qualifiedName),
|
|
300
|
+
};
|
|
301
|
+
const arity = computeKotlinArityMetadata(ctorNode);
|
|
302
|
+
if (arity.parameterCount !== undefined) {
|
|
303
|
+
match['@declaration.parameter-count'] = syntheticCapture('@declaration.parameter-count', ctorNode, String(arity.parameterCount));
|
|
304
|
+
}
|
|
305
|
+
if (arity.requiredParameterCount !== undefined) {
|
|
306
|
+
match['@declaration.required-parameter-count'] = syntheticCapture('@declaration.required-parameter-count', ctorNode, String(arity.requiredParameterCount));
|
|
307
|
+
}
|
|
308
|
+
if (arity.parameterTypes !== undefined) {
|
|
309
|
+
match['@declaration.parameter-types'] = syntheticCapture('@declaration.parameter-types', ctorNode, JSON.stringify(arity.parameterTypes));
|
|
310
|
+
}
|
|
311
|
+
out.push(match);
|
|
312
|
+
}
|
|
313
|
+
return out;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* The bare simple-name `type_identifier` of a `user_type`. Strips generic
|
|
317
|
+
* type arguments (`Base<T>` → `Base`) and qualifier tails (`pkg.Base` → `Base`)
|
|
318
|
+
* by taking the LAST direct `type_identifier` child, matching the legacy
|
|
319
|
+
* heritage capture of a `user_type`'s `type_identifier` and V1's
|
|
320
|
+
* simple-name `findClassBindingInScope` contract.
|
|
321
|
+
*/
|
|
322
|
+
function kotlinUserTypeNameNode(userType) {
|
|
323
|
+
let nameNode = null;
|
|
324
|
+
for (const child of userType.namedChildren) {
|
|
325
|
+
if (child.type === 'type_identifier')
|
|
326
|
+
nameNode = child;
|
|
327
|
+
}
|
|
328
|
+
return nameNode;
|
|
329
|
+
}
|
|
139
330
|
function synthesizeKotlinLoopBindings(rootNode, returnTypes) {
|
|
140
331
|
const out = [];
|
|
141
332
|
for (const fnNode of descendantsOfType(rootNode, 'function_declaration')) {
|
|
@@ -882,14 +1073,11 @@ function shouldEmitReadMember(navNode) {
|
|
|
882
1073
|
return false;
|
|
883
1074
|
return true;
|
|
884
1075
|
}
|
|
885
|
-
/** True when the
|
|
886
|
-
*
|
|
887
|
-
*
|
|
888
|
-
*
|
|
889
|
-
function propertyDeclHasConstructorValue(
|
|
890
|
-
const propNode = findNodeAtRange(rootNode, range, 'property_declaration');
|
|
891
|
-
if (propNode === null)
|
|
892
|
-
return false;
|
|
1076
|
+
/** True when the given `property_declaration` has a `call_expression`
|
|
1077
|
+
* value sibling (i.e. `val x: T = Foo()`). Used to suppress the
|
|
1078
|
+
* explicit-annotation type-binding capture so the constructor-inferred
|
|
1079
|
+
* binding wins (#1762). */
|
|
1080
|
+
function propertyDeclHasConstructorValue(propNode) {
|
|
893
1081
|
const variable = propNode.namedChildren.find((c) => c.type === 'variable_declaration');
|
|
894
1082
|
if (variable === undefined)
|
|
895
1083
|
return false;
|
|
@@ -929,17 +1117,20 @@ function inferArgType(argNode) {
|
|
|
929
1117
|
return '';
|
|
930
1118
|
}
|
|
931
1119
|
}
|
|
932
|
-
function extensionFreeCallFallback(grouped,
|
|
1120
|
+
function extensionFreeCallFallback(grouped, groupedNodes) {
|
|
933
1121
|
const member = grouped['@reference.call.member'];
|
|
934
1122
|
const receiver = grouped['@reference.receiver'];
|
|
935
1123
|
const name = grouped['@reference.name'];
|
|
936
1124
|
if (member === undefined || receiver === undefined || name === undefined)
|
|
937
1125
|
return null;
|
|
938
|
-
|
|
1126
|
+
// The `@reference.call.member` anchor IS the `call_expression`, and the
|
|
1127
|
+
// `@reference.receiver` anchor IS the receiver node — both threaded from the
|
|
1128
|
+
// query match (no per-match root walk).
|
|
1129
|
+
const callNode = nodeIfType(groupedNodes['@reference.call.member'], 'call_expression');
|
|
939
1130
|
if (callNode === null)
|
|
940
1131
|
return null;
|
|
941
|
-
const receiverNode =
|
|
942
|
-
if (receiverNode ===
|
|
1132
|
+
const receiverNode = groupedNodes['@reference.receiver'];
|
|
1133
|
+
if (receiverNode === undefined || !isLiteralReceiver(receiverNode))
|
|
943
1134
|
return null;
|
|
944
1135
|
const out = {
|
|
945
1136
|
'@reference.call.free': syntheticCapture('@reference.call.free', callNode, callNode.text),
|
|
@@ -3,5 +3,12 @@ import type { ScopeId } from '../../../../_shared/index.js';
|
|
|
3
3
|
export declare function markCompanionScope(filePath: string, scopeId: ScopeId): void;
|
|
4
4
|
/** Check whether `scopeId` belongs to a companion-object scope in `filePath`. */
|
|
5
5
|
export declare function isCompanionScope(filePath: string, scopeId: ScopeId): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Snapshot the companion-object scope ids recorded for `filePath` as a plain
|
|
8
|
+
* array (for the worker→main capture side-channel, #1983). Returns an empty
|
|
9
|
+
* array when the file recorded no companion scopes. See
|
|
10
|
+
* `capture-side-channel.ts`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCompanionScopesForFile(filePath: string): ScopeId[];
|
|
6
13
|
/** Clear all tracked companion scopes (for testing). */
|
|
7
14
|
export declare function clearCompanionScopes(): void;
|
|
@@ -50,6 +50,16 @@ export function markCompanionScope(filePath, scopeId) {
|
|
|
50
50
|
export function isCompanionScope(filePath, scopeId) {
|
|
51
51
|
return companionScopesByFile.get(filePath)?.has(scopeId) ?? false;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Snapshot the companion-object scope ids recorded for `filePath` as a plain
|
|
55
|
+
* array (for the worker→main capture side-channel, #1983). Returns an empty
|
|
56
|
+
* array when the file recorded no companion scopes. See
|
|
57
|
+
* `capture-side-channel.ts`.
|
|
58
|
+
*/
|
|
59
|
+
export function getCompanionScopesForFile(filePath) {
|
|
60
|
+
const scopes = companionScopesByFile.get(filePath);
|
|
61
|
+
return scopes === undefined ? [] : [...scopes];
|
|
62
|
+
}
|
|
53
63
|
/** Clear all tracked companion scopes (for testing). */
|
|
54
64
|
export function clearCompanionScopes() {
|
|
55
65
|
companionScopesByFile.clear();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { emitKotlinScopeCaptures } from './captures.js';
|
|
2
|
+
export { collectKotlinCaptureSideChannel, applyKotlinCaptureSideChannel, type KotlinCaptureSideChannel, } from './capture-side-channel.js';
|
|
2
3
|
export { getKotlinCaptureCacheStats, resetKotlinCaptureCacheStats } from './cache-stats.js';
|
|
3
4
|
export { interpretKotlinImport, interpretKotlinTypeBinding } from './interpret.js';
|
|
4
5
|
export { kotlinArityCompatibility } from './arity.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { emitKotlinScopeCaptures } from './captures.js';
|
|
2
|
+
export { collectKotlinCaptureSideChannel, applyKotlinCaptureSideChannel, } from './capture-side-channel.js';
|
|
2
3
|
export { getKotlinCaptureCacheStats, resetKotlinCaptureCacheStats } from './cache-stats.js';
|
|
3
4
|
export { interpretKotlinImport, interpretKotlinTypeBinding } from './interpret.js';
|
|
4
5
|
export { kotlinArityCompatibility } from './arity.js';
|
|
@@ -8,6 +8,16 @@ const KOTLIN_SCOPE_QUERY = `
|
|
|
8
8
|
(companion_object) @scope.class
|
|
9
9
|
(function_declaration) @scope.function
|
|
10
10
|
|
|
11
|
+
;; Secondary-constructor body scope (issue #1919 review CF1). A
|
|
12
|
+
;; secondary constructor's "constructor(...) { ... }" body executes statements
|
|
13
|
+
;; just like a method body, so it must be its OWN Function scope — otherwise a
|
|
14
|
+
;; call inside the body resolves its caller anchor up to the enclosing Class
|
|
15
|
+
;; scope (the class's Class def), mis-attributing the CALLS edge to the class
|
|
16
|
+
;; rather than the Constructor. The matching @declaration.constructor is
|
|
17
|
+
;; synthesized in captures.ts (synthesizeKotlinSecondaryConstructorDeclarations)
|
|
18
|
+
;; so this scope owns a Constructor def keyed to the structure-phase node id.
|
|
19
|
+
(secondary_constructor) @scope.function
|
|
20
|
+
|
|
11
21
|
;; Companion-object marker (issue #1756 / U4). Side-channel capture that
|
|
12
22
|
;; lets populateCompanionMembersOnEnclosingClass distinguish a companion
|
|
13
23
|
;; Class scope from a regular Class scope without inspecting ownedDefs.
|
|
@@ -116,6 +126,26 @@ const KOTLIN_SCOPE_QUERY = `
|
|
|
116
126
|
(function_value_parameters)
|
|
117
127
|
[(user_type) (nullable_type) (function_type)] @type-binding.type) @type-binding.return
|
|
118
128
|
|
|
129
|
+
;; References — callable references ("::method", "Type::new", "obj::m") — F47.
|
|
130
|
+
;; A "callable_reference" references a function/constructor as a value (no
|
|
131
|
+
;; call_suffix), so the registry-primary call path never saw it. Real-parse
|
|
132
|
+
;; (issue #1919) shows the canonical shape inside a function body is:
|
|
133
|
+
;; "::topLevelFn" -> (callable_reference :: (simple_identifier)) member only
|
|
134
|
+
;; "String::length" -> (callable_reference (type_identifier) :: (simple_identifier))
|
|
135
|
+
;; "obj::method" -> (callable_reference (type_identifier) :: (simple_identifier))
|
|
136
|
+
;; "Type::new" -> (callable_reference (type_identifier) :: (simple_identifier))
|
|
137
|
+
;; The receiver (real type OR object) is always a "type_identifier"; the
|
|
138
|
+
;; referenced member is the LAST "simple_identifier". One rule with an
|
|
139
|
+
;; optional receiver and an end-anchored member covers all four forms with
|
|
140
|
+
;; exactly one match per callable_reference (no sibling-branch double-match).
|
|
141
|
+
;; (NOTE: a qualified "A.B::m" parses as a nested navigation_expression, not a
|
|
142
|
+
;; callable_reference, and is already captured by the read.member rule below.)
|
|
143
|
+
;; emitKotlinScopeCaptures rewrites this into a free/member call reference.
|
|
144
|
+
(callable_reference
|
|
145
|
+
(type_identifier)? @reference.receiver
|
|
146
|
+
(simple_identifier) @reference.name
|
|
147
|
+
.) @reference.callable
|
|
148
|
+
|
|
119
149
|
;; References — direct calls / constructor syntax
|
|
120
150
|
(call_expression
|
|
121
151
|
(simple_identifier) @reference.name) @reference.call.free
|
|
@@ -2,14 +2,12 @@ import type { ScopeResolver } from '../../scope-resolution/contract/scope-resolv
|
|
|
2
2
|
/**
|
|
3
3
|
* Kotlin scope resolver for RFC #909 Ring 3.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* (`REGISTRY_PRIMARY_KOTLIN=0`) explicitly forces the legacy parity
|
|
9
|
-
* run for CI comparison.
|
|
5
|
+
* Kotlin resolves via the scope-resolution registry — production
|
|
6
|
+
* resolution flows through the scope-resolution pipeline as the sole
|
|
7
|
+
* call-resolution path.
|
|
10
8
|
*
|
|
11
|
-
* **
|
|
12
|
-
*
|
|
9
|
+
* **Coverage:** 208/208 fixtures pass after the migration sub-issues
|
|
10
|
+
* #1758–#1763, the
|
|
13
11
|
* companion/instance dispatch fix #1756, and the lambda scopes
|
|
14
12
|
* fix #1757. Covers core import, receiver, companion, default-param,
|
|
15
13
|
* vararg, constructor, local assignment-chain, collection-iteration,
|
|
@@ -5,18 +5,17 @@ import { isClassLike } from '../../scope-resolution/scope/walkers.js';
|
|
|
5
5
|
import { kotlinProvider } from '../kotlin.js';
|
|
6
6
|
import { kotlinArityCompatibility, kotlinMergeBindings, populateKotlinOwners, resolveKotlinImportTarget, } from './index.js';
|
|
7
7
|
import { clearCompanionScopes } from './companion-scopes.js';
|
|
8
|
+
import { applyKotlinCaptureSideChannel } from './capture-side-channel.js';
|
|
8
9
|
import { isKotlinStaticOnly } from './owners.js';
|
|
9
10
|
/**
|
|
10
11
|
* Kotlin scope resolver for RFC #909 Ring 3.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* (`REGISTRY_PRIMARY_KOTLIN=0`) explicitly forces the legacy parity
|
|
16
|
-
* run for CI comparison.
|
|
13
|
+
* Kotlin resolves via the scope-resolution registry — production
|
|
14
|
+
* resolution flows through the scope-resolution pipeline as the sole
|
|
15
|
+
* call-resolution path.
|
|
17
16
|
*
|
|
18
|
-
* **
|
|
19
|
-
*
|
|
17
|
+
* **Coverage:** 208/208 fixtures pass after the migration sub-issues
|
|
18
|
+
* #1758–#1763, the
|
|
20
19
|
* companion/instance dispatch fix #1756, and the lambda scopes
|
|
21
20
|
* fix #1757. Covers core import, receiver, companion, default-param,
|
|
22
21
|
* vararg, constructor, local assignment-chain, collection-iteration,
|
|
@@ -67,6 +66,22 @@ export const kotlinScopeResolver = {
|
|
|
67
66
|
mergeBindings: (existing, incoming) => [...kotlinMergeBindings([...existing, ...incoming])],
|
|
68
67
|
arityCompatibility: (callsite, def) => kotlinArityCompatibility(def, callsite),
|
|
69
68
|
buildMro: (graph, parsedFiles, nodeLookup) => buildKotlinMro(graph, parsedFiles, nodeLookup),
|
|
69
|
+
// Worker-boundary restore (see `ScopeResolver.applyCaptureSideChannel`).
|
|
70
|
+
// `emitKotlinScopeCaptures` records per-file companion-object scope ids
|
|
71
|
+
// (`markCompanionScope` → `companionScopesByFile`) as a SIDE EFFECT — that
|
|
72
|
+
// state is NOT serialized onto the returned ParsedFile's scopes/defs. On the
|
|
73
|
+
// worker path those marks are populated in the worker process and lost across
|
|
74
|
+
// the MessageChannel / disk store; the main thread reuses the serialized
|
|
75
|
+
// ParsedFile and skips `extractParsedFile`, so `isKotlinStaticOnly` and
|
|
76
|
+
// `populateCompanionMembersOnEnclosingClass` (owners.ts) would see an empty
|
|
77
|
+
// map and companion/static dispatch would emit zero CALLS edges. The worker
|
|
78
|
+
// stashed a plain-data snapshot on `parsed.captureSideChannel` via
|
|
79
|
+
// `kotlinProvider.collectCaptureSideChannel`; this restores it into the
|
|
80
|
+
// module map WITHOUT any tree-sitter re-parse (the #1983 fix). The
|
|
81
|
+
// freshly-extracted leg never calls this — its marks were just populated in
|
|
82
|
+
// this process. Runs BEFORE `populateOwners` so the restored companion map is
|
|
83
|
+
// visible to it.
|
|
84
|
+
applyCaptureSideChannel: applyKotlinCaptureSideChannel,
|
|
70
85
|
populateOwners: (parsed) => populateKotlinOwners(parsed),
|
|
71
86
|
isSuperReceiver: (text) => text.trim() === 'super',
|
|
72
87
|
isStaticOnly: isKotlinStaticOnly,
|