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,12 @@
|
|
|
1
|
+
import type { SyntaxNode } from './utils/ast-helpers.js';
|
|
2
|
+
export declare const ARRAY_METHOD_HOC_BLOCKLIST: readonly ["map", "filter", "reduce", "forEach", "find", "findIndex", "some", "every", "flatMap", "sort", "splice", "slice", "concat", "fill", "copyWithin", "join", "flat", "at", "entries", "keys", "values", "indexOf", "lastIndexOf", "includes", "pop", "push", "shift", "unshift", "reverse", "reduceRight", "toSorted", "toReversed", "toSpliced", "with"];
|
|
3
|
+
export declare const ARRAY_METHOD_HOC_BLOCKLIST_SET: ReadonlySet<string>;
|
|
4
|
+
export declare const DEFAULT_EXPORT_IDENTIFIER_BLOCKLIST: readonly ["setTimeout", "setInterval", "queueMicrotask", "requestAnimationFrame", "requestIdleCallback"];
|
|
5
|
+
export declare const DEFAULT_EXPORT_IDENTIFIER_BLOCKLIST_SET: ReadonlySet<string>;
|
|
6
|
+
export declare const ARRAY_CALLBACK_METHODS: ReadonlySet<string>;
|
|
7
|
+
export declare function buildNotAnyOfPredicate(captureName: string, values: readonly string[]): string;
|
|
8
|
+
export declare const ARRAY_METHOD_NOT_ANY_OF_PREDICATE: string;
|
|
9
|
+
export declare const DEFAULT_EXPORT_IDENTIFIER_NOT_ANY_OF_PREDICATE: string;
|
|
10
|
+
export declare function deriveDefaultExportHocName(filePath: string): string;
|
|
11
|
+
export declare function isDefaultExportHocFunctionNode(node: SyntaxNode): boolean;
|
|
12
|
+
export declare function isBlockedDefaultExportHoc(node: SyntaxNode): boolean;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
// Member-expression callees that should never classify a callback-wrapped
|
|
3
|
+
// binding as a top-level Function. This covers callback-taking Array methods
|
|
4
|
+
// plus a few value-returning methods that share the same AST shape.
|
|
5
|
+
export const ARRAY_METHOD_HOC_BLOCKLIST = [
|
|
6
|
+
'map',
|
|
7
|
+
'filter',
|
|
8
|
+
'reduce',
|
|
9
|
+
'forEach',
|
|
10
|
+
'find',
|
|
11
|
+
'findIndex',
|
|
12
|
+
'some',
|
|
13
|
+
'every',
|
|
14
|
+
'flatMap',
|
|
15
|
+
'sort',
|
|
16
|
+
'splice',
|
|
17
|
+
'slice',
|
|
18
|
+
'concat',
|
|
19
|
+
'fill',
|
|
20
|
+
'copyWithin',
|
|
21
|
+
'join',
|
|
22
|
+
'flat',
|
|
23
|
+
'at',
|
|
24
|
+
'entries',
|
|
25
|
+
'keys',
|
|
26
|
+
'values',
|
|
27
|
+
'indexOf',
|
|
28
|
+
'lastIndexOf',
|
|
29
|
+
'includes',
|
|
30
|
+
'pop',
|
|
31
|
+
'push',
|
|
32
|
+
'shift',
|
|
33
|
+
'unshift',
|
|
34
|
+
'reverse',
|
|
35
|
+
'reduceRight',
|
|
36
|
+
'toSorted',
|
|
37
|
+
'toReversed',
|
|
38
|
+
'toSpliced',
|
|
39
|
+
'with',
|
|
40
|
+
];
|
|
41
|
+
export const ARRAY_METHOD_HOC_BLOCKLIST_SET = new Set(ARRAY_METHOD_HOC_BLOCKLIST);
|
|
42
|
+
// Identifier-callee default exports stay intentionally conservative: only a
|
|
43
|
+
// few obvious callback-taking built-ins are suppressed here. Framework HOCs
|
|
44
|
+
// like defineEventHandler still pass through and are named from the module.
|
|
45
|
+
export const DEFAULT_EXPORT_IDENTIFIER_BLOCKLIST = [
|
|
46
|
+
'setTimeout',
|
|
47
|
+
'setInterval',
|
|
48
|
+
'queueMicrotask',
|
|
49
|
+
'requestAnimationFrame',
|
|
50
|
+
'requestIdleCallback',
|
|
51
|
+
];
|
|
52
|
+
export const DEFAULT_EXPORT_IDENTIFIER_BLOCKLIST_SET = new Set(DEFAULT_EXPORT_IDENTIFIER_BLOCKLIST);
|
|
53
|
+
export const ARRAY_CALLBACK_METHODS = new Set([
|
|
54
|
+
'map',
|
|
55
|
+
'filter',
|
|
56
|
+
'find',
|
|
57
|
+
'findIndex',
|
|
58
|
+
'findLast',
|
|
59
|
+
'findLastIndex',
|
|
60
|
+
'forEach',
|
|
61
|
+
'reduce',
|
|
62
|
+
'reduceRight',
|
|
63
|
+
'some',
|
|
64
|
+
'every',
|
|
65
|
+
'flatMap',
|
|
66
|
+
'sort',
|
|
67
|
+
]);
|
|
68
|
+
export function buildNotAnyOfPredicate(captureName, values) {
|
|
69
|
+
return `(#not-any-of? @${captureName} ${values.map((value) => `"${value}"`).join(' ')})`;
|
|
70
|
+
}
|
|
71
|
+
export const ARRAY_METHOD_NOT_ANY_OF_PREDICATE = buildNotAnyOfPredicate('callee', ARRAY_METHOD_HOC_BLOCKLIST);
|
|
72
|
+
export const DEFAULT_EXPORT_IDENTIFIER_NOT_ANY_OF_PREDICATE = buildNotAnyOfPredicate('hoc', DEFAULT_EXPORT_IDENTIFIER_BLOCKLIST);
|
|
73
|
+
export function deriveDefaultExportHocName(filePath) {
|
|
74
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
75
|
+
// Use individual path.posix helpers instead of path.posix.parse() to avoid
|
|
76
|
+
// triggering the require-safe-parse ESLint rule (which treats any .parse()
|
|
77
|
+
// call in src/core/ as a potential unsafe tree-sitter direct-parse).
|
|
78
|
+
const ext = path.posix.extname(normalized);
|
|
79
|
+
const name = path.posix.basename(normalized, ext);
|
|
80
|
+
const dir = path.posix.dirname(normalized);
|
|
81
|
+
if (name === 'index') {
|
|
82
|
+
const parent = path.posix.basename(dir);
|
|
83
|
+
if (parent !== '' && parent !== '.' && parent !== '/')
|
|
84
|
+
return parent;
|
|
85
|
+
}
|
|
86
|
+
return name || 'default';
|
|
87
|
+
}
|
|
88
|
+
export function isDefaultExportHocFunctionNode(node) {
|
|
89
|
+
const args = node.parent;
|
|
90
|
+
if (args === null || args.type !== 'arguments')
|
|
91
|
+
return false;
|
|
92
|
+
const callExpr = args.parent;
|
|
93
|
+
if (callExpr === null || callExpr.type !== 'call_expression')
|
|
94
|
+
return false;
|
|
95
|
+
return callExpr.parent?.type === 'export_statement';
|
|
96
|
+
}
|
|
97
|
+
export function isBlockedDefaultExportHoc(node) {
|
|
98
|
+
if (!isDefaultExportHocFunctionNode(node))
|
|
99
|
+
return false;
|
|
100
|
+
const callExpr = node.parent?.parent;
|
|
101
|
+
if (callExpr === null || callExpr?.type !== 'call_expression')
|
|
102
|
+
return false;
|
|
103
|
+
const callee = callExpr.childForFieldName?.('function');
|
|
104
|
+
return callee?.type === 'identifier' && DEFAULT_EXPORT_IDENTIFIER_BLOCKLIST_SET.has(callee.text);
|
|
105
|
+
}
|
|
@@ -36,6 +36,7 @@ export declare const isSubclassOf: (child: string, parent: string, parentMap: Re
|
|
|
36
36
|
* Uses an options object to allow future extensions without positional parameter sprawl.
|
|
37
37
|
*/
|
|
38
38
|
export interface BuildTypeEnvOptions {
|
|
39
|
+
filePath?: string;
|
|
39
40
|
model?: SemanticModel;
|
|
40
41
|
parentMap?: ReadonlyMap<string, readonly string[]>;
|
|
41
42
|
/** Pre-resolved bindings from upstream files (Phase 14).
|
|
@@ -61,7 +62,7 @@ export interface BuildTypeEnvOptions {
|
|
|
61
62
|
* Replaces the generic name-field lookup for languages with non-standard
|
|
62
63
|
* AST structures (C/C++ declarator unwrapping, Swift init/deinit, etc.).
|
|
63
64
|
* When null is returned or not provided, falls back to node.childForFieldName('name')?.text. */
|
|
64
|
-
extractFunctionName?: (node: SyntaxNode) => {
|
|
65
|
+
extractFunctionName?: (node: SyntaxNode, filePath?: string) => {
|
|
65
66
|
funcName: string | null;
|
|
66
67
|
label: NodeLabel;
|
|
67
68
|
} | null;
|
|
@@ -35,7 +35,6 @@ const findTypeIdentifierChild = (node) => {
|
|
|
35
35
|
* Includes both multi-arm pattern-match branches AND if-statement bodies for null-check narrowing. */
|
|
36
36
|
const NARROWING_BRANCH_TYPES = new Set([
|
|
37
37
|
'when_entry', // Kotlin when
|
|
38
|
-
'switch_block_label', // Java switch (enhanced)
|
|
39
38
|
'if_statement', // TS/JS, Java, C/C++
|
|
40
39
|
'if_expression', // Kotlin (if is an expression)
|
|
41
40
|
'statement_block', // TS/JS: { ... } body of if
|
|
@@ -67,8 +66,8 @@ const fastStripNullable = (typeName) => {
|
|
|
67
66
|
? typeName
|
|
68
67
|
: stripNullable(typeName);
|
|
69
68
|
};
|
|
70
|
-
/** Implementation of the lookup logic
|
|
71
|
-
const lookupInEnv = (env, varName, callNode, patternOverrides, enclosingFunctionFinder, extractFunctionNameHook) => {
|
|
69
|
+
/** Implementation of the lookup logic backing TypeEnvironment.lookup. */
|
|
70
|
+
const lookupInEnv = (env, varName, callNode, patternOverrides, enclosingFunctionFinder, extractFunctionNameHook, filePath) => {
|
|
72
71
|
// Self/this receiver: resolve to enclosing class name via AST walk
|
|
73
72
|
if (varName === 'self' || varName === 'this' || varName === '$this') {
|
|
74
73
|
return findEnclosingClassName(callNode);
|
|
@@ -79,7 +78,7 @@ const lookupInEnv = (env, varName, callNode, patternOverrides, enclosingFunction
|
|
|
79
78
|
return findEnclosingParentClassName(callNode);
|
|
80
79
|
}
|
|
81
80
|
// Determine the enclosing function scope for the call
|
|
82
|
-
const scopeKey = findEnclosingScopeKey(callNode, enclosingFunctionFinder, extractFunctionNameHook);
|
|
81
|
+
const scopeKey = findEnclosingScopeKey(callNode, enclosingFunctionFinder, extractFunctionNameHook, filePath);
|
|
83
82
|
// Check position-indexed pattern overrides first (e.g., Kotlin when/is smart casts).
|
|
84
83
|
// These take priority over flat scopeEnv because they represent per-branch narrowing.
|
|
85
84
|
if (scopeKey && patternOverrides) {
|
|
@@ -287,11 +286,11 @@ const extractParentClassFromNode = (classNode) => {
|
|
|
287
286
|
* it is consulted for each ancestor before the default FUNCTION_NODE_TYPES check.
|
|
288
287
|
* This handles languages like Dart where the function body is a sibling of the
|
|
289
288
|
* signature instead of a child. */
|
|
290
|
-
const findEnclosingScopeKey = (node, enclosingFunctionFinder, extractFunctionNameHook) => {
|
|
289
|
+
const findEnclosingScopeKey = (node, enclosingFunctionFinder, extractFunctionNameHook, filePath) => {
|
|
291
290
|
let current = node.parent;
|
|
292
291
|
while (current) {
|
|
293
292
|
if (FUNCTION_NODE_TYPES.has(current.type)) {
|
|
294
|
-
const funcName = extractFunctionNameHook?.(current)?.funcName ?? genericFuncName(current);
|
|
293
|
+
const funcName = extractFunctionNameHook?.(current, filePath)?.funcName ?? genericFuncName(current);
|
|
295
294
|
if (funcName)
|
|
296
295
|
return `${funcName}@${current.startIndex}`;
|
|
297
296
|
}
|
|
@@ -796,7 +795,6 @@ export const buildTypeEnv = (tree, language, options) => {
|
|
|
796
795
|
(child.type === 'user_type' ||
|
|
797
796
|
child.type === 'type_identifier' ||
|
|
798
797
|
child.type === 'generic_type' ||
|
|
799
|
-
child.type === 'parameterized_type' ||
|
|
800
798
|
child.type === 'nullable_type')) {
|
|
801
799
|
fallbackType = child;
|
|
802
800
|
}
|
|
@@ -1084,7 +1082,7 @@ export const buildTypeEnv = (tree, language, options) => {
|
|
|
1084
1082
|
}
|
|
1085
1083
|
}
|
|
1086
1084
|
return {
|
|
1087
|
-
lookup: (varName, callNode) => lookupInEnv(env, varName, callNode, patternOverrides, options?.enclosingFunctionFinder, extractFuncNameHook),
|
|
1085
|
+
lookup: (varName, callNode) => lookupInEnv(env, varName, callNode, patternOverrides, options?.enclosingFunctionFinder, extractFuncNameHook, options?.filePath),
|
|
1088
1086
|
constructorBindings: bindings,
|
|
1089
1087
|
fileScope: () => env.get(FILE_SCOPE) ?? emptyFileScope(),
|
|
1090
1088
|
allScopes: () => env,
|
|
@@ -111,13 +111,13 @@ const extractInitializer = (node, env, classNames) => {
|
|
|
111
111
|
// or: call_expression > function: template_function (unqualified)
|
|
112
112
|
const templateFunc = func.type === 'template_function'
|
|
113
113
|
? func
|
|
114
|
-
: func.type === 'qualified_identifier'
|
|
114
|
+
: func.type === 'qualified_identifier'
|
|
115
115
|
? (func.namedChildren.find((c) => c.type === 'template_function') ?? null)
|
|
116
116
|
: null;
|
|
117
117
|
if (templateFunc) {
|
|
118
118
|
const nameNode = templateFunc.firstNamedChild;
|
|
119
119
|
if (nameNode) {
|
|
120
|
-
const funcName = nameNode.type === 'qualified_identifier'
|
|
120
|
+
const funcName = nameNode.type === 'qualified_identifier'
|
|
121
121
|
? (nameNode.lastNamedChild?.text ?? '')
|
|
122
122
|
: nameNode.text;
|
|
123
123
|
if (SMART_PTR_FACTORIES.has(funcName)) {
|
|
@@ -185,7 +185,7 @@ const scanConstructorBinding = (node) => {
|
|
|
185
185
|
const func = value.childForFieldName('function');
|
|
186
186
|
if (!func)
|
|
187
187
|
return undefined;
|
|
188
|
-
if (func.type === 'qualified_identifier'
|
|
188
|
+
if (func.type === 'qualified_identifier') {
|
|
189
189
|
const last = func.lastNamedChild;
|
|
190
190
|
if (!last)
|
|
191
191
|
return undefined;
|
|
@@ -309,16 +309,14 @@ const extractCppElementTypeFromTypeNode = (typeNode, pos = 'last', depth = 0) =>
|
|
|
309
309
|
if (args.length >= 1)
|
|
310
310
|
return pos === 'first' ? args[0] : args[args.length - 1];
|
|
311
311
|
}
|
|
312
|
-
//
|
|
313
|
-
if (typeNode.type === '
|
|
314
|
-
typeNode.type === 'pointer_type' ||
|
|
315
|
-
typeNode.type === 'type_descriptor') {
|
|
312
|
+
// type_descriptor wrapper: unwrap and recurse (vector<User>& → vector<User>)
|
|
313
|
+
if (typeNode.type === 'type_descriptor') {
|
|
316
314
|
const inner = typeNode.lastNamedChild;
|
|
317
315
|
if (inner)
|
|
318
316
|
return extractCppElementTypeFromTypeNode(inner, pos, depth + 1);
|
|
319
317
|
}
|
|
320
|
-
// qualified
|
|
321
|
-
if (typeNode.type === 'qualified_identifier'
|
|
318
|
+
// qualified types: std::vector<User> → unwrap to template_type child
|
|
319
|
+
if (typeNode.type === 'qualified_identifier') {
|
|
322
320
|
const inner = typeNode.lastNamedChild;
|
|
323
321
|
if (inner)
|
|
324
322
|
return extractCppElementTypeFromTypeNode(inner, pos, depth + 1);
|
|
@@ -497,7 +495,7 @@ const detectCppConstructorType = (node, classNames) => {
|
|
|
497
495
|
if (!nameNode)
|
|
498
496
|
return undefined;
|
|
499
497
|
let funcName;
|
|
500
|
-
if (nameNode.type === 'qualified_identifier'
|
|
498
|
+
if (nameNode.type === 'qualified_identifier') {
|
|
501
499
|
funcName = nameNode.lastNamedChild?.text ?? '';
|
|
502
500
|
}
|
|
503
501
|
else {
|
|
@@ -27,7 +27,7 @@ const extractDeclaration = (node, env) => {
|
|
|
27
27
|
const child = node.namedChild(i);
|
|
28
28
|
if (!child)
|
|
29
29
|
continue;
|
|
30
|
-
if (!typeNode && child.type !== 'variable_declarator'
|
|
30
|
+
if (!typeNode && child.type !== 'variable_declarator') {
|
|
31
31
|
// First non-declarator child is the type (identifier, implicit_type, generic_name, etc.)
|
|
32
32
|
typeNode = child;
|
|
33
33
|
}
|
|
@@ -41,11 +41,9 @@ const extractDeclaration = (node, env) => {
|
|
|
41
41
|
let typeName;
|
|
42
42
|
if (typeNode.type === 'implicit_type' && typeNode.text === 'var') {
|
|
43
43
|
// Try to infer from initializer: var x = new Foo()
|
|
44
|
-
// tree-sitter-c-sharp
|
|
45
|
-
// or inside equals_value_clause depending on grammar version
|
|
44
|
+
// tree-sitter-c-sharp puts object_creation_expression as a direct child
|
|
46
45
|
if (declarators.length === 1) {
|
|
47
|
-
const initializer = findChild(declarators[0], 'object_creation_expression')
|
|
48
|
-
findChild(declarators[0], 'equals_value_clause')?.firstNamedChild;
|
|
46
|
+
const initializer = findChild(declarators[0], 'object_creation_expression');
|
|
49
47
|
if (initializer?.type === 'object_creation_expression') {
|
|
50
48
|
const ctorType = initializer.childForFieldName('type');
|
|
51
49
|
if (ctorType)
|
|
@@ -76,7 +74,7 @@ const extractParameter = (node, env) => {
|
|
|
76
74
|
nameNode = node.childForFieldName('name');
|
|
77
75
|
}
|
|
78
76
|
else {
|
|
79
|
-
nameNode = node.childForFieldName('name')
|
|
77
|
+
nameNode = node.childForFieldName('name');
|
|
80
78
|
typeNode = node.childForFieldName('type');
|
|
81
79
|
}
|
|
82
80
|
if (!nameNode || !typeNode)
|
|
@@ -113,17 +111,13 @@ const scanConstructorBinding = (node) => {
|
|
|
113
111
|
const nameNode = declarator.childForFieldName('name') ?? declarator.firstNamedChild;
|
|
114
112
|
if (!nameNode || nameNode.type !== 'identifier')
|
|
115
113
|
return undefined;
|
|
116
|
-
// Find the initializer value
|
|
114
|
+
// Find the initializer value as a direct child
|
|
117
115
|
// (tree-sitter-c-sharp puts invocation_expression directly inside variable_declarator)
|
|
118
116
|
let value = null;
|
|
119
117
|
for (let i = 0; i < declarator.namedChildCount; i++) {
|
|
120
118
|
const child = declarator.namedChild(i);
|
|
121
119
|
if (!child)
|
|
122
120
|
continue;
|
|
123
|
-
if (child.type === 'equals_value_clause') {
|
|
124
|
-
value = child.firstNamedChild;
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
121
|
if (child.type === 'invocation_expression' ||
|
|
128
122
|
child.type === 'object_creation_expression' ||
|
|
129
123
|
child.type === 'await_expression') {
|
|
@@ -462,18 +456,9 @@ const extractPendingAssignment = (node, scopeEnv) => {
|
|
|
462
456
|
const lhs = nameNode.text;
|
|
463
457
|
if (scopeEnv.has(lhs))
|
|
464
458
|
continue;
|
|
465
|
-
// C#
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
if (child.child(j)?.type === 'equals_value_clause') {
|
|
469
|
-
evc = child.child(j);
|
|
470
|
-
break;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
const valueNode = evc?.firstNamedChild ?? child.namedChild(child.namedChildCount - 1);
|
|
474
|
-
if (valueNode &&
|
|
475
|
-
valueNode !== nameNode &&
|
|
476
|
-
(valueNode.type === 'identifier' || valueNode.type === 'simple_identifier')) {
|
|
459
|
+
// C# variable_declarator holds the initializer value as a direct named child
|
|
460
|
+
const valueNode = child.namedChild(child.namedChildCount - 1);
|
|
461
|
+
if (valueNode && valueNode !== nameNode && valueNode.type === 'identifier') {
|
|
477
462
|
return { kind: 'copy', lhs, rhs: valueNode.text };
|
|
478
463
|
}
|
|
479
464
|
// member_access_expression RHS → fieldAccess (a.Field)
|
|
@@ -487,7 +472,7 @@ const extractPendingAssignment = (node, scopeEnv) => {
|
|
|
487
472
|
// invocation_expression RHS
|
|
488
473
|
if (valueNode?.type === 'invocation_expression') {
|
|
489
474
|
const funcNode = valueNode.firstNamedChild;
|
|
490
|
-
if (funcNode?.type === '
|
|
475
|
+
if (funcNode?.type === 'identifier') {
|
|
491
476
|
return { kind: 'callResult', lhs, callee: funcNode.text };
|
|
492
477
|
}
|
|
493
478
|
// method call with receiver → methodCallResult: a.GetC()
|
|
@@ -504,7 +489,7 @@ const extractPendingAssignment = (node, scopeEnv) => {
|
|
|
504
489
|
const inner = valueNode.firstNamedChild;
|
|
505
490
|
if (inner?.type === 'invocation_expression') {
|
|
506
491
|
const funcNode = inner.firstNamedChild;
|
|
507
|
-
if (funcNode?.type === '
|
|
492
|
+
if (funcNode?.type === 'identifier') {
|
|
508
493
|
return { kind: 'callResult', lhs, callee: funcNode.text };
|
|
509
494
|
}
|
|
510
495
|
if (funcNode?.type === 'member_access_expression') {
|
|
@@ -555,15 +540,14 @@ export const typeConfig = {
|
|
|
555
540
|
const direct = node.childForFieldName('type');
|
|
556
541
|
if (direct)
|
|
557
542
|
return direct;
|
|
558
|
-
const wrapped =
|
|
559
|
-
(
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
})();
|
|
543
|
+
const wrapped = (() => {
|
|
544
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
545
|
+
const c = node.namedChild(i);
|
|
546
|
+
if (c?.type === 'variable_declaration')
|
|
547
|
+
return c;
|
|
548
|
+
}
|
|
549
|
+
return null;
|
|
550
|
+
})();
|
|
567
551
|
return wrapped?.childForFieldName('type') ?? null;
|
|
568
552
|
},
|
|
569
553
|
forLoopNodeTypes: FOR_LOOP_NODE_TYPES,
|
|
@@ -131,16 +131,8 @@ const extractDeclaration = (node, env) => {
|
|
|
131
131
|
};
|
|
132
132
|
/** Go: parameter → name type */
|
|
133
133
|
const extractParameter = (node, env) => {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (node.type === 'parameter') {
|
|
137
|
-
nameNode = node.childForFieldName('name');
|
|
138
|
-
typeNode = node.childForFieldName('type');
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
nameNode = node.childForFieldName('name') ?? node.childForFieldName('pattern');
|
|
142
|
-
typeNode = node.childForFieldName('type');
|
|
143
|
-
}
|
|
134
|
+
const nameNode = node.childForFieldName('name');
|
|
135
|
+
const typeNode = node.childForFieldName('type');
|
|
144
136
|
if (!nameNode || !typeNode)
|
|
145
137
|
return;
|
|
146
138
|
const varName = extractVarName(nameNode);
|
|
@@ -60,7 +60,7 @@ const extractJavaParameter = (node, env) => {
|
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
62
|
// Generic fallback
|
|
63
|
-
nameNode = node.childForFieldName('name')
|
|
63
|
+
nameNode = node.childForFieldName('name');
|
|
64
64
|
typeNode = node.childForFieldName('type');
|
|
65
65
|
}
|
|
66
66
|
if (!nameNode || !typeNode)
|
|
@@ -359,9 +359,10 @@ const extractKotlinDeclaration = (node, env) => {
|
|
|
359
359
|
env.set(varName, typeName);
|
|
360
360
|
return;
|
|
361
361
|
}
|
|
362
|
-
// Fallback:
|
|
363
|
-
|
|
364
|
-
const
|
|
362
|
+
// Fallback: Kotlin property_declaration has no name/type fields (verified by
|
|
363
|
+
// real parse, #1920); the name/type are positional children.
|
|
364
|
+
const nameNode = findChild(node, 'simple_identifier');
|
|
365
|
+
const typeNode = findChild(node, 'user_type');
|
|
365
366
|
if (!nameNode || !typeNode)
|
|
366
367
|
return;
|
|
367
368
|
const varName = extractVarName(nameNode);
|
|
@@ -393,7 +394,7 @@ const extractKotlinParameter = (node, env) => {
|
|
|
393
394
|
nameNode = node.childForFieldName('name');
|
|
394
395
|
}
|
|
395
396
|
else {
|
|
396
|
-
nameNode = node.childForFieldName('name')
|
|
397
|
+
nameNode = node.childForFieldName('name');
|
|
397
398
|
typeNode = node.childForFieldName('type');
|
|
398
399
|
}
|
|
399
400
|
// Fallback: Kotlin `parameter` nodes use positional children, not named fields
|
|
@@ -269,7 +269,7 @@ const extractParameter = (node, env) => {
|
|
|
269
269
|
nameNode = node.childForFieldName('name');
|
|
270
270
|
}
|
|
271
271
|
else {
|
|
272
|
-
nameNode = node.childForFieldName('name')
|
|
272
|
+
nameNode = node.childForFieldName('name');
|
|
273
273
|
typeNode = node.childForFieldName('type');
|
|
274
274
|
}
|
|
275
275
|
if (!nameNode || !typeNode)
|
|
@@ -59,7 +59,7 @@ const extractParameter = (node, env) => {
|
|
|
59
59
|
typeNode = node.childForFieldName('type');
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
|
-
nameNode = node.childForFieldName('name')
|
|
62
|
+
nameNode = node.childForFieldName('name');
|
|
63
63
|
typeNode = node.childForFieldName('type');
|
|
64
64
|
// Python typed_parameter: name is a positional child (identifier), not a named field
|
|
65
65
|
if (!nameNode && node.type === 'typed_parameter') {
|
|
@@ -345,8 +345,8 @@ const extractPendingAssignment = (node, scopeEnv) => {
|
|
|
345
345
|
return undefined;
|
|
346
346
|
if (rhsNode.type === 'identifier')
|
|
347
347
|
return { kind: 'copy', lhs: varName, rhs: rhsNode.text };
|
|
348
|
-
// call
|
|
349
|
-
if (rhsNode.type === 'call'
|
|
348
|
+
// call RHS — Ruby uses method calls for both field access and method calls
|
|
349
|
+
if (rhsNode.type === 'call') {
|
|
350
350
|
const methodNode = rhsNode.childForFieldName('method');
|
|
351
351
|
const receiverNode = rhsNode.childForFieldName('receiver');
|
|
352
352
|
if (!receiverNode && methodNode?.type === 'identifier') {
|
|
@@ -266,16 +266,6 @@ const extractPendingAssignment = (node, scopeEnv) => {
|
|
|
266
266
|
return { kind: 'callResult', lhs, callee: funcNode.text };
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
// method_call_expression RHS → methodCallResult (receiver.method())
|
|
270
|
-
if (unwrapped.type === 'method_call_expression') {
|
|
271
|
-
const obj = unwrapped.firstNamedChild;
|
|
272
|
-
if (obj?.type === 'identifier') {
|
|
273
|
-
const methodNode = unwrapped.childForFieldName('name') ?? unwrapped.namedChild(1);
|
|
274
|
-
if (methodNode?.type === 'field_identifier') {
|
|
275
|
-
return { kind: 'methodCallResult', lhs, receiver: obj.text, method: methodNode.text };
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
269
|
return undefined;
|
|
280
270
|
};
|
|
281
271
|
/**
|
|
@@ -395,12 +385,6 @@ const extractRustElementTypeFromTypeNode = (typeNode, pos = 'last', depth = 0) =
|
|
|
395
385
|
if (elemNode)
|
|
396
386
|
return extractSimpleTypeName(elemNode);
|
|
397
387
|
}
|
|
398
|
-
// slice_type: [User] — element is the first child
|
|
399
|
-
if (typeNode.type === 'slice_type') {
|
|
400
|
-
const elemNode = typeNode.firstNamedChild;
|
|
401
|
-
if (elemNode)
|
|
402
|
-
return extractSimpleTypeName(elemNode);
|
|
403
|
-
}
|
|
404
388
|
return undefined;
|
|
405
389
|
};
|
|
406
390
|
/** Walk up from a for-loop to the enclosing function_item and search parameters
|
|
@@ -65,8 +65,8 @@ export declare const TYPED_PARAMETER_TYPES: Set<string>;
|
|
|
65
65
|
* Note: Go slices/maps use slice_type/map_type, not generic_type — those are
|
|
66
66
|
* NOT handled here. Use language-specific extractors for Go container types.
|
|
67
67
|
*
|
|
68
|
-
* @param typeNode A generic_type
|
|
69
|
-
* returns [] for non-generic types).
|
|
68
|
+
* @param typeNode A generic_type / generic_name / user_type AST node (or any
|
|
69
|
+
* node — returns [] for non-generic types).
|
|
70
70
|
* @returns Array of resolved type argument names. Unresolvable arguments are omitted.
|
|
71
71
|
*/
|
|
72
72
|
export declare const extractGenericTypeArgs: (typeNode: SyntaxNode, depth?: number) => string[];
|
|
@@ -204,9 +204,7 @@ export const extractSimpleTypeName = (typeNode, depth = 0) => {
|
|
|
204
204
|
}
|
|
205
205
|
// Generic types: extract the base type (e.g., List<User> → List)
|
|
206
206
|
// For nullable wrappers (Optional<User>, Option<User>), unwrap to inner type.
|
|
207
|
-
if (typeNode.type === 'generic_type' ||
|
|
208
|
-
typeNode.type === 'parameterized_type' ||
|
|
209
|
-
typeNode.type === 'generic_name') {
|
|
207
|
+
if (typeNode.type === 'generic_type' || typeNode.type === 'generic_name') {
|
|
210
208
|
const base = typeNode.childForFieldName('name') ??
|
|
211
209
|
typeNode.childForFieldName('type') ??
|
|
212
210
|
typeNode.firstNamedChild;
|
|
@@ -348,17 +346,20 @@ export const TYPED_PARAMETER_TYPES = new Set([
|
|
|
348
346
|
* Note: Go slices/maps use slice_type/map_type, not generic_type — those are
|
|
349
347
|
* NOT handled here. Use language-specific extractors for Go container types.
|
|
350
348
|
*
|
|
351
|
-
* @param typeNode A generic_type
|
|
352
|
-
* returns [] for non-generic types).
|
|
349
|
+
* @param typeNode A generic_type / generic_name / user_type AST node (or any
|
|
350
|
+
* node — returns [] for non-generic types).
|
|
353
351
|
* @returns Array of resolved type argument names. Unresolvable arguments are omitted.
|
|
354
352
|
*/
|
|
355
353
|
export const extractGenericTypeArgs = (typeNode, depth = 0) => {
|
|
356
354
|
if (depth > 50)
|
|
357
355
|
return [];
|
|
358
|
-
// Unwrap wrapper nodes
|
|
356
|
+
// Unwrap pure wrapper nodes (which carry no type_arguments of their own) that
|
|
357
|
+
// may sit above the generic type. `user_type` is intentionally NOT unwrapped
|
|
358
|
+
// here: a Kotlin `user_type` can itself carry a `type_arguments` child
|
|
359
|
+
// (`List<User>` → user_type > [type_identifier, type_arguments]), so it is
|
|
360
|
+
// handled as a generic-bearing node below.
|
|
359
361
|
if (typeNode.type === 'type_annotation' ||
|
|
360
362
|
typeNode.type === 'type' ||
|
|
361
|
-
typeNode.type === 'user_type' ||
|
|
362
363
|
typeNode.type === 'nullable_type' ||
|
|
363
364
|
typeNode.type === 'optional_type') {
|
|
364
365
|
const inner = typeNode.firstNamedChild;
|
|
@@ -366,10 +367,14 @@ export const extractGenericTypeArgs = (typeNode, depth = 0) => {
|
|
|
366
367
|
return extractGenericTypeArgs(inner, depth + 1);
|
|
367
368
|
return [];
|
|
368
369
|
}
|
|
369
|
-
//
|
|
370
|
+
// Generic-bearing nodes hold their arguments in a `type_arguments` /
|
|
371
|
+
// `type_argument_list` child: generic_type (Java/TypeScript/Rust/Go),
|
|
372
|
+
// generic_name (C#), and Kotlin's user_type. Verified against the installed
|
|
373
|
+
// grammars by real parse (#1920). A user_type without its own type_arguments
|
|
374
|
+
// is unwrapped at the argsNode guard below.
|
|
370
375
|
if (typeNode.type !== 'generic_type' &&
|
|
371
|
-
typeNode.type !== '
|
|
372
|
-
typeNode.type !== '
|
|
376
|
+
typeNode.type !== 'generic_name' &&
|
|
377
|
+
typeNode.type !== 'user_type') {
|
|
373
378
|
return [];
|
|
374
379
|
}
|
|
375
380
|
// Find the type_arguments / type_argument_list child
|
|
@@ -381,8 +386,17 @@ export const extractGenericTypeArgs = (typeNode, depth = 0) => {
|
|
|
381
386
|
break;
|
|
382
387
|
}
|
|
383
388
|
}
|
|
384
|
-
if (!argsNode)
|
|
389
|
+
if (!argsNode) {
|
|
390
|
+
// A `user_type` without its own type_arguments wraps an inner type node
|
|
391
|
+
// (e.g. user_type > generic_type, or a plain user_type > type_identifier with
|
|
392
|
+
// no generics) — recurse into that child. generic_type / generic_name with no
|
|
393
|
+
// args simply have no type arguments to report.
|
|
394
|
+
if (typeNode.type === 'user_type') {
|
|
395
|
+
const inner = typeNode.firstNamedChild;
|
|
396
|
+
return inner ? extractGenericTypeArgs(inner, depth + 1) : [];
|
|
397
|
+
}
|
|
385
398
|
return [];
|
|
399
|
+
}
|
|
386
400
|
const result = [];
|
|
387
401
|
for (let i = 0; i < argsNode.namedChildCount; i++) {
|
|
388
402
|
let argNode = argsNode.namedChild(i);
|
|
@@ -27,7 +27,7 @@ function swiftNavigationSuffixName(node) {
|
|
|
27
27
|
/** Swift: let x: Foo = ... */
|
|
28
28
|
const extractDeclaration = (node, env) => {
|
|
29
29
|
// Swift property_declaration has pattern and type_annotation
|
|
30
|
-
const pattern =
|
|
30
|
+
const pattern = findChild(node, 'pattern');
|
|
31
31
|
const typeAnnotation = node.childForFieldName('type') ?? findChild(node, 'type_annotation');
|
|
32
32
|
if (!pattern || !typeAnnotation)
|
|
33
33
|
return;
|
|
@@ -41,11 +41,11 @@ const extractParameter = (node, env) => {
|
|
|
41
41
|
let nameNode = null;
|
|
42
42
|
let typeNode = null;
|
|
43
43
|
if (node.type === 'parameter') {
|
|
44
|
-
nameNode = node.childForFieldName('name')
|
|
44
|
+
nameNode = node.childForFieldName('name');
|
|
45
45
|
typeNode = node.childForFieldName('type');
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
|
-
nameNode = node.childForFieldName('name')
|
|
48
|
+
nameNode = node.childForFieldName('name');
|
|
49
49
|
typeNode = node.childForFieldName('type');
|
|
50
50
|
}
|
|
51
51
|
if (!nameNode || !typeNode)
|
|
@@ -65,7 +65,7 @@ const extractInitializer = (node, env, classNames) => {
|
|
|
65
65
|
if (node.childForFieldName('type') || findChild(node, 'type_annotation'))
|
|
66
66
|
return;
|
|
67
67
|
// Find pattern (variable name)
|
|
68
|
-
const pattern =
|
|
68
|
+
const pattern = findChild(node, 'pattern');
|
|
69
69
|
if (!pattern)
|
|
70
70
|
return;
|
|
71
71
|
const varName = extractVarName(pattern) ?? pattern.text;
|
|
@@ -117,7 +117,7 @@ const scanConstructorBinding = (node) => {
|
|
|
117
117
|
return undefined;
|
|
118
118
|
if (hasTypeAnnotation(node))
|
|
119
119
|
return undefined;
|
|
120
|
-
const pattern =
|
|
120
|
+
const pattern = findChild(node, 'pattern');
|
|
121
121
|
if (!pattern)
|
|
122
122
|
return undefined;
|
|
123
123
|
const varName = pattern.text;
|
|
@@ -25,7 +25,7 @@ export type ConstructorBindingScanner = (node: SyntaxNode) => {
|
|
|
25
25
|
} | undefined;
|
|
26
26
|
/** Infer the type name of a literal AST node for overload disambiguation.
|
|
27
27
|
* Returns the canonical type name (e.g. 'int', 'String', 'boolean') or undefined
|
|
28
|
-
* for non-literal nodes. Only used when
|
|
28
|
+
* for non-literal nodes. Only used when the call resolver has multiple candidates
|
|
29
29
|
* with parameterTypes — ~1-3% of call sites. */
|
|
30
30
|
export type LiteralTypeInferrer = (node: SyntaxNode) => string | undefined;
|
|
31
31
|
/** Detect constructor-style call expressions that don't use `new` keyword.
|
|
@@ -269,7 +269,7 @@ const findTsIterableElementType = (iterableName, startNode, pos = 'last') => {
|
|
|
269
269
|
while (current) {
|
|
270
270
|
if (TS_FUNCTION_NODE_TYPES.has(current.type)) {
|
|
271
271
|
// Search function parameters
|
|
272
|
-
const paramsNode = current.childForFieldName('parameters')
|
|
272
|
+
const paramsNode = current.childForFieldName('parameters');
|
|
273
273
|
if (paramsNode) {
|
|
274
274
|
for (let i = 0; i < paramsNode.namedChildCount; i++) {
|
|
275
275
|
const param = paramsNode.namedChild(i);
|