gitnexus 1.6.6-rc.98 → 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 +247 -26
- 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
|
@@ -67,10 +67,14 @@ export function interpretJavaTypeBinding(captures) {
|
|
|
67
67
|
const typeCap = captures['@type-binding.type'];
|
|
68
68
|
if (nameCap === undefined || typeCap === undefined)
|
|
69
69
|
return null;
|
|
70
|
-
// Strip
|
|
71
|
-
// `
|
|
72
|
-
//
|
|
73
|
-
|
|
70
|
+
// Strip generics BEFORE the qualifier (F41 #1928). Stripping the qualifier
|
|
71
|
+
// first uses `lastIndexOf('.')`, which for a qualified *type argument*
|
|
72
|
+
// (`Map<String, com.example.User>`) cuts inside the generic and yields a
|
|
73
|
+
// corrupted `User>`. Unwrapping generics first reduces the string to a single
|
|
74
|
+
// (possibly qualified) class name, then the qualifier strip leaves the bare
|
|
75
|
+
// simple name. `stripGeneric`'s erasure fallback is qualifier-tolerant so a
|
|
76
|
+
// qualified generic base (`com.example.BaseModel<T>`) still reduces correctly.
|
|
77
|
+
const rawType = stripQualifier(stripGeneric(typeCap.text.trim()));
|
|
74
78
|
// Skip `var` — tree-sitter-java parses `var` as type_identifier with
|
|
75
79
|
// text "var". When used without a constructor initializer, there's no
|
|
76
80
|
// concrete type to bind.
|
|
@@ -120,8 +124,10 @@ function stripGeneric(text) {
|
|
|
120
124
|
// `BaseModel<T>` → `BaseModel`, `Builder<Self>` → `Builder`.
|
|
121
125
|
// This mirrors JVM type erasure — the raw class name is the resolvable symbol.
|
|
122
126
|
// The pattern matches up to the first `<` to handle nested generics safely
|
|
123
|
-
// (e.g. `BaseModel<List<String>>` → `BaseModel`).
|
|
124
|
-
|
|
127
|
+
// (e.g. `BaseModel<List<String>>` → `BaseModel`). The base is allowed to be
|
|
128
|
+
// qualified (`com.example.BaseModel<T>` → `com.example.BaseModel`) since the
|
|
129
|
+
// caller strips the qualifier afterwards (F41 #1928).
|
|
130
|
+
const fallback = text.match(/^((?:[A-Za-z_$][A-Za-z0-9_$]*\.)*[A-Za-z_$][A-Za-z0-9_$]*)<.+>$/s);
|
|
125
131
|
if (fallback !== null)
|
|
126
132
|
return fallback[1].trim();
|
|
127
133
|
return text;
|
|
@@ -9,11 +9,24 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { isClassLike } from '../../scope-resolution/scope/walkers.js';
|
|
11
11
|
import { getJavaParser } from './query.js';
|
|
12
|
-
import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
|
|
12
|
+
import { parseSourceSafe, ParseTimeoutError } from '../../../tree-sitter/safe-parse.js';
|
|
13
13
|
import { logger } from '../../../logger.js';
|
|
14
|
-
function extractPackageName(content, cachedTree) {
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
function extractPackageName(content, filePath, cachedTree) {
|
|
15
|
+
let tree = cachedTree;
|
|
16
|
+
if (tree === undefined) {
|
|
17
|
+
try {
|
|
18
|
+
tree = parseSourceSafe(getJavaParser(), content);
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
if (err instanceof ParseTimeoutError) {
|
|
22
|
+
// Degrade to "no package" so a single pathological file doesn't abort
|
|
23
|
+
// same-package sibling injection for the whole run.
|
|
24
|
+
logger.warn({ file: filePath }, 'java package-siblings: parse timed out, treating as no package');
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
throw err;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
17
30
|
for (const child of tree.rootNode.namedChildren) {
|
|
18
31
|
if (child.type === 'package_declaration') {
|
|
19
32
|
const scoped = child.namedChildren.find((c) => c.type === 'scoped_identifier' || c.type === 'identifier');
|
|
@@ -28,7 +41,7 @@ export function populateJavaPackageSiblings(parsedFiles, indexes, ctx) {
|
|
|
28
41
|
const content = ctx.fileContents.get(parsed.filePath);
|
|
29
42
|
if (content === undefined)
|
|
30
43
|
continue;
|
|
31
|
-
const pkg = extractPackageName(content, ctx.treeCache?.get(parsed.filePath));
|
|
44
|
+
const pkg = extractPackageName(content, parsed.filePath, ctx.treeCache?.get(parsed.filePath));
|
|
32
45
|
let bucket = buckets.get(pkg);
|
|
33
46
|
if (bucket === undefined) {
|
|
34
47
|
bucket = { parsed: [], moduleScopes: [] };
|
|
@@ -212,8 +212,23 @@ const JAVA_SCOPE_QUERY = `
|
|
|
212
212
|
type: (generic_type
|
|
213
213
|
(type_identifier) @reference.name)) @reference.call.constructor
|
|
214
214
|
|
|
215
|
+
;; References — qualified constructor calls: new pkg.Foo(), new a.b.Foo() (F35 #1928)
|
|
216
|
+
;; tree-sitter-java parses \`pkg.Foo\` as a scoped_type_identifier whose final
|
|
217
|
+
;; child is the simple type. Bind that tail as @reference.name (trailing \`.\`
|
|
218
|
+
;; anchor = last child) so resolution targets \`Foo\`, not the raw \`pkg.Foo\` text.
|
|
219
|
+
;; Mirrors the TS/JS new-expression qualified-constructor capture.
|
|
215
220
|
(object_creation_expression
|
|
216
|
-
type: (scoped_type_identifier
|
|
221
|
+
type: (scoped_type_identifier
|
|
222
|
+
(type_identifier) @reference.name .) @reference.call.constructor.qualified) @reference.call.constructor
|
|
223
|
+
|
|
224
|
+
;; References — qualified + generic constructor calls: new pkg.Box<T>() (F35 #1928)
|
|
225
|
+
;; The base is a generic_type whose first child is a scoped_type_identifier, so
|
|
226
|
+
;; neither the simple-generic nor the plain-scoped arm above matches it. Bind the
|
|
227
|
+
;; scoped tail as @reference.name.
|
|
228
|
+
(object_creation_expression
|
|
229
|
+
type: (generic_type
|
|
230
|
+
(scoped_type_identifier
|
|
231
|
+
(type_identifier) @reference.name .) @reference.call.constructor.qualified)) @reference.call.constructor
|
|
217
232
|
|
|
218
233
|
;; References — method references: User::getName, obj::method
|
|
219
234
|
(method_reference
|
|
@@ -2,14 +2,8 @@
|
|
|
2
2
|
* Java `ScopeResolver` registered in `SCOPE_RESOLVERS` and consumed by
|
|
3
3
|
* the generic `runScopeResolution` orchestrator (RFC #909 Ring 3).
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Java is in `MIGRATED_LANGUAGES` — the scope-resolution registry is
|
|
8
|
-
* the primary call-resolution path. Parity: 178/178 (100%).
|
|
9
|
-
*
|
|
10
|
-
* **CI visibility:** The parity CI workflow (`ci-scope-parity.yml`)
|
|
11
|
-
* runs Java tests in both `REGISTRY_PRIMARY_JAVA=0` and `=1` modes
|
|
12
|
-
* automatically.
|
|
5
|
+
* Java resolves via the scope-resolution registry — the sole
|
|
6
|
+
* call-resolution path.
|
|
13
7
|
*/
|
|
14
8
|
import type { ScopeResolver } from '../../scope-resolution/contract/scope-resolver.js';
|
|
15
9
|
declare const javaScopeResolver: ScopeResolver;
|
|
@@ -2,14 +2,8 @@
|
|
|
2
2
|
* Java `ScopeResolver` registered in `SCOPE_RESOLVERS` and consumed by
|
|
3
3
|
* the generic `runScopeResolution` orchestrator (RFC #909 Ring 3).
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Java is in `MIGRATED_LANGUAGES` — the scope-resolution registry is
|
|
8
|
-
* the primary call-resolution path. Parity: 178/178 (100%).
|
|
9
|
-
*
|
|
10
|
-
* **CI visibility:** The parity CI workflow (`ci-scope-parity.yml`)
|
|
11
|
-
* runs Java tests in both `REGISTRY_PRIMARY_JAVA=0` and `=1` modes
|
|
12
|
-
* automatically.
|
|
5
|
+
* Java resolves via the scope-resolution registry — the sole
|
|
6
|
+
* call-resolution path.
|
|
13
7
|
*/
|
|
14
8
|
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
15
9
|
import { buildMro, defaultLinearize } from '../../scope-resolution/passes/mro.js';
|
|
@@ -14,7 +14,6 @@ import { javaTypeConfig } from '../type-extractors/jvm.js';
|
|
|
14
14
|
import { javaExportChecker } from '../export-detection.js';
|
|
15
15
|
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
|
16
16
|
import { javaImportConfig } from '../import-resolvers/configs/jvm.js';
|
|
17
|
-
import { extractJavaNamedBindings } from '../named-bindings/java.js';
|
|
18
17
|
import { JAVA_QUERIES } from '../tree-sitter-queries.js';
|
|
19
18
|
import { createCallExtractor } from '../call-extractors/generic.js';
|
|
20
19
|
import { javaCallConfig } from '../call-extractors/configs/jvm.js';
|
|
@@ -24,7 +23,6 @@ import { createMethodExtractor } from '../method-extractors/generic.js';
|
|
|
24
23
|
import { javaMethodConfig } from '../method-extractors/configs/jvm.js';
|
|
25
24
|
import { createVariableExtractor } from '../variable-extractors/generic.js';
|
|
26
25
|
import { javaVariableConfig } from '../variable-extractors/configs/jvm.js';
|
|
27
|
-
import { createHeritageExtractor } from '../heritage-extractors/generic.js';
|
|
28
26
|
import { emitJavaScopeCaptures, interpretJavaImport, interpretJavaTypeBinding, javaBindingScopeFor, javaImportOwningScope, javaMergeBindings, javaReceiverBinding, javaArityCompatibility, resolveJavaImportTarget, } from './java/index.js';
|
|
29
27
|
const orderJavaSameNameTypeCandidates = ({ callSiteFilePath, candidates, }) => {
|
|
30
28
|
if (!callSiteFilePath.endsWith('.java'))
|
|
@@ -88,15 +86,12 @@ export const javaProvider = defineLanguage({
|
|
|
88
86
|
typeConfig: javaTypeConfig,
|
|
89
87
|
exportChecker: javaExportChecker,
|
|
90
88
|
importResolver: createImportResolver(javaImportConfig),
|
|
91
|
-
namedBindingExtractor: extractJavaNamedBindings,
|
|
92
|
-
interfaceNamePattern: /^I[A-Z]/,
|
|
93
89
|
mroStrategy: 'implements-split',
|
|
94
90
|
callExtractor: createCallExtractor(javaCallConfig),
|
|
95
91
|
fieldExtractor: createFieldExtractor(javaConfig),
|
|
96
92
|
methodExtractor: createMethodExtractor(javaMethodConfig),
|
|
97
93
|
variableExtractor: createVariableExtractor(javaVariableConfig),
|
|
98
94
|
classExtractor: createClassExtractor(javaClassConfig),
|
|
99
|
-
heritageExtractor: createHeritageExtractor(SupportedLanguages.Java),
|
|
100
95
|
// ── RFC #909 Ring 3: scope-based resolution hooks ──
|
|
101
96
|
emitScopeCaptures: emitJavaScopeCaptures,
|
|
102
97
|
interpretImport: interpretJavaImport,
|
|
@@ -34,6 +34,7 @@ import { synthesizeTsReceiverBinding } from '../typescript/receiver-binding.js';
|
|
|
34
34
|
import { isArrayMethodCallbackArrow } from '../typescript/array-callback.js';
|
|
35
35
|
import { getTreeSitterBufferSize } from '../../constants.js';
|
|
36
36
|
import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
|
|
37
|
+
import { deriveDefaultExportHocName, isBlockedDefaultExportHoc, isDefaultExportHocFunctionNode, } from '../../ts-js-hoc-utils.js';
|
|
37
38
|
/** JS function-like node types that may carry a synthesized `this` binding.
|
|
38
39
|
* Kept in sync with the `@scope.function` patterns in `query.ts`. */
|
|
39
40
|
const FUNCTION_NODE_TYPES = [
|
|
@@ -59,6 +60,41 @@ function pickFirstDefined(grouped, tags) {
|
|
|
59
60
|
}
|
|
60
61
|
return undefined;
|
|
61
62
|
}
|
|
63
|
+
function pickFirstNode(groupedNodes, tags) {
|
|
64
|
+
for (const tag of tags) {
|
|
65
|
+
const node = groupedNodes[tag];
|
|
66
|
+
if (node !== undefined)
|
|
67
|
+
return node;
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
/** Walks the parent chain from `node` (inclusive), returning the first node
|
|
72
|
+
* whose type matches, or null. Faster than `findNodeAtRange` when the caller
|
|
73
|
+
* already holds the anchor node — avoids re-scanning the tree from the root. */
|
|
74
|
+
function findSelfOrAncestorOfType(node, type) {
|
|
75
|
+
if (node === undefined)
|
|
76
|
+
return null;
|
|
77
|
+
let current = node;
|
|
78
|
+
while (current !== null) {
|
|
79
|
+
if (current.type === type)
|
|
80
|
+
return current;
|
|
81
|
+
current = current.parent;
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
/** Walks the parent chain from `node` (inclusive), returning the first node
|
|
86
|
+
* whose type is in the set, or null. Plural form of {@link findSelfOrAncestorOfType}. */
|
|
87
|
+
function findSelfOrAncestorOfTypes(node, types) {
|
|
88
|
+
if (node === undefined)
|
|
89
|
+
return null;
|
|
90
|
+
let current = node;
|
|
91
|
+
while (current !== null) {
|
|
92
|
+
if (types.includes(current.type))
|
|
93
|
+
return current;
|
|
94
|
+
current = current.parent;
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
62
98
|
/** Filter `@reference.read.member` in non-read contexts (same logic as TS). */
|
|
63
99
|
function shouldEmitReadMember(memberNode) {
|
|
64
100
|
const parent = memberNode.parent;
|
|
@@ -79,8 +115,14 @@ function shouldEmitReadMember(memberNode) {
|
|
|
79
115
|
return true;
|
|
80
116
|
}
|
|
81
117
|
}
|
|
82
|
-
/** Find the first JS function-like node at the given range.
|
|
83
|
-
|
|
118
|
+
/** Find the first JS function-like node at the given range.
|
|
119
|
+
* Prefers the threaded anchor node (walk up its parent chain) so the common
|
|
120
|
+
* case avoids a root re-scan; falls back to a range scan from root only when
|
|
121
|
+
* the anchor isn't a function-like (or isn't supplied). */
|
|
122
|
+
function findFunctionNode(rootNode, range, anchorNode) {
|
|
123
|
+
const fromAnchor = findSelfOrAncestorOfTypes(anchorNode, FUNCTION_NODE_TYPES);
|
|
124
|
+
if (fromAnchor !== null)
|
|
125
|
+
return fromAnchor;
|
|
84
126
|
for (const nodeType of FUNCTION_NODE_TYPES) {
|
|
85
127
|
const n = findNodeAtRange(rootNode, range, nodeType);
|
|
86
128
|
if (n !== null)
|
|
@@ -550,6 +592,100 @@ function synthesizeConstructorFieldBindings(root, out) {
|
|
|
550
592
|
}
|
|
551
593
|
}
|
|
552
594
|
}
|
|
595
|
+
// ─── Inheritance references (EXTENDS) ────────────────────────────────────
|
|
596
|
+
/**
|
|
597
|
+
* Synthesize `@reference.inherits` captures from JavaScript class heritage so
|
|
598
|
+
* the registry-primary scope-resolution path emits EXTENDS edges (mirrors C#
|
|
599
|
+
* `synthesizeCsharpInheritanceReferences` / C++ `emitCppInheritanceCaptures`).
|
|
600
|
+
* Without this, JS inheritance edges came only from the legacy heritage-capture
|
|
601
|
+
* leg (removed in #942), which the worker pipeline drops for registry-primary
|
|
602
|
+
* languages, yielding 0 inheritance edges in worker mode (issue #1951).
|
|
603
|
+
*
|
|
604
|
+
* Scope is intentionally limited to a `class_declaration`'s `class_heritage`
|
|
605
|
+
* base, matching the legacy JavaScript heritage query's class scope and its
|
|
606
|
+
* supertype shape descriptor (`javascriptHeritageShapes`:
|
|
607
|
+
* `['identifier', 'member_expression']`). JavaScript classes have a single
|
|
608
|
+
* `extends` base and no `implements`, so every emission is an EXTENDS (decided
|
|
609
|
+
* downstream from the resolved target's symbol kind in
|
|
610
|
+
* `preEmitInheritanceEdges`).
|
|
611
|
+
*
|
|
612
|
+
* Bases handled (at parity with the legacy heritage leg, #1951):
|
|
613
|
+
* - `(identifier)` base (`extends Base`) — bare simple name.
|
|
614
|
+
* - `(member_expression)` base (`extends ns.Base`, `extends a.b.Base`) —
|
|
615
|
+
* qualified; reduced to its trailing `property_identifier` (`Base`) so the
|
|
616
|
+
* V1 `findClassBindingInScope` simple-name contract holds. This mirrors the
|
|
617
|
+
* TypeScript `terminalTsTypeNameNode` member_expression arm.
|
|
618
|
+
*
|
|
619
|
+
* Deliberately NOT emitted (preserving parity with the legacy query, incl. the
|
|
620
|
+
* #1943 HOC behavior):
|
|
621
|
+
* - `class` EXPRESSION nodes (legacy captures `class_declaration` only).
|
|
622
|
+
* - `call_expression` / HOC bases (`extends withFoo(Bar)`) — not a legacy
|
|
623
|
+
* heritage shape; left to the normal call-resolution path.
|
|
624
|
+
*
|
|
625
|
+
* The `@reference.name` bare-name text emitted for each base equals
|
|
626
|
+
* `normalizeSupertypeName(base)` (the legacy leg's reduction): `Base` → `Base`,
|
|
627
|
+
* `ns.Base` → `Base`, `a.b.Base` → `Base` — keeping the two legs at parity.
|
|
628
|
+
*/
|
|
629
|
+
function synthesizeJsInheritanceReferences(root, out) {
|
|
630
|
+
const stack = [root];
|
|
631
|
+
for (;;) {
|
|
632
|
+
const node = stack.pop();
|
|
633
|
+
if (node === undefined)
|
|
634
|
+
break;
|
|
635
|
+
for (const child of node.namedChildren) {
|
|
636
|
+
if (child !== null)
|
|
637
|
+
stack.push(child);
|
|
638
|
+
}
|
|
639
|
+
if (node.type !== 'class_declaration')
|
|
640
|
+
continue;
|
|
641
|
+
// Find the `class_heritage` child (holds the single `extends` base).
|
|
642
|
+
let heritage = null;
|
|
643
|
+
for (const child of node.namedChildren) {
|
|
644
|
+
if (child !== null && child.type === 'class_heritage') {
|
|
645
|
+
heritage = child;
|
|
646
|
+
break;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
if (heritage === null)
|
|
650
|
+
continue;
|
|
651
|
+
// Emit for `(identifier)` and `(member_expression)` bases — matching the
|
|
652
|
+
// legacy heritage shape descriptor (`call_expression` HOC bases excluded).
|
|
653
|
+
for (const base of heritage.namedChildren) {
|
|
654
|
+
if (base === null)
|
|
655
|
+
continue;
|
|
656
|
+
const nameNode = terminalJsHeritageNameNode(base);
|
|
657
|
+
if (nameNode === null)
|
|
658
|
+
continue;
|
|
659
|
+
out.push({
|
|
660
|
+
'@reference.inherits': nodeToCapture('@reference.inherits', base),
|
|
661
|
+
'@reference.name': nodeToCapture('@reference.name', nameNode),
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
/** Resolve a JavaScript heritage base node to its bare simple-identifier node.
|
|
667
|
+
* `Base` (identifier) → `Base`, `ns.Base` / `a.b.Base` (member_expression) →
|
|
668
|
+
* the trailing `property_identifier` `Base`. Mirrors the TypeScript
|
|
669
|
+
* `terminalTsTypeNameNode` member_expression arm. Returns null for any other
|
|
670
|
+
* shape (e.g. `call_expression` HOC bases), which is then skipped — keeping
|
|
671
|
+
* parity with the legacy `javascriptHeritageShapes` descriptor and
|
|
672
|
+
* `normalizeSupertypeName`'s reduction of each shape. */
|
|
673
|
+
function terminalJsHeritageNameNode(node) {
|
|
674
|
+
switch (node.type) {
|
|
675
|
+
case 'identifier':
|
|
676
|
+
// `extends ns.Base` parses as a member_expression whose tail is a
|
|
677
|
+
// `property_identifier` (not an identifier) — treat it as a leaf name.
|
|
678
|
+
case 'property_identifier':
|
|
679
|
+
return node;
|
|
680
|
+
case 'member_expression': {
|
|
681
|
+
// Qualified `ns.Base` / `a.b.Base` → tail identifier `Base`.
|
|
682
|
+
const tail = node.lastNamedChild;
|
|
683
|
+
return tail === null ? null : terminalJsHeritageNameNode(tail);
|
|
684
|
+
}
|
|
685
|
+
default:
|
|
686
|
+
return null;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
553
689
|
// ─── Main emitter ──────────────────────────────────────────────────────────
|
|
554
690
|
export function emitJsScopeCaptures(sourceText, filePath, cachedTree) {
|
|
555
691
|
let tree = cachedTree;
|
|
@@ -565,16 +701,28 @@ export function emitJsScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
565
701
|
const out = [];
|
|
566
702
|
for (const m of rawMatches) {
|
|
567
703
|
const grouped = {};
|
|
704
|
+
// Parallel tag -> captured SyntaxNode map. The query hands us each matched
|
|
705
|
+
// node as c.node, so anchors resolve by walking up from the captured node
|
|
706
|
+
// (findSelfOrAncestorOfType[s]) instead of re-deriving them with
|
|
707
|
+
// findNodeAtRange(tree.rootNode, ...) per match — the O(matches x N)
|
|
708
|
+
// root-walk fixed for go #1915 / python #1918 / csharp, mirrored here
|
|
709
|
+
// (mirrors typescript/captures.ts groupedNodes).
|
|
710
|
+
const groupedNodes = {};
|
|
568
711
|
for (const c of m.captures) {
|
|
569
712
|
const tag = '@' + c.name;
|
|
570
713
|
grouped[tag] = nodeToCapture(tag, c.node);
|
|
714
|
+
groupedNodes[tag] = c.node;
|
|
571
715
|
}
|
|
572
716
|
if (Object.keys(grouped).length === 0)
|
|
573
717
|
continue;
|
|
574
718
|
// Decompose ESM import_statement / re-export export_statement.
|
|
575
719
|
if (grouped['@import.statement'] !== undefined) {
|
|
576
720
|
const stmtCapture = grouped['@import.statement'];
|
|
577
|
-
const stmtNode =
|
|
721
|
+
const stmtNode = findSelfOrAncestorOfTypes(groupedNodes['@import.statement'], [
|
|
722
|
+
'import_statement',
|
|
723
|
+
'export_statement',
|
|
724
|
+
]) ??
|
|
725
|
+
findNodeAtRange(tree.rootNode, stmtCapture.range, 'import_statement') ??
|
|
578
726
|
findNodeAtRange(tree.rootNode, stmtCapture.range, 'export_statement');
|
|
579
727
|
if (stmtNode !== null) {
|
|
580
728
|
const decomposed = splitImportStatement(stmtNode);
|
|
@@ -586,7 +734,8 @@ export function emitJsScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
586
734
|
// Decompose dynamic import() calls.
|
|
587
735
|
if (grouped['@import.dynamic'] !== undefined) {
|
|
588
736
|
const dynCapture = grouped['@import.dynamic'];
|
|
589
|
-
const callNode =
|
|
737
|
+
const callNode = findSelfOrAncestorOfType(groupedNodes['@import.dynamic'], 'call_expression') ??
|
|
738
|
+
findNodeAtRange(tree.rootNode, dynCapture.range, 'call_expression');
|
|
590
739
|
if (callNode !== null) {
|
|
591
740
|
const decomposed = splitImportStatement(callNode);
|
|
592
741
|
for (const d of decomposed)
|
|
@@ -597,7 +746,8 @@ export function emitJsScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
597
746
|
// Filter @reference.read.member false-positives.
|
|
598
747
|
if (grouped['@reference.read.member'] !== undefined) {
|
|
599
748
|
const anchor = grouped['@reference.read.member'];
|
|
600
|
-
const memberNode =
|
|
749
|
+
const memberNode = findSelfOrAncestorOfType(groupedNodes['@reference.read.member'], 'member_expression') ??
|
|
750
|
+
findNodeAtRange(tree.rootNode, anchor.range, 'member_expression');
|
|
601
751
|
if (memberNode === null || !shouldEmitReadMember(memberNode)) {
|
|
602
752
|
continue;
|
|
603
753
|
}
|
|
@@ -611,15 +761,25 @@ export function emitJsScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
611
761
|
// scope instead of a phantom Function.
|
|
612
762
|
const fnDeclAnchor = grouped['@declaration.function'];
|
|
613
763
|
if (fnDeclAnchor !== undefined) {
|
|
614
|
-
const arrowNode = findFunctionNode(tree.rootNode, fnDeclAnchor.range);
|
|
764
|
+
const arrowNode = findFunctionNode(tree.rootNode, fnDeclAnchor.range, groupedNodes['@declaration.function']);
|
|
615
765
|
if (arrowNode !== null && isArrayMethodCallbackArrow(arrowNode)) {
|
|
616
766
|
continue;
|
|
617
767
|
}
|
|
768
|
+
if (arrowNode !== null && isBlockedDefaultExportHoc(arrowNode)) {
|
|
769
|
+
continue;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
if (fnDeclAnchor !== undefined) {
|
|
773
|
+
const fnNode = findFunctionNode(tree.rootNode, fnDeclAnchor.range, groupedNodes['@declaration.function']);
|
|
774
|
+
if (fnNode !== null && isDefaultExportHocFunctionNode(fnNode)) {
|
|
775
|
+
grouped['@declaration.name'] = syntheticCapture('@declaration.name', fnNode, deriveDefaultExportHocName(filePath));
|
|
776
|
+
}
|
|
618
777
|
}
|
|
619
778
|
// Synthesize arity metadata on function-like declarations.
|
|
620
779
|
const declAnchor = pickFirstDefined(grouped, FUNCTION_DECL_TAGS);
|
|
780
|
+
const declAnchorNode = pickFirstNode(groupedNodes, FUNCTION_DECL_TAGS);
|
|
621
781
|
if (declAnchor !== undefined) {
|
|
622
|
-
const fnNode = findFunctionNode(tree.rootNode, declAnchor.range);
|
|
782
|
+
const fnNode = findFunctionNode(tree.rootNode, declAnchor.range, declAnchorNode);
|
|
623
783
|
if (fnNode !== null) {
|
|
624
784
|
const arity = computeTsArityMetadata(fnNode);
|
|
625
785
|
if (arity.parameterCount !== undefined) {
|
|
@@ -633,10 +793,23 @@ export function emitJsScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
633
793
|
}
|
|
634
794
|
}
|
|
635
795
|
}
|
|
636
|
-
// Synthesize @reference.arity on callsites.
|
|
796
|
+
// Synthesize @reference.arity on callsites. Skip JSX element anchors: a JSX
|
|
797
|
+
// component used as a call argument (e.g. `render(<Foo .../>)`) is itself a
|
|
798
|
+
// @reference.call.* anchor, and the ascent below would climb into the
|
|
799
|
+
// enclosing call_expression and mis-attribute that call's arity to the
|
|
800
|
+
// component. A JSX component reference has no call arity here — this restores
|
|
801
|
+
// the pre-#1951 range-based behavior (no call_expression at the JSX range).
|
|
802
|
+
// The guard lives at this call site, not inside findSelfOrAncestorOfTypes,
|
|
803
|
+
// which is also used by the import-statement and function-scope ascents.
|
|
637
804
|
const callAnchor = pickFirstDefined(grouped, CALL_TAGS);
|
|
638
|
-
|
|
639
|
-
|
|
805
|
+
const callAnchorNode = pickFirstNode(groupedNodes, CALL_TAGS);
|
|
806
|
+
const anchorIsJsxElement = callAnchorNode?.type === 'jsx_self_closing_element' ||
|
|
807
|
+
callAnchorNode?.type === 'jsx_opening_element';
|
|
808
|
+
if (callAnchor !== undefined &&
|
|
809
|
+
grouped['@reference.arity'] === undefined &&
|
|
810
|
+
!anchorIsJsxElement) {
|
|
811
|
+
const callNode = findSelfOrAncestorOfTypes(callAnchorNode, ['call_expression', 'new_expression']) ??
|
|
812
|
+
findNodeAtRange(tree.rootNode, callAnchor.range, 'call_expression') ??
|
|
640
813
|
findNodeAtRange(tree.rootNode, callAnchor.range, 'new_expression');
|
|
641
814
|
if (callNode !== null) {
|
|
642
815
|
const argList = callNode.childForFieldName('arguments');
|
|
@@ -651,7 +824,7 @@ export function emitJsScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
651
824
|
// Synthesize `this` receiver type-bindings on class member functions.
|
|
652
825
|
const scopeFnAnchor = grouped['@scope.function'];
|
|
653
826
|
if (scopeFnAnchor !== undefined) {
|
|
654
|
-
const fnNode = findFunctionNode(tree.rootNode, scopeFnAnchor.range);
|
|
827
|
+
const fnNode = findFunctionNode(tree.rootNode, scopeFnAnchor.range, groupedNodes['@scope.function']);
|
|
655
828
|
if (fnNode !== null) {
|
|
656
829
|
const synth = synthesizeTsReceiverBinding(fnNode);
|
|
657
830
|
if (synth !== null)
|
|
@@ -666,5 +839,6 @@ export function emitJsScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
666
839
|
synthesizeDestructuringBindings(tree.rootNode, out);
|
|
667
840
|
synthesizeForOfMapTupleBindings(tree.rootNode, out);
|
|
668
841
|
synthesizeInstanceofNarrowings(tree.rootNode, out);
|
|
842
|
+
synthesizeJsInheritanceReferences(tree.rootNode, out);
|
|
669
843
|
return out;
|
|
670
844
|
}
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
*/
|
|
48
48
|
import Parser from 'tree-sitter';
|
|
49
49
|
import JS from 'tree-sitter-javascript';
|
|
50
|
+
import { ARRAY_METHOD_NOT_ANY_OF_PREDICATE, DEFAULT_EXPORT_IDENTIFIER_NOT_ANY_OF_PREDICATE, } from '../../ts-js-hoc-utils.js';
|
|
50
51
|
const JS_GRAMMAR = JS;
|
|
51
52
|
/** True when the file should be parsed with the JSX-extended query. */
|
|
52
53
|
function isJsxFile(filePath) {
|
|
@@ -150,10 +151,13 @@ const JAVASCRIPT_SCOPE_QUERY = `
|
|
|
150
151
|
;; Those are filtered out emit-side in captures.ts via
|
|
151
152
|
;; isArrayMethodCallbackArrow (member-expression callee whose property
|
|
152
153
|
;; is a known Array method), so only the @declaration.const survives.
|
|
154
|
+
;; Excludes common array methods (map, filter, reduce, etc.) to avoid
|
|
155
|
+
;; false positives like \`const x = arr.map(a => ...)\`.
|
|
153
156
|
(lexical_declaration
|
|
154
157
|
(variable_declarator
|
|
155
158
|
name: (identifier) @declaration.name
|
|
156
159
|
value: (call_expression
|
|
160
|
+
function: (identifier)
|
|
157
161
|
arguments: (arguments
|
|
158
162
|
(arrow_function) @declaration.function))))
|
|
159
163
|
|
|
@@ -161,14 +165,36 @@ const JAVASCRIPT_SCOPE_QUERY = `
|
|
|
161
165
|
(variable_declarator
|
|
162
166
|
name: (identifier) @declaration.name
|
|
163
167
|
value: (call_expression
|
|
168
|
+
function: (identifier)
|
|
164
169
|
arguments: (arguments
|
|
165
170
|
(function_expression) @declaration.function))))
|
|
166
171
|
|
|
172
|
+
(lexical_declaration
|
|
173
|
+
(variable_declarator
|
|
174
|
+
name: (identifier) @declaration.name
|
|
175
|
+
value: (call_expression
|
|
176
|
+
function: (member_expression
|
|
177
|
+
property: (property_identifier) @callee)
|
|
178
|
+
arguments: (arguments
|
|
179
|
+
(arrow_function) @declaration.function)))
|
|
180
|
+
${ARRAY_METHOD_NOT_ANY_OF_PREDICATE})
|
|
181
|
+
|
|
182
|
+
(lexical_declaration
|
|
183
|
+
(variable_declarator
|
|
184
|
+
name: (identifier) @declaration.name
|
|
185
|
+
value: (call_expression
|
|
186
|
+
function: (member_expression
|
|
187
|
+
property: (property_identifier) @callee)
|
|
188
|
+
arguments: (arguments
|
|
189
|
+
(function_expression) @declaration.function)))
|
|
190
|
+
${ARRAY_METHOD_NOT_ANY_OF_PREDICATE})
|
|
191
|
+
|
|
167
192
|
(export_statement
|
|
168
193
|
declaration: (lexical_declaration
|
|
169
194
|
(variable_declarator
|
|
170
195
|
name: (identifier) @declaration.name
|
|
171
196
|
value: (call_expression
|
|
197
|
+
function: (identifier)
|
|
172
198
|
arguments: (arguments
|
|
173
199
|
(arrow_function) @declaration.function)))))
|
|
174
200
|
|
|
@@ -177,13 +203,37 @@ const JAVASCRIPT_SCOPE_QUERY = `
|
|
|
177
203
|
(variable_declarator
|
|
178
204
|
name: (identifier) @declaration.name
|
|
179
205
|
value: (call_expression
|
|
206
|
+
function: (identifier)
|
|
180
207
|
arguments: (arguments
|
|
181
208
|
(function_expression) @declaration.function)))))
|
|
182
209
|
|
|
210
|
+
(export_statement
|
|
211
|
+
declaration: (lexical_declaration
|
|
212
|
+
(variable_declarator
|
|
213
|
+
name: (identifier) @declaration.name
|
|
214
|
+
value: (call_expression
|
|
215
|
+
function: (member_expression
|
|
216
|
+
property: (property_identifier) @callee)
|
|
217
|
+
arguments: (arguments
|
|
218
|
+
(arrow_function) @declaration.function))))
|
|
219
|
+
${ARRAY_METHOD_NOT_ANY_OF_PREDICATE})
|
|
220
|
+
|
|
221
|
+
(export_statement
|
|
222
|
+
declaration: (lexical_declaration
|
|
223
|
+
(variable_declarator
|
|
224
|
+
name: (identifier) @declaration.name
|
|
225
|
+
value: (call_expression
|
|
226
|
+
function: (member_expression
|
|
227
|
+
property: (property_identifier) @callee)
|
|
228
|
+
arguments: (arguments
|
|
229
|
+
(function_expression) @declaration.function))))
|
|
230
|
+
${ARRAY_METHOD_NOT_ANY_OF_PREDICATE})
|
|
231
|
+
|
|
183
232
|
(variable_declaration
|
|
184
233
|
(variable_declarator
|
|
185
234
|
name: (identifier) @declaration.name
|
|
186
235
|
value: (call_expression
|
|
236
|
+
function: (identifier)
|
|
187
237
|
arguments: (arguments
|
|
188
238
|
(arrow_function) @declaration.function))))
|
|
189
239
|
|
|
@@ -191,9 +241,64 @@ const JAVASCRIPT_SCOPE_QUERY = `
|
|
|
191
241
|
(variable_declarator
|
|
192
242
|
name: (identifier) @declaration.name
|
|
193
243
|
value: (call_expression
|
|
244
|
+
function: (identifier)
|
|
194
245
|
arguments: (arguments
|
|
195
246
|
(function_expression) @declaration.function))))
|
|
196
247
|
|
|
248
|
+
(variable_declaration
|
|
249
|
+
(variable_declarator
|
|
250
|
+
name: (identifier) @declaration.name
|
|
251
|
+
value: (call_expression
|
|
252
|
+
function: (member_expression
|
|
253
|
+
property: (property_identifier) @callee)
|
|
254
|
+
arguments: (arguments
|
|
255
|
+
(arrow_function) @declaration.function)))
|
|
256
|
+
${ARRAY_METHOD_NOT_ANY_OF_PREDICATE})
|
|
257
|
+
|
|
258
|
+
(variable_declaration
|
|
259
|
+
(variable_declarator
|
|
260
|
+
name: (identifier) @declaration.name
|
|
261
|
+
value: (call_expression
|
|
262
|
+
function: (member_expression
|
|
263
|
+
property: (property_identifier) @callee)
|
|
264
|
+
arguments: (arguments
|
|
265
|
+
(function_expression) @declaration.function)))
|
|
266
|
+
${ARRAY_METHOD_NOT_ANY_OF_PREDICATE})
|
|
267
|
+
|
|
268
|
+
;; HOC-wrapped default exports (JS parity with TS patterns in
|
|
269
|
+
;; languages/typescript/query.ts). The emit phase rewrites
|
|
270
|
+
;; @declaration.name to a file-derived name so wrapper helpers do not
|
|
271
|
+
;; become the graph-visible symbol name.
|
|
272
|
+
((export_statement
|
|
273
|
+
value: (call_expression
|
|
274
|
+
function: (identifier) @hoc
|
|
275
|
+
arguments: (arguments
|
|
276
|
+
(arrow_function) @declaration.function)))
|
|
277
|
+
${DEFAULT_EXPORT_IDENTIFIER_NOT_ANY_OF_PREDICATE})
|
|
278
|
+
|
|
279
|
+
((export_statement
|
|
280
|
+
value: (call_expression
|
|
281
|
+
function: (identifier) @hoc
|
|
282
|
+
arguments: (arguments
|
|
283
|
+
(function_expression) @declaration.function)))
|
|
284
|
+
${DEFAULT_EXPORT_IDENTIFIER_NOT_ANY_OF_PREDICATE})
|
|
285
|
+
|
|
286
|
+
((export_statement
|
|
287
|
+
value: (call_expression
|
|
288
|
+
function: (member_expression
|
|
289
|
+
property: (property_identifier) @callee)
|
|
290
|
+
arguments: (arguments
|
|
291
|
+
(arrow_function) @declaration.function)))
|
|
292
|
+
${ARRAY_METHOD_NOT_ANY_OF_PREDICATE})
|
|
293
|
+
|
|
294
|
+
((export_statement
|
|
295
|
+
value: (call_expression
|
|
296
|
+
function: (member_expression
|
|
297
|
+
property: (property_identifier) @callee)
|
|
298
|
+
arguments: (arguments
|
|
299
|
+
(function_expression) @declaration.function)))
|
|
300
|
+
${ARRAY_METHOD_NOT_ANY_OF_PREDICATE})
|
|
301
|
+
|
|
197
302
|
;; Variable / constant declarations (non-function values).
|
|
198
303
|
(lexical_declaration
|
|
199
304
|
(variable_declarator
|
|
@@ -334,7 +439,8 @@ const JAVASCRIPT_SCOPE_QUERY = `
|
|
|
334
439
|
constructor: (identifier) @reference.name) @reference.call.constructor
|
|
335
440
|
|
|
336
441
|
(new_expression
|
|
337
|
-
constructor: (member_expression
|
|
442
|
+
constructor: (member_expression
|
|
443
|
+
property: (property_identifier) @reference.name) @reference.call.constructor.qualified) @reference.call.constructor
|
|
338
444
|
|
|
339
445
|
;; Write access: obj.field = value
|
|
340
446
|
(assignment_expression
|