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
|
@@ -1,72 +1,498 @@
|
|
|
1
|
+
import { simpleQualifiedName } from '../../scope-resolution/graph-bridge/ids.js';
|
|
2
|
+
import { resolveInheritanceBaseInScope } from '../../scope-resolution/scope/walkers.js';
|
|
1
3
|
export function detectGoInterfaceImplementations(parsedFiles, _indexes, _model) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
4
|
+
return detectGoInterfaceImplementationsFromIndexes(buildDetectionIndexes(parsedFiles, _indexes));
|
|
5
|
+
}
|
|
6
|
+
function buildDetectionIndexes(parsedFiles, indexes) {
|
|
7
|
+
const interfaces = [];
|
|
8
|
+
const structsById = new Map();
|
|
9
|
+
const methodsByOwner = new Map();
|
|
10
|
+
const effectiveMethodsByStructId = new Map();
|
|
11
|
+
const interfaceById = new Map();
|
|
12
|
+
const interfaceOwnMethodsById = new Map();
|
|
13
|
+
const embeddedSitesByInterfaceId = new Map();
|
|
14
|
+
const parentStructIdsByStructId = new Map();
|
|
15
|
+
const structIdsByMethodName = new Map();
|
|
16
|
+
const signatureContextByDefId = new Map();
|
|
17
|
+
const interfaceIdByScopeId = new Map();
|
|
18
|
+
const structIdByScopeId = new Map();
|
|
19
|
+
for (const parsed of parsedFiles) {
|
|
20
|
+
const signatureContext = signatureContextForFile(parsed, indexes);
|
|
21
|
+
for (const def of parsed.localDefs) {
|
|
22
|
+
signatureContextByDefId.set(def.nodeId, signatureContext);
|
|
23
|
+
if (def.type === 'Interface') {
|
|
24
|
+
interfaces.push(def);
|
|
25
|
+
interfaceById.set(def.nodeId, def);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (def.type === 'Struct') {
|
|
29
|
+
structsById.set(def.nodeId, def);
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (def.type !== 'Method' && def.type !== 'Function')
|
|
33
|
+
continue;
|
|
34
|
+
if (def.ownerId === undefined)
|
|
35
|
+
continue;
|
|
36
|
+
if (isPointerReceiverMethod(def))
|
|
37
|
+
continue;
|
|
38
|
+
const methodName = simpleQualifiedName(def);
|
|
39
|
+
if (methodName === undefined || methodName.length === 0)
|
|
40
|
+
continue;
|
|
41
|
+
addMethod(methodsByOwner, def.ownerId, methodName, def);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
7
44
|
for (const parsed of parsedFiles) {
|
|
8
|
-
// Collect interface defs and their owned methods
|
|
9
45
|
for (const scope of parsed.scopes) {
|
|
10
|
-
|
|
46
|
+
const iface = scope.ownedDefs.find((def) => def.type === 'Interface');
|
|
47
|
+
if (iface !== undefined)
|
|
48
|
+
interfaceIdByScopeId.set(scope.id, iface.nodeId);
|
|
49
|
+
const struct = scope.ownedDefs.find((def) => def.type === 'Struct');
|
|
50
|
+
if (struct !== undefined)
|
|
51
|
+
structIdByScopeId.set(scope.id, struct.nodeId);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
for (const parsed of parsedFiles) {
|
|
55
|
+
const childScopesByParent = new Map();
|
|
56
|
+
for (const scope of parsed.scopes) {
|
|
57
|
+
if (scope.parent === null)
|
|
11
58
|
continue;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
59
|
+
const children = childScopesByParent.get(scope.parent) ?? [];
|
|
60
|
+
children.push(scope);
|
|
61
|
+
childScopesByParent.set(scope.parent, children);
|
|
62
|
+
}
|
|
63
|
+
for (const scope of parsed.scopes) {
|
|
64
|
+
const ifaceId = interfaceIdByScopeId.get(scope.id);
|
|
65
|
+
if (ifaceId === undefined)
|
|
15
66
|
continue;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
67
|
+
const methods = new Map();
|
|
68
|
+
for (const childScope of childScopesByParent.get(scope.id) ?? []) {
|
|
69
|
+
for (const def of childScope.ownedDefs) {
|
|
70
|
+
if (def.type !== 'Method' && def.type !== 'Function')
|
|
71
|
+
continue;
|
|
72
|
+
const methodName = simpleQualifiedName(def);
|
|
73
|
+
if (methodName === undefined || methodName.length === 0)
|
|
74
|
+
continue;
|
|
75
|
+
addMethodOverload(methods, methodName, def);
|
|
28
76
|
}
|
|
29
|
-
// Also check if methods have ownerId pointing to this interface
|
|
30
|
-
for (const def of parsed.localDefs) {
|
|
31
|
-
if (def.ownerId === typeDef.nodeId &&
|
|
32
|
-
(def.type === 'Method' || def.type === 'Function')) {
|
|
33
|
-
methodNames.add(def.qualifiedName?.split('.').pop() ?? '');
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
interfaceMethods.set(typeDef.nodeId, methodNames);
|
|
37
77
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
78
|
+
interfaceOwnMethodsById.set(ifaceId, methods);
|
|
79
|
+
}
|
|
80
|
+
for (const site of parsed.referenceSites) {
|
|
81
|
+
if (site.kind !== 'inherits')
|
|
82
|
+
continue;
|
|
83
|
+
const ifaceId = interfaceIdByScopeId.get(site.inScope);
|
|
84
|
+
if (ifaceId !== undefined) {
|
|
85
|
+
const sites = embeddedSitesByInterfaceId.get(ifaceId) ?? [];
|
|
86
|
+
sites.push(site);
|
|
87
|
+
embeddedSitesByInterfaceId.set(ifaceId, sites);
|
|
88
|
+
continue;
|
|
47
89
|
}
|
|
90
|
+
const structId = structIdByScopeId.get(site.inScope);
|
|
91
|
+
if (structId === undefined)
|
|
92
|
+
continue;
|
|
93
|
+
const parent = resolveInheritanceBaseInScope(site.inScope, site.name, indexes);
|
|
94
|
+
if (parent === undefined || parent.type !== 'Struct')
|
|
95
|
+
continue;
|
|
96
|
+
addParentStruct(parentStructIdsByStructId, structId, parent.nodeId);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const structMethodSetCache = new Map();
|
|
100
|
+
for (const structId of structsById.keys()) {
|
|
101
|
+
const effective = collectStructMethodSet(structId, {
|
|
102
|
+
parentStructIdsByStructId,
|
|
103
|
+
methodsByOwner,
|
|
104
|
+
}, new Set(), structMethodSetCache);
|
|
105
|
+
if (effective === undefined)
|
|
106
|
+
continue;
|
|
107
|
+
effectiveMethodsByStructId.set(structId, effective);
|
|
108
|
+
for (const methodName of effective.keys()) {
|
|
109
|
+
addStructMethodCandidate(structIdsByMethodName, methodName, structId);
|
|
48
110
|
}
|
|
49
111
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
112
|
+
return {
|
|
113
|
+
interfaces,
|
|
114
|
+
structsById,
|
|
115
|
+
methodsByOwner,
|
|
116
|
+
effectiveMethodsByStructId,
|
|
117
|
+
interfaceById,
|
|
118
|
+
interfaceOwnMethodsById,
|
|
119
|
+
embeddedSitesByInterfaceId,
|
|
120
|
+
parentStructIdsByStructId,
|
|
121
|
+
structIdsByMethodName,
|
|
122
|
+
signatureContextByDefId,
|
|
123
|
+
scopeIndexes: indexes,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function detectGoInterfaceImplementationsFromIndexes(indexes) {
|
|
127
|
+
const implementations = new Map();
|
|
128
|
+
const methodSetCache = new Map();
|
|
129
|
+
for (const iface of indexes.interfaces) {
|
|
130
|
+
const required = collectInterfaceMethodSet(iface, indexes, new Set(), methodSetCache);
|
|
131
|
+
if (required === undefined || required.size === 0)
|
|
132
|
+
continue;
|
|
133
|
+
if (!methodSetHasVerifiableSignatures(required))
|
|
54
134
|
continue;
|
|
55
135
|
const implementors = [];
|
|
56
|
-
for (const
|
|
57
|
-
|
|
136
|
+
for (const structId of candidateStructIdsFor(required, indexes)) {
|
|
137
|
+
const actual = indexes.effectiveMethodsByStructId.get(structId);
|
|
138
|
+
if (actual === undefined)
|
|
139
|
+
continue;
|
|
140
|
+
if (methodSetSatisfies(actual, required, indexes.signatureContextByDefId)) {
|
|
58
141
|
implementors.push(structId);
|
|
59
142
|
}
|
|
60
143
|
}
|
|
61
144
|
if (implementors.length > 0)
|
|
62
|
-
|
|
145
|
+
implementations.set(iface.nodeId, implementors);
|
|
146
|
+
}
|
|
147
|
+
return implementations;
|
|
148
|
+
}
|
|
149
|
+
function addMethod(methodsByOwner, ownerId, methodName, def) {
|
|
150
|
+
let methods = methodsByOwner.get(ownerId);
|
|
151
|
+
if (methods === undefined) {
|
|
152
|
+
methods = new Map();
|
|
153
|
+
methodsByOwner.set(ownerId, methods);
|
|
63
154
|
}
|
|
64
|
-
|
|
155
|
+
addMethodOverload(methods, methodName, def);
|
|
156
|
+
}
|
|
157
|
+
function addMethodOverload(methods, methodName, def) {
|
|
158
|
+
const overloads = methods.get(methodName) ?? [];
|
|
159
|
+
overloads.push(def);
|
|
160
|
+
methods.set(methodName, overloads);
|
|
161
|
+
}
|
|
162
|
+
function addStructMethodCandidate(structIdsByMethodName, methodName, structId) {
|
|
163
|
+
const structIds = structIdsByMethodName.get(methodName) ?? new Set();
|
|
164
|
+
structIds.add(structId);
|
|
165
|
+
structIdsByMethodName.set(methodName, structIds);
|
|
166
|
+
}
|
|
167
|
+
function addParentStruct(parentStructIdsByStructId, structId, parentStructId) {
|
|
168
|
+
const parents = parentStructIdsByStructId.get(structId) ?? [];
|
|
169
|
+
parents.push(parentStructId);
|
|
170
|
+
parentStructIdsByStructId.set(structId, parents);
|
|
65
171
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
|
|
172
|
+
function collectStructMethodSet(structId, indexes, visiting, cache) {
|
|
173
|
+
const entries = collectStructMethodEntries(structId, indexes, visiting, cache);
|
|
174
|
+
return entries === undefined ? undefined : methodEntriesToMethodSet(entries);
|
|
175
|
+
}
|
|
176
|
+
function collectStructMethodEntries(structId, indexes, visiting, cache) {
|
|
177
|
+
const cached = cache.get(structId);
|
|
178
|
+
if (cached !== undefined)
|
|
179
|
+
return cloneMethodEntries(cached);
|
|
180
|
+
if (visiting.has(structId))
|
|
181
|
+
return undefined;
|
|
182
|
+
visiting.add(structId);
|
|
183
|
+
const merged = directMethodEntries(indexes.methodsByOwner.get(structId));
|
|
184
|
+
for (const parentStructId of indexes.parentStructIdsByStructId.get(structId) ?? []) {
|
|
185
|
+
const parentEntries = collectStructMethodEntries(parentStructId, indexes, visiting, cache);
|
|
186
|
+
if (parentEntries === undefined) {
|
|
187
|
+
visiting.delete(structId);
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
for (const [methodName, entry] of parentEntries) {
|
|
191
|
+
if (entry.ambiguous)
|
|
192
|
+
continue;
|
|
193
|
+
mergePromotedMethodEntry(merged, methodName, {
|
|
194
|
+
overloads: entry.overloads,
|
|
195
|
+
depth: entry.depth + 1,
|
|
196
|
+
ambiguous: false,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
visiting.delete(structId);
|
|
201
|
+
cache.set(structId, cloneMethodEntries(merged));
|
|
202
|
+
return merged;
|
|
203
|
+
}
|
|
204
|
+
function collectInterfaceMethodSet(iface, indexes, visiting, cache) {
|
|
205
|
+
const cached = cache.get(iface.nodeId);
|
|
206
|
+
// NOTE: Returns a direct reference to the cached map. Callers (the detection
|
|
207
|
+
// loop in detectGoInterfaceImplementationsFromIndexes) only READ the result
|
|
208
|
+
// (keys/values passed to candidateStructIdsFor and methodSetSatisfies). If a
|
|
209
|
+
// future caller needs to mutate the returned map, it must clone first — the
|
|
210
|
+
// cache entry is shared and must remain immutable after this function returns.
|
|
211
|
+
if (cached !== undefined)
|
|
212
|
+
return cached;
|
|
213
|
+
if (visiting.has(iface.nodeId))
|
|
214
|
+
return undefined;
|
|
215
|
+
visiting.add(iface.nodeId);
|
|
216
|
+
const ownMethods = indexes.methodsByOwner.get(iface.nodeId) ?? indexes.interfaceOwnMethodsById.get(iface.nodeId);
|
|
217
|
+
const merged = cloneMethodSet(ownMethods);
|
|
218
|
+
const embeddedInterfaces = embeddedInterfacesFor(iface, indexes);
|
|
219
|
+
if (embeddedInterfaces === undefined) {
|
|
220
|
+
visiting.delete(iface.nodeId);
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
for (const embeddedIface of embeddedInterfaces) {
|
|
224
|
+
const embeddedMethods = collectInterfaceMethodSet(embeddedIface, indexes, visiting, cache);
|
|
225
|
+
if (embeddedMethods === undefined) {
|
|
226
|
+
visiting.delete(iface.nodeId);
|
|
227
|
+
return undefined;
|
|
228
|
+
}
|
|
229
|
+
mergeMethodSet(merged, embeddedMethods);
|
|
230
|
+
}
|
|
231
|
+
visiting.delete(iface.nodeId);
|
|
232
|
+
// Store a clone in the cache so the returned `merged` reference is independent.
|
|
233
|
+
// This protects the cache from mutation if a caller modifies the return value.
|
|
234
|
+
cache.set(iface.nodeId, cloneMethodSet(merged));
|
|
235
|
+
return merged;
|
|
236
|
+
}
|
|
237
|
+
function embeddedInterfacesFor(iface, indexes) {
|
|
238
|
+
const embedded = [];
|
|
239
|
+
for (const site of indexes.embeddedSitesByInterfaceId.get(iface.nodeId) ?? []) {
|
|
240
|
+
const resolved = resolveEmbeddedInterface(site, indexes);
|
|
241
|
+
if (resolved === undefined)
|
|
242
|
+
return undefined;
|
|
243
|
+
embedded.push(resolved);
|
|
244
|
+
}
|
|
245
|
+
return embedded;
|
|
246
|
+
}
|
|
247
|
+
function candidateStructIdsFor(required, indexes) {
|
|
248
|
+
let result;
|
|
249
|
+
for (const name of required.keys()) {
|
|
250
|
+
const candidates = indexes.structIdsByMethodName.get(name);
|
|
251
|
+
if (candidates === undefined)
|
|
252
|
+
return [];
|
|
253
|
+
if (result === undefined) {
|
|
254
|
+
// First method name: start with its full candidate set (copy to avoid
|
|
255
|
+
// corrupting the shared index).
|
|
256
|
+
result = new Set(candidates);
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
// Intersect: keep only struct IDs present in this method's candidate set.
|
|
260
|
+
// Iterate a snapshot to avoid mutating while iterating.
|
|
261
|
+
const toDelete = [];
|
|
262
|
+
for (const id of result) {
|
|
263
|
+
if (!candidates.has(id))
|
|
264
|
+
toDelete.push(id);
|
|
265
|
+
}
|
|
266
|
+
for (const id of toDelete)
|
|
267
|
+
result.delete(id);
|
|
268
|
+
}
|
|
269
|
+
if (result.size === 0)
|
|
270
|
+
return []; // Early exit: no struct has all required methods
|
|
271
|
+
}
|
|
272
|
+
return result === undefined ? indexes.structsById.keys() : result;
|
|
273
|
+
}
|
|
274
|
+
function resolveEmbeddedInterface(site, indexes) {
|
|
275
|
+
const bound = resolveInheritanceBaseInScope(site.inScope, site.name, indexes.scopeIndexes);
|
|
276
|
+
if (bound !== undefined)
|
|
277
|
+
return bound.type === 'Interface' ? bound : undefined;
|
|
278
|
+
const simpleName = simpleTypeName(site.name);
|
|
279
|
+
const matches = [];
|
|
280
|
+
for (const iface of indexes.interfaceById.values()) {
|
|
281
|
+
if (iface.qualifiedName === site.name || iface.qualifiedName === simpleName) {
|
|
282
|
+
matches.push(iface);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return matches.length === 1 ? matches[0] : undefined;
|
|
286
|
+
}
|
|
287
|
+
function simpleTypeName(name) {
|
|
288
|
+
const dot = name.lastIndexOf('.');
|
|
289
|
+
return dot === -1 ? name : name.slice(dot + 1);
|
|
290
|
+
}
|
|
291
|
+
function cloneMethodSet(methods) {
|
|
292
|
+
const clone = new Map();
|
|
293
|
+
if (methods === undefined)
|
|
294
|
+
return clone;
|
|
295
|
+
for (const [name, overloads] of methods) {
|
|
296
|
+
clone.set(name, [...overloads]);
|
|
297
|
+
}
|
|
298
|
+
return clone;
|
|
299
|
+
}
|
|
300
|
+
function directMethodEntries(methods) {
|
|
301
|
+
const entries = new Map();
|
|
302
|
+
if (methods === undefined)
|
|
303
|
+
return entries;
|
|
304
|
+
for (const [name, overloads] of methods) {
|
|
305
|
+
entries.set(name, { overloads: [...overloads], depth: 0, ambiguous: false });
|
|
306
|
+
}
|
|
307
|
+
return entries;
|
|
308
|
+
}
|
|
309
|
+
function cloneMethodEntries(entries) {
|
|
310
|
+
const clone = new Map();
|
|
311
|
+
for (const [name, entry] of entries) {
|
|
312
|
+
clone.set(name, { ...entry, overloads: [...entry.overloads] });
|
|
313
|
+
}
|
|
314
|
+
return clone;
|
|
315
|
+
}
|
|
316
|
+
function methodEntriesToMethodSet(entries) {
|
|
317
|
+
const methods = new Map();
|
|
318
|
+
for (const [name, entry] of entries) {
|
|
319
|
+
if (entry.ambiguous)
|
|
320
|
+
continue;
|
|
321
|
+
methods.set(name, [...entry.overloads]);
|
|
322
|
+
}
|
|
323
|
+
return methods;
|
|
324
|
+
}
|
|
325
|
+
function mergePromotedMethodEntry(target, methodName, candidate) {
|
|
326
|
+
const existing = target.get(methodName);
|
|
327
|
+
if (existing === undefined || candidate.depth < existing.depth) {
|
|
328
|
+
target.set(methodName, candidate);
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (candidate.depth > existing.depth)
|
|
332
|
+
return;
|
|
333
|
+
target.set(methodName, { overloads: [], depth: candidate.depth, ambiguous: true });
|
|
334
|
+
}
|
|
335
|
+
function mergeMethodSet(target, source) {
|
|
336
|
+
for (const [name, overloads] of source) {
|
|
337
|
+
const existing = target.get(name) ?? [];
|
|
338
|
+
existing.push(...overloads);
|
|
339
|
+
target.set(name, existing);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
function methodSetSatisfies(actual, required, signatureContextByDefId) {
|
|
343
|
+
for (const [name, requiredOverloads] of required) {
|
|
344
|
+
const actualOverloads = actual.get(name);
|
|
345
|
+
if (actualOverloads === undefined)
|
|
346
|
+
return false;
|
|
347
|
+
for (const requiredMethod of requiredOverloads) {
|
|
348
|
+
// Fast arity pre-filter: if the required method has a known parameter
|
|
349
|
+
// count, reject immediately when no actual overload matches it. This
|
|
350
|
+
// avoids the expensive signature normalization loop for obvious mismatches.
|
|
351
|
+
if (requiredMethod.parameterCount !== undefined) {
|
|
352
|
+
if (!actualOverloads.some((a) => a.parameterCount === requiredMethod.parameterCount)) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (!hasCompatibleMethod(actualOverloads, requiredMethod, signatureContextByDefId)) {
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
function hasCompatibleMethod(actualOverloads, requiredMethod, signatureContextByDefId) {
|
|
364
|
+
if (!hasVerifiableSignature(requiredMethod))
|
|
365
|
+
return false;
|
|
366
|
+
return actualOverloads.some((actualMethod) => signaturesCompatible(actualMethod, requiredMethod, signatureContextByDefId));
|
|
367
|
+
}
|
|
368
|
+
function methodSetHasVerifiableSignatures(methods) {
|
|
369
|
+
for (const overloads of methods.values()) {
|
|
370
|
+
if (!overloads.some(hasVerifiableSignature))
|
|
69
371
|
return false;
|
|
70
372
|
}
|
|
71
373
|
return true;
|
|
72
374
|
}
|
|
375
|
+
function isPointerReceiverMethod(def) {
|
|
376
|
+
return def.goReceiverKind === 'pointer';
|
|
377
|
+
}
|
|
378
|
+
function hasVerifiableSignature(def) {
|
|
379
|
+
return (def.parameterCount !== undefined ||
|
|
380
|
+
def.requiredParameterCount !== undefined ||
|
|
381
|
+
(def.parameterTypes !== undefined && def.parameterTypes.length > 0) ||
|
|
382
|
+
def.returnType !== undefined);
|
|
383
|
+
}
|
|
384
|
+
function signaturesCompatible(actual, required, signatureContextByDefId) {
|
|
385
|
+
const actualContext = signatureContextByDefId.get(actual.nodeId);
|
|
386
|
+
const requiredContext = signatureContextByDefId.get(required.nodeId);
|
|
387
|
+
return (countsCompatible(actual.parameterCount, required.parameterCount) &&
|
|
388
|
+
countsCompatible(actual.requiredParameterCount, required.requiredParameterCount) &&
|
|
389
|
+
parameterTypesCompatible(actual.parameterTypes, required.parameterTypes, actualContext, requiredContext) &&
|
|
390
|
+
returnTypesCompatible(actual.returnType, required.returnType, actualContext, requiredContext));
|
|
391
|
+
}
|
|
392
|
+
function countsCompatible(actual, required) {
|
|
393
|
+
return actual === undefined || required === undefined || actual === required;
|
|
394
|
+
}
|
|
395
|
+
function parameterTypesCompatible(actual, required, actualContext, requiredContext) {
|
|
396
|
+
if (actual === undefined || required === undefined)
|
|
397
|
+
return true;
|
|
398
|
+
if (actual.length !== required.length)
|
|
399
|
+
return false;
|
|
400
|
+
return actual.every((type, index) => {
|
|
401
|
+
const actualType = normalizeSignatureType(type, actualContext);
|
|
402
|
+
const requiredType = normalizeSignatureType(required[index], requiredContext);
|
|
403
|
+
return actualType !== undefined && requiredType !== undefined && actualType === requiredType;
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
function returnTypesCompatible(actual, required, actualContext, requiredContext) {
|
|
407
|
+
if (required === undefined)
|
|
408
|
+
return actual === undefined;
|
|
409
|
+
if (actual === undefined)
|
|
410
|
+
return false;
|
|
411
|
+
const actualType = normalizeSignatureType(actual, actualContext);
|
|
412
|
+
const requiredType = normalizeSignatureType(required, requiredContext);
|
|
413
|
+
return actualType !== undefined && requiredType !== undefined && actualType === requiredType;
|
|
414
|
+
}
|
|
415
|
+
function normalizeSignatureType(typeName, context) {
|
|
416
|
+
// Go type identity includes pointer/slice/map/variadic shape and package
|
|
417
|
+
// qualifiers. Only erase whitespace and qualify bare local type names; stripping
|
|
418
|
+
// `*`, `[]`, `...`, or `pkg.` would make non-identical signatures compare equal.
|
|
419
|
+
const compact = typeName.replace(/\s+/g, '');
|
|
420
|
+
if (context === undefined)
|
|
421
|
+
return compact;
|
|
422
|
+
return qualifyGoSignatureTypes(compact, context);
|
|
423
|
+
}
|
|
424
|
+
function qualifyGoSignatureTypes(typeName, context) {
|
|
425
|
+
let unresolvedQualifier = false;
|
|
426
|
+
const qualified = typeName.replace(/[A-Za-z_][A-Za-z0-9_]*/g, (token, offset, source) => {
|
|
427
|
+
if (GO_BUILTIN_TYPES.has(token))
|
|
428
|
+
return token;
|
|
429
|
+
if (hasPackageQualifierDot(source, offset))
|
|
430
|
+
return token;
|
|
431
|
+
if (source[offset + token.length] === '.') {
|
|
432
|
+
const qualifier = context.importQualifiers.get(token);
|
|
433
|
+
if (qualifier !== undefined)
|
|
434
|
+
return qualifier;
|
|
435
|
+
unresolvedQualifier = true;
|
|
436
|
+
return token;
|
|
437
|
+
}
|
|
438
|
+
if (context.packageQualifier === undefined)
|
|
439
|
+
return token;
|
|
440
|
+
return `${context.packageQualifier}.${token}`;
|
|
441
|
+
});
|
|
442
|
+
return unresolvedQualifier ? undefined : qualified;
|
|
443
|
+
}
|
|
444
|
+
function hasPackageQualifierDot(source, offset) {
|
|
445
|
+
return source[offset - 1] === '.' && source[offset - 2] !== '.';
|
|
446
|
+
}
|
|
447
|
+
function signatureContextForFile(parsed, indexes) {
|
|
448
|
+
const importQualifiers = new Map();
|
|
449
|
+
const importEdges = indexes.imports?.get(parsed.moduleScope) ?? [];
|
|
450
|
+
for (const edge of importEdges) {
|
|
451
|
+
if (edge.kind !== 'namespace' || edge.targetFile === null)
|
|
452
|
+
continue;
|
|
453
|
+
const qualifier = packageQualifierForFile(edge.targetFile);
|
|
454
|
+
if (qualifier !== undefined)
|
|
455
|
+
importQualifiers.set(edge.localName, qualifier);
|
|
456
|
+
}
|
|
457
|
+
return {
|
|
458
|
+
packageQualifier: packageQualifierForFile(parsed.filePath),
|
|
459
|
+
importQualifiers,
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
function packageQualifierForFile(filePath) {
|
|
463
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
464
|
+
const slash = normalized.lastIndexOf('/');
|
|
465
|
+
if (slash === -1)
|
|
466
|
+
return undefined;
|
|
467
|
+
const packageDir = normalized.slice(0, slash);
|
|
468
|
+
return packageDir.length === 0 ? undefined : packageDir;
|
|
469
|
+
}
|
|
470
|
+
const GO_BUILTIN_TYPES = new Set([
|
|
471
|
+
'any',
|
|
472
|
+
'bool',
|
|
473
|
+
'byte',
|
|
474
|
+
'comparable',
|
|
475
|
+
'complex64',
|
|
476
|
+
'complex128',
|
|
477
|
+
'error',
|
|
478
|
+
'float32',
|
|
479
|
+
'float64',
|
|
480
|
+
'func',
|
|
481
|
+
'int',
|
|
482
|
+
'int8',
|
|
483
|
+
'int16',
|
|
484
|
+
'int32',
|
|
485
|
+
'int64',
|
|
486
|
+
'interface',
|
|
487
|
+
'map',
|
|
488
|
+
'rune',
|
|
489
|
+
'string',
|
|
490
|
+
'struct',
|
|
491
|
+
'uint',
|
|
492
|
+
'uint8',
|
|
493
|
+
'uint16',
|
|
494
|
+
'uint32',
|
|
495
|
+
'uint64',
|
|
496
|
+
'uintptr',
|
|
497
|
+
'chan',
|
|
498
|
+
]);
|
|
@@ -28,7 +28,10 @@ export function interpretGoTypeBinding(captures) {
|
|
|
28
28
|
let normalizedType;
|
|
29
29
|
if (captures['@type-binding.self'] !== undefined) {
|
|
30
30
|
source = 'self';
|
|
31
|
-
|
|
31
|
+
// Preserve pointer shape on receiver self-bindings (`*T` vs `T`).
|
|
32
|
+
// Method-owner enrichment consumes that raw shape to model Go value and
|
|
33
|
+
// pointer receiver method sets conservatively.
|
|
34
|
+
normalizedType = type.trim();
|
|
32
35
|
}
|
|
33
36
|
else if (captures['@type-binding.constructor'] !== undefined) {
|
|
34
37
|
source = 'constructor-inferred';
|
|
@@ -90,14 +93,11 @@ export function interpretGoTypeBinding(captures) {
|
|
|
90
93
|
}
|
|
91
94
|
export function normalizeGoTypeName(text) {
|
|
92
95
|
let t = text.trim();
|
|
93
|
-
|
|
94
|
-
t = t.slice(1).trim();
|
|
95
|
-
if (t.startsWith('[]'))
|
|
96
|
-
t = t.slice(2).trim();
|
|
96
|
+
t = stripGoOuterTypePrefixes(t);
|
|
97
97
|
const mapMatch = t.match(/^map\[[^\]]+\]\s*(.+)$/);
|
|
98
98
|
if (mapMatch)
|
|
99
99
|
t = mapMatch[1].trim();
|
|
100
|
-
t = t.replace(/^(?:<-)?chan
|
|
100
|
+
t = stripGoOuterTypePrefixes(t.replace(/^(?:<-)?chan(?:<-)?\s+/, ''));
|
|
101
101
|
if (t.startsWith('func(')) {
|
|
102
102
|
const retMatch = t.match(/^func\([^)]*\)\s*(.*)$/);
|
|
103
103
|
if (retMatch)
|
|
@@ -125,14 +125,11 @@ export function normalizeGoReturnType(text) {
|
|
|
125
125
|
const closeIdx = t.indexOf(',');
|
|
126
126
|
t = t.slice(1, closeIdx).trim();
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
t = t.slice(1).trim();
|
|
130
|
-
if (t.startsWith('[]'))
|
|
131
|
-
t = t.slice(2).trim();
|
|
128
|
+
t = stripGoOuterTypePrefixes(t);
|
|
132
129
|
const mapMatch = t.match(/^map\[[^\]]+\]\s*(.+)$/);
|
|
133
130
|
if (mapMatch)
|
|
134
131
|
t = mapMatch[1].trim();
|
|
135
|
-
t = t.replace(/^(?:<-)?chan
|
|
132
|
+
t = stripGoOuterTypePrefixes(t.replace(/^(?:<-)?chan(?:<-)?\s+/, ''));
|
|
136
133
|
if (t.startsWith('func(')) {
|
|
137
134
|
const retMatch = t.match(/^func\([^)]*\)\s*(.*)$/);
|
|
138
135
|
if (retMatch)
|
|
@@ -144,3 +141,16 @@ export function normalizeGoReturnType(text) {
|
|
|
144
141
|
t = t.slice(0, bracket);
|
|
145
142
|
return t;
|
|
146
143
|
}
|
|
144
|
+
function stripGoOuterTypePrefixes(text) {
|
|
145
|
+
let t = text.trim();
|
|
146
|
+
let previous;
|
|
147
|
+
do {
|
|
148
|
+
previous = t;
|
|
149
|
+
while (t.startsWith('*'))
|
|
150
|
+
t = t.slice(1).trim();
|
|
151
|
+
if (t.startsWith('[]'))
|
|
152
|
+
t = t.slice(2).trim();
|
|
153
|
+
t = t.replace(/^\[[^\]]+\]\s*/, '');
|
|
154
|
+
} while (t !== previous);
|
|
155
|
+
return t;
|
|
156
|
+
}
|
|
@@ -36,12 +36,15 @@ export function populateGoWorkspaceOwners(parsedFiles, ctx) {
|
|
|
36
36
|
function populateGoOwnersInPackage(parsedFiles) {
|
|
37
37
|
// Build struct name → def map from ALL scopes' ownedDefs (struct defs
|
|
38
38
|
// live in Class scopes now, not Module scope).
|
|
39
|
-
const structByQualifiedName = new Map();
|
|
39
|
+
const structByQualifiedName = new Map();
|
|
40
40
|
for (const parsed of parsedFiles) {
|
|
41
41
|
for (const scope of parsed.scopes) {
|
|
42
42
|
for (const def of scope.ownedDefs) {
|
|
43
43
|
if (isClassLike(def.type) && def.qualifiedName) {
|
|
44
|
-
structByQualifiedName.set(def.qualifiedName,
|
|
44
|
+
structByQualifiedName.set(def.qualifiedName, {
|
|
45
|
+
nodeId: def.nodeId,
|
|
46
|
+
qualifiedName: def.qualifiedName,
|
|
47
|
+
});
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
}
|
|
@@ -59,26 +62,35 @@ function populateGoOwnersInPackage(parsedFiles) {
|
|
|
59
62
|
continue;
|
|
60
63
|
// Find the self typeBinding in this Function scope.
|
|
61
64
|
let receiverType;
|
|
65
|
+
let receiverKind = 'value';
|
|
62
66
|
for (const [, tb] of scope.typeBindings) {
|
|
63
67
|
if (tb.source === 'self') {
|
|
64
68
|
receiverType = tb.rawName;
|
|
69
|
+
receiverKind = tb.rawName.trim().startsWith('*') ? 'pointer' : 'value';
|
|
65
70
|
break;
|
|
66
71
|
}
|
|
67
72
|
}
|
|
68
73
|
if (receiverType === undefined)
|
|
69
74
|
continue;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
receiverType = receiverType.replace(/^\*+/, '').trim();
|
|
76
|
+
let owner = structByQualifiedName.get(receiverType);
|
|
77
|
+
if (owner === undefined) {
|
|
78
|
+
for (const [qname, candidate] of structByQualifiedName) {
|
|
73
79
|
if (qname.endsWith('.' + receiverType)) {
|
|
74
|
-
|
|
80
|
+
owner = candidate;
|
|
75
81
|
break;
|
|
76
82
|
}
|
|
77
83
|
}
|
|
78
84
|
}
|
|
79
|
-
if (
|
|
85
|
+
if (owner !== undefined) {
|
|
80
86
|
for (const def of methodDefs) {
|
|
81
|
-
def.ownerId =
|
|
87
|
+
def.ownerId = owner.nodeId;
|
|
88
|
+
def.goReceiverKind = receiverKind;
|
|
89
|
+
const simpleName = def.qualifiedName?.split('.').pop() ?? def.qualifiedName;
|
|
90
|
+
if (simpleName !== undefined && !def.qualifiedName?.includes('.')) {
|
|
91
|
+
def.qualifiedName =
|
|
92
|
+
`${owner.qualifiedName}.${simpleName}`;
|
|
93
|
+
}
|
|
82
94
|
}
|
|
83
95
|
}
|
|
84
96
|
}
|