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
|
@@ -49,13 +49,18 @@
|
|
|
49
49
|
*
|
|
50
50
|
* ## State lifecycle
|
|
51
51
|
*
|
|
52
|
-
*
|
|
53
|
-
* `clearCppAdlState()` (called from
|
|
52
|
+
* Five pieces of module-level state populated per pipeline invocation, all
|
|
53
|
+
* reset together by `clearCppAdlState()` (called from
|
|
54
|
+
* `cppScopeResolver.loadResolutionConfig`, alongside `clearFileLocalNames` —
|
|
55
|
+
* NOT from `clearFileLocalNames` itself), grouped by when they fill:
|
|
54
56
|
*
|
|
55
57
|
* - `argInfoBySite` — per-call-site argument shape (capture-time)
|
|
56
58
|
* - `noAdlSites` — call sites with parenthesized function (capture-time)
|
|
57
59
|
* - `classToNamespaceQualifiedName` — class def → its enclosing namespace
|
|
58
60
|
* qualified name (`populateCppAssociatedNamespaces` time)
|
|
61
|
+
* - `adlIndex` / `adlIndexSource` — the lazily-built candidate index and the
|
|
62
|
+
* `parsedFiles` reference it was built from (first-`pickCppAdlCandidates`
|
|
63
|
+
* time; see `ensureAdlIndex`)
|
|
59
64
|
*
|
|
60
65
|
* The class→namespace map uses qualified names (not scope IDs) because
|
|
61
66
|
* C++ namespaces are open: `namespace N { ... }` in file A and
|
|
@@ -68,25 +73,338 @@ import { isCppInlineNamespaceScope } from './inline-namespaces.js';
|
|
|
68
73
|
const argInfoBySite = new Map();
|
|
69
74
|
const noAdlSites = new Set();
|
|
70
75
|
const classToNamespaceQualifiedName = new Map();
|
|
76
|
+
/**
|
|
77
|
+
* Per-`filePath` index of the site keys this file contributed to
|
|
78
|
+
* `argInfoBySite` / `noAdlSites`, kept in **strict lockstep** with those two
|
|
79
|
+
* maps (#1983 perf). Without it, `collectCppAdlSideChannel(filePath)` had to
|
|
80
|
+
* scan the ENTIRE module-level maps (every site of every file the worker
|
|
81
|
+
* parsed in the current sub-batch) and `parseSiteKey` each entry just to pick
|
|
82
|
+
* out one file's slice — O(F²) per sub-batch (~100M `parseSiteKey` calls
|
|
83
|
+
* across the Linux kernel). These indexes turn collect into
|
|
84
|
+
* O(entries-for-this-file).
|
|
85
|
+
*
|
|
86
|
+
* Lockstep invariant: a key is pushed here at most once, exactly when it is
|
|
87
|
+
* first inserted into the corresponding map, and both indexes are cleared
|
|
88
|
+
* wherever `argInfoBySite` / `noAdlSites` are cleared (`clearCppAdlState` and
|
|
89
|
+
* the per-file restore in `applyCppAdlSideChannel`). The "first insert only"
|
|
90
|
+
* guard mirrors the maps' own de-dup (`Map.set` / `Set.add` are idempotent on
|
|
91
|
+
* the key), so iterating an index yields each of this file's keys exactly once
|
|
92
|
+
* — byte-identical to the old filtered full scan.
|
|
93
|
+
*/
|
|
94
|
+
const argInfoSiteKeysByFile = new Map();
|
|
95
|
+
const noAdlSiteKeysByFile = new Map();
|
|
96
|
+
/** Push `key` into the per-file index `idx[filePath]` (creating the bucket on
|
|
97
|
+
* first use). Callers guard against duplicate keys so each key appears once. */
|
|
98
|
+
function pushFileSiteKey(idx, filePath, key) {
|
|
99
|
+
let keys = idx.get(filePath);
|
|
100
|
+
if (keys === undefined) {
|
|
101
|
+
keys = [];
|
|
102
|
+
idx.set(filePath, keys);
|
|
103
|
+
}
|
|
104
|
+
keys.push(key);
|
|
105
|
+
}
|
|
106
|
+
let adlIndex;
|
|
107
|
+
let adlIndexSource;
|
|
71
108
|
function siteKey(filePath, line, col) {
|
|
72
109
|
return `${filePath}:${line}:${col}`;
|
|
73
110
|
}
|
|
111
|
+
/** Last segment of a dotted qualified name (matches legacy inline expression). */
|
|
112
|
+
function adlSimpleName(def) {
|
|
113
|
+
return def.qualifiedName?.split('.').pop() ?? def.qualifiedName ?? '';
|
|
114
|
+
}
|
|
115
|
+
function isAdlCallableType(type) {
|
|
116
|
+
return type === 'Function' || type === 'Method' || type === 'Constructor';
|
|
117
|
+
}
|
|
118
|
+
function pushNested(map, outerKey, innerKey, def) {
|
|
119
|
+
let inner = map.get(outerKey);
|
|
120
|
+
if (inner === undefined) {
|
|
121
|
+
inner = new Map();
|
|
122
|
+
map.set(outerKey, inner);
|
|
123
|
+
}
|
|
124
|
+
let arr = inner.get(innerKey);
|
|
125
|
+
if (arr === undefined) {
|
|
126
|
+
arr = [];
|
|
127
|
+
inner.set(innerKey, arr);
|
|
128
|
+
}
|
|
129
|
+
arr.push(def);
|
|
130
|
+
}
|
|
131
|
+
function pushFlat(map, key, def) {
|
|
132
|
+
let arr = map.get(key);
|
|
133
|
+
if (arr === undefined) {
|
|
134
|
+
arr = [];
|
|
135
|
+
map.set(key, arr);
|
|
136
|
+
}
|
|
137
|
+
arr.push(def);
|
|
138
|
+
}
|
|
139
|
+
/** Build the ADL candidate index in a single pass over the workspace. The
|
|
140
|
+
* visitation order (file-major; per file, all namespace scopes before all
|
|
141
|
+
* class scopes; ownedDefs in declaration order) mirrors the legacy push
|
|
142
|
+
* order so `seqByNodeId` reconstructs identical candidate ordering. */
|
|
143
|
+
function buildAdlIndex(scopes, parsedFiles) {
|
|
144
|
+
const idx = {
|
|
145
|
+
classDefsBySimple: new Map(),
|
|
146
|
+
nsCandidates: new Map(),
|
|
147
|
+
friendCandidates: new Map(),
|
|
148
|
+
nsFunctionsByQName: new Map(),
|
|
149
|
+
nsFunctionsBySimple: new Map(),
|
|
150
|
+
seqByNodeId: new Map(),
|
|
151
|
+
};
|
|
152
|
+
// (1) class-like defs by simple name — preserve byId order so arr[0] is the
|
|
153
|
+
// legacy `firstMatch` and `arr.length > 1` is the legacy `ambiguous`.
|
|
154
|
+
for (const def of scopes.defs.byId.values()) {
|
|
155
|
+
if (def.type !== 'Class' &&
|
|
156
|
+
def.type !== 'Struct' &&
|
|
157
|
+
def.type !== 'Interface' &&
|
|
158
|
+
def.type !== 'Enum')
|
|
159
|
+
continue;
|
|
160
|
+
pushFlat(idx.classDefsBySimple, adlSimpleName(def), def);
|
|
161
|
+
}
|
|
162
|
+
let seq = 0;
|
|
163
|
+
for (const parsed of parsedFiles) {
|
|
164
|
+
const scopesById = new Map();
|
|
165
|
+
for (const sc of parsed.scopes)
|
|
166
|
+
scopesById.set(sc.id, sc);
|
|
167
|
+
// parent → children, built once (replaces the legacy O(scopes²) walk).
|
|
168
|
+
const childrenByParent = new Map();
|
|
169
|
+
for (const sc of parsed.scopes) {
|
|
170
|
+
if (sc.parent === null)
|
|
171
|
+
continue;
|
|
172
|
+
let kids = childrenByParent.get(sc.parent);
|
|
173
|
+
if (kids === undefined) {
|
|
174
|
+
kids = [];
|
|
175
|
+
childrenByParent.set(sc.parent, kids);
|
|
176
|
+
}
|
|
177
|
+
kids.push(sc);
|
|
178
|
+
}
|
|
179
|
+
// PASS A — namespace-owned candidates (+ function-reference indexes).
|
|
180
|
+
for (const scope of parsed.scopes) {
|
|
181
|
+
if (scope.kind !== 'Namespace')
|
|
182
|
+
continue;
|
|
183
|
+
const qName = computeNamespaceQName(scope, scopesById);
|
|
184
|
+
// Registration keys reproduce the legacy membership test: own QName
|
|
185
|
+
// always; for an inline namespace child of a Namespace, also the parent
|
|
186
|
+
// QName (ISO C++ inline-namespace transparency for ADL).
|
|
187
|
+
const keys = [];
|
|
188
|
+
if (qName !== '')
|
|
189
|
+
keys.push(qName);
|
|
190
|
+
if (isCppInlineNamespaceScope(scope.id)) {
|
|
191
|
+
const parentScope = scope.parent !== null ? scopesById.get(scope.parent) : undefined;
|
|
192
|
+
if (parentScope !== undefined && parentScope.kind === 'Namespace') {
|
|
193
|
+
const parentQName = computeNamespaceQName(parentScope, scopesById);
|
|
194
|
+
if (parentQName !== '' && parentQName !== qName)
|
|
195
|
+
keys.push(parentQName);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
for (const def of scope.ownedDefs) {
|
|
199
|
+
if (def.type === 'Function' || def.type === 'Method') {
|
|
200
|
+
const sn = adlSimpleName(def);
|
|
201
|
+
pushFlat(idx.nsFunctionsBySimple, sn, def);
|
|
202
|
+
if (qName !== '')
|
|
203
|
+
pushNested(idx.nsFunctionsByQName, qName, sn, def);
|
|
204
|
+
}
|
|
205
|
+
if (!isAdlCallableType(def.type))
|
|
206
|
+
continue;
|
|
207
|
+
const s = seq++;
|
|
208
|
+
idx.seqByNodeId.set(def.nodeId, s);
|
|
209
|
+
const sn = adlSimpleName(def);
|
|
210
|
+
for (const key of keys)
|
|
211
|
+
pushNested(idx.nsCandidates, key, sn, def);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// PASS B — hidden-friend + class-member candidates for associated classes.
|
|
215
|
+
for (const scope of parsed.scopes) {
|
|
216
|
+
if (scope.kind !== 'Class')
|
|
217
|
+
continue;
|
|
218
|
+
// Enclosing-namespace QName(s) of the class def(s) in this scope.
|
|
219
|
+
const classNsKeys = new Set();
|
|
220
|
+
for (const def of scope.ownedDefs) {
|
|
221
|
+
if (def.type !== 'Class' && def.type !== 'Struct' && def.type !== 'Interface')
|
|
222
|
+
continue;
|
|
223
|
+
const nsQName = classToNamespaceQualifiedName.get(def.nodeId);
|
|
224
|
+
if (nsQName !== undefined)
|
|
225
|
+
classNsKeys.add(nsQName);
|
|
226
|
+
}
|
|
227
|
+
if (classNsKeys.size === 0)
|
|
228
|
+
continue;
|
|
229
|
+
// Friend functions: callable defs in child Function scopes.
|
|
230
|
+
for (const childScope of childrenByParent.get(scope.id) ?? []) {
|
|
231
|
+
if (childScope.kind !== 'Function')
|
|
232
|
+
continue;
|
|
233
|
+
for (const def of childScope.ownedDefs) {
|
|
234
|
+
if (!isAdlCallableType(def.type))
|
|
235
|
+
continue;
|
|
236
|
+
const s = seq++;
|
|
237
|
+
idx.seqByNodeId.set(def.nodeId, s);
|
|
238
|
+
const sn = adlSimpleName(def);
|
|
239
|
+
for (const key of classNsKeys)
|
|
240
|
+
pushNested(idx.friendCandidates, key, sn, def);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
// Class-member callables.
|
|
244
|
+
for (const def of scope.ownedDefs) {
|
|
245
|
+
if (!isAdlCallableType(def.type))
|
|
246
|
+
continue;
|
|
247
|
+
const s = seq++;
|
|
248
|
+
idx.seqByNodeId.set(def.nodeId, s);
|
|
249
|
+
const sn = adlSimpleName(def);
|
|
250
|
+
for (const key of classNsKeys)
|
|
251
|
+
pushNested(idx.friendCandidates, key, sn, def);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
// Dev/test-only invariant guard: every def bucketed into nsCandidates/
|
|
256
|
+
// friendCandidates must have a seqByNodeId entry, otherwise the `?? 0`
|
|
257
|
+
// fallback in pickCppAdlCandidates could collapse two seq-0 candidates and
|
|
258
|
+
// silently drop a CALLS edge. Gated like the rest of the resolver's opt-in
|
|
259
|
+
// validation (see contract/scope-resolver.ts and reconcile-ownership.ts):
|
|
260
|
+
// active in dev/test, off in production and when VALIDATE_SEMANTIC_MODEL=0.
|
|
261
|
+
if (process.env.NODE_ENV !== 'production' && process.env.VALIDATE_SEMANTIC_MODEL !== '0') {
|
|
262
|
+
const missing = validateAdlSeqCoverage(idx);
|
|
263
|
+
if (missing.length > 0) {
|
|
264
|
+
throw new Error(`[cpp-adl] seq-coverage invariant violated: ${missing.length} candidate def(s) ` +
|
|
265
|
+
`bucketed without a seqByNodeId entry (e.g. ${missing.slice(0, 5).join(', ')}). ` +
|
|
266
|
+
`Every def pushed into nsCandidates/friendCandidates must be seq-assigned in the ` +
|
|
267
|
+
`same build block — see pickCppAdlCandidates' \`?? 0\` fallback.`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return idx;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Return the nodeIds present in the index's candidate buckets
|
|
274
|
+
* (`nsCandidates` + `friendCandidates`) but missing from `seqByNodeId`, each
|
|
275
|
+
* reported once. Empty array means the seq-coverage invariant holds — which it
|
|
276
|
+
* must, since `buildAdlIndex` assigns a seq to every callable def in the same
|
|
277
|
+
* block that buckets it. Exported for the dev-gated guard in `buildAdlIndex`
|
|
278
|
+
* and its unit test.
|
|
279
|
+
*/
|
|
280
|
+
export function validateAdlSeqCoverage(idx) {
|
|
281
|
+
const missing = new Set();
|
|
282
|
+
for (const buckets of [idx.nsCandidates, idx.friendCandidates]) {
|
|
283
|
+
for (const bySimple of buckets.values()) {
|
|
284
|
+
for (const defs of bySimple.values()) {
|
|
285
|
+
for (const def of defs) {
|
|
286
|
+
if (!idx.seqByNodeId.has(def.nodeId))
|
|
287
|
+
missing.add(def.nodeId);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return [...missing];
|
|
293
|
+
}
|
|
294
|
+
/** Build the ADL index on first use of a given `parsedFiles` set; reuse it for
|
|
295
|
+
* all subsequent call sites in the same pipeline run. Reset by
|
|
296
|
+
* `clearCppAdlState`.
|
|
297
|
+
*
|
|
298
|
+
* Staleness is keyed on `parsedFiles` reference identity ONLY, but the index
|
|
299
|
+
* is a function of THREE inputs: `parsedFiles` (namespace/friend candidates),
|
|
300
|
+
* `scopes` (`classDefsBySimple`, read from `scopes.defs.byId`), and the
|
|
301
|
+
* module-level `classToNamespaceQualifiedName` (friend-candidate keys). This
|
|
302
|
+
* is sound for the current pipeline because all three are built together once
|
|
303
|
+
* per `runScopeResolution` pass and `clearCppAdlState` runs in
|
|
304
|
+
* `loadResolutionConfig` at the start of every pass. Callers MUST call
|
|
305
|
+
* `clearCppAdlState` between any two passes that change `scopes` or
|
|
306
|
+
* `classToNamespaceQualifiedName` while reusing the same `parsedFiles` array
|
|
307
|
+
* reference — otherwise a stale index would be served. (No such caller exists
|
|
308
|
+
* today; widening the guard to also key on `scopes` is deferred until one
|
|
309
|
+
* does.) */
|
|
310
|
+
function ensureAdlIndex(scopes, parsedFiles) {
|
|
311
|
+
if (adlIndex !== undefined && adlIndexSource === parsedFiles)
|
|
312
|
+
return;
|
|
313
|
+
adlIndex = buildAdlIndex(scopes, parsedFiles);
|
|
314
|
+
adlIndexSource = parsedFiles;
|
|
315
|
+
}
|
|
74
316
|
/** Record per-call-site argument info. Called once per call site from
|
|
75
317
|
* `emitCppScopeCaptures`. */
|
|
76
318
|
export function markCppAdlSiteArgs(filePath, line, col, args) {
|
|
77
|
-
|
|
319
|
+
const key = siteKey(filePath, line, col);
|
|
320
|
+
// Lockstep with `argInfoSiteKeysByFile`: index the key only on first insert
|
|
321
|
+
// (a re-mark overwrites the value but must NOT duplicate the index entry).
|
|
322
|
+
if (!argInfoBySite.has(key))
|
|
323
|
+
pushFileSiteKey(argInfoSiteKeysByFile, filePath, key);
|
|
324
|
+
argInfoBySite.set(key, args);
|
|
78
325
|
}
|
|
79
326
|
/** Mark a call site as ADL-suppressed (function child wrapped in
|
|
80
327
|
* `parenthesized_expression`, e.g. `(f)(s)`). */
|
|
81
328
|
export function markCppAdlSiteNoAdl(filePath, line, col) {
|
|
82
|
-
|
|
329
|
+
const key = siteKey(filePath, line, col);
|
|
330
|
+
// Lockstep with `noAdlSiteKeysByFile`: index the key only on first insert.
|
|
331
|
+
if (!noAdlSites.has(key))
|
|
332
|
+
pushFileSiteKey(noAdlSiteKeysByFile, filePath, key);
|
|
333
|
+
noAdlSites.add(key);
|
|
334
|
+
}
|
|
335
|
+
const SITE_KEY_RE = /^(.*):(\d+):(\d+)$/;
|
|
336
|
+
/** Split a `filePath:line:col` site key, tolerating colons in the path. */
|
|
337
|
+
function parseSiteKey(key) {
|
|
338
|
+
const m = SITE_KEY_RE.exec(key);
|
|
339
|
+
if (m === null)
|
|
340
|
+
return undefined;
|
|
341
|
+
return { filePath: m[1], line: Number(m[2]), col: Number(m[3]) };
|
|
83
342
|
}
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
343
|
+
/**
|
|
344
|
+
* Snapshot this file's ADL capture state for the worker→main side-channel.
|
|
345
|
+
*
|
|
346
|
+
* Uses the per-file `argInfoSiteKeysByFile` / `noAdlSiteKeysByFile` indexes to
|
|
347
|
+
* touch only THIS file's entries — O(entries-for-this-file) — instead of the
|
|
348
|
+
* old O(all-entries) full scan over `argInfoBySite` / `noAdlSites` (#1983).
|
|
349
|
+
* The output order, and therefore the serialized JSON shape, is byte-identical
|
|
350
|
+
* to the old filtered scan: the index records keys in the same insertion order
|
|
351
|
+
* the maps' own iteration would have yielded for this file, and each key is
|
|
352
|
+
* indexed exactly once (mark guards on first insert), so the same per-file
|
|
353
|
+
* subsequence is produced.
|
|
354
|
+
*
|
|
355
|
+
* `parseSiteKey` is still used to recover `line:col` from each key, but now
|
|
356
|
+
* only for this file's keys (a bounded handful), never for the whole batch.
|
|
357
|
+
*/
|
|
358
|
+
export function collectCppAdlSideChannel(filePath) {
|
|
359
|
+
const args = [];
|
|
360
|
+
for (const key of argInfoSiteKeysByFile.get(filePath) ?? []) {
|
|
361
|
+
const value = argInfoBySite.get(key);
|
|
362
|
+
const parsed = parseSiteKey(key);
|
|
363
|
+
if (value !== undefined && parsed !== undefined) {
|
|
364
|
+
args.push([parsed.line, parsed.col, value]);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
const noAdl = [];
|
|
368
|
+
for (const key of noAdlSiteKeysByFile.get(filePath) ?? []) {
|
|
369
|
+
const parsed = parseSiteKey(key);
|
|
370
|
+
if (parsed !== undefined) {
|
|
371
|
+
noAdl.push([parsed.line, parsed.col]);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
return { argInfoBySite: args, noAdlSites: noAdl };
|
|
375
|
+
}
|
|
376
|
+
/** Restore this file's ADL capture state from the side-channel (no parse).
|
|
377
|
+
* Keeps the per-file site-key indexes in lockstep with `argInfoBySite` /
|
|
378
|
+
* `noAdlSites` (first-insert-only) so a later `collectCppAdlSideChannel` on
|
|
379
|
+
* the same process would still produce a correct, duplicate-free snapshot. */
|
|
380
|
+
export function applyCppAdlSideChannel(filePath, data) {
|
|
381
|
+
for (const [line, col, value] of data.argInfoBySite) {
|
|
382
|
+
const key = siteKey(filePath, line, col);
|
|
383
|
+
if (!argInfoBySite.has(key))
|
|
384
|
+
pushFileSiteKey(argInfoSiteKeysByFile, filePath, key);
|
|
385
|
+
argInfoBySite.set(key, value);
|
|
386
|
+
}
|
|
387
|
+
for (const [line, col] of data.noAdlSites) {
|
|
388
|
+
const key = siteKey(filePath, line, col);
|
|
389
|
+
if (!noAdlSites.has(key))
|
|
390
|
+
pushFileSiteKey(noAdlSiteKeysByFile, filePath, key);
|
|
391
|
+
noAdlSites.add(key);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
/** Clear ADL state. Called from `cppScopeResolver.loadResolutionConfig`
|
|
395
|
+
* (alongside `clearFileLocalNames`) so all C++ resolver per-pipeline state is
|
|
396
|
+
* reset together at the start of each resolution pass. */
|
|
86
397
|
export function clearCppAdlState() {
|
|
87
398
|
argInfoBySite.clear();
|
|
88
399
|
noAdlSites.clear();
|
|
400
|
+
// Lockstep: the per-file site-key indexes mirror argInfoBySite/noAdlSites and
|
|
401
|
+
// MUST be cleared together — a stale index would resurrect a prior pass's
|
|
402
|
+
// (or prior file's, after a re-key) keys into the next snapshot.
|
|
403
|
+
argInfoSiteKeysByFile.clear();
|
|
404
|
+
noAdlSiteKeysByFile.clear();
|
|
89
405
|
classToNamespaceQualifiedName.clear();
|
|
406
|
+
adlIndex = undefined;
|
|
407
|
+
adlIndexSource = undefined;
|
|
90
408
|
}
|
|
91
409
|
/**
|
|
92
410
|
* Walk `parsed.scopes` to record each Class def's enclosing namespace
|
|
@@ -148,123 +466,54 @@ export function pickCppAdlCandidates(site, callerParsed, scopes, parsedFiles) {
|
|
|
148
466
|
const args = argInfoBySite.get(key);
|
|
149
467
|
if (args === undefined || args.length === 0)
|
|
150
468
|
return undefined;
|
|
469
|
+
// Build the workspace-wide ADL candidate index once; reuse for every site.
|
|
470
|
+
ensureAdlIndex(scopes, parsedFiles);
|
|
151
471
|
// Collect associated namespace QNames from every participating class-typed arg
|
|
152
472
|
// and from function-reference args.
|
|
153
473
|
const associatedNamespaces = new Set();
|
|
154
474
|
for (const arg of args) {
|
|
155
475
|
collectAssociatedNamespacesForAdlArg(arg, scopes, associatedNamespaces);
|
|
156
476
|
if (arg.functionRefText !== undefined) {
|
|
157
|
-
collectFunctionTypeAssociatedNamespaces(arg.functionRefText, scopes,
|
|
477
|
+
collectFunctionTypeAssociatedNamespaces(arg.functionRefText, scopes, associatedNamespaces);
|
|
158
478
|
}
|
|
159
479
|
}
|
|
160
480
|
if (associatedNamespaces.size === 0)
|
|
161
481
|
return undefined;
|
|
162
|
-
//
|
|
163
|
-
//
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
//
|
|
167
|
-
|
|
482
|
+
// Gather candidates from the prebuilt index instead of re-scanning every
|
|
483
|
+
// parsed file. For each associated namespace, pull:
|
|
484
|
+
// - namespace-owned callables (`nsCandidates`, includes inline-namespace
|
|
485
|
+
// transparency), AND
|
|
486
|
+
// - hidden-friend / class-member callables of associated classes
|
|
487
|
+
// (`friendCandidates`, ISO C++ `[basic.lookup.argdep]` §2).
|
|
488
|
+
// Dedup by nodeId and sort by visitation sequence so the candidate list is
|
|
489
|
+
// byte-for-byte identical to the legacy file-major scan order.
|
|
490
|
+
const idx = adlIndex;
|
|
491
|
+
if (idx === undefined)
|
|
492
|
+
return undefined;
|
|
493
|
+
const bySeq = new Map();
|
|
168
494
|
const seenKey = new Set();
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
for (const scope of parsed.scopes) {
|
|
174
|
-
if (scope.kind !== 'Namespace')
|
|
495
|
+
const collectFrom = (buckets) => {
|
|
496
|
+
for (const ns of associatedNamespaces) {
|
|
497
|
+
const matches = buckets.get(ns)?.get(site.name);
|
|
498
|
+
if (matches === undefined)
|
|
175
499
|
continue;
|
|
176
|
-
const
|
|
177
|
-
if (!associatedNamespaces.has(qName)) {
|
|
178
|
-
// Check if this is an inline-namespace child of an associated NS.
|
|
179
|
-
// ISO C++ inline namespaces are transparent for ADL: if the outer
|
|
180
|
-
// namespace is in the associated set, candidates in the inline child
|
|
181
|
-
// are also reachable.
|
|
182
|
-
if (!isCppInlineNamespaceScope(scope.id))
|
|
183
|
-
continue;
|
|
184
|
-
const parentScope = scope.parent !== null ? scopesById.get(scope.parent) : undefined;
|
|
185
|
-
if (parentScope === undefined || parentScope.kind !== 'Namespace')
|
|
186
|
-
continue;
|
|
187
|
-
const parentQName = computeNamespaceQName(parentScope, scopesById);
|
|
188
|
-
if (!associatedNamespaces.has(parentQName))
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
for (const def of scope.ownedDefs) {
|
|
192
|
-
if (def.type !== 'Function' && def.type !== 'Method' && def.type !== 'Constructor') {
|
|
193
|
-
continue;
|
|
194
|
-
}
|
|
195
|
-
const simple = def.qualifiedName?.split('.').pop() ?? def.qualifiedName ?? '';
|
|
196
|
-
if (simple !== site.name)
|
|
197
|
-
continue;
|
|
198
|
-
// Dedup by nodeId — using normalized parameter-types as the key
|
|
199
|
-
// would collapse `process(int)`/`process(long)`-style overloads
|
|
200
|
-
// (both normalize to `['int']`) before
|
|
201
|
-
// `isOverloadAmbiguousAfterNormalization` can detect them.
|
|
500
|
+
for (const def of matches) {
|
|
202
501
|
if (seenKey.has(def.nodeId))
|
|
203
502
|
continue;
|
|
204
503
|
seenKey.add(def.nodeId);
|
|
205
|
-
|
|
504
|
+
// `?? 0` is unreachable: every bucketed def is seq-assigned in the same
|
|
505
|
+
// block that buckets it in buildAdlIndex (PASS A / PASS B). The dev-gated
|
|
506
|
+
// validateAdlSeqCoverage guard in buildAdlIndex fails loudly if that ever
|
|
507
|
+
// breaks, rather than letting two seq-0 defs collide and drop a candidate.
|
|
508
|
+
bySeq.set(idx.seqByNodeId.get(def.nodeId) ?? 0, def);
|
|
206
509
|
}
|
|
207
510
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
// canonical "hidden friend" idiom:
|
|
213
|
-
// struct Foo { friend void swap(Foo&, Foo&) {} };
|
|
214
|
-
for (const scope of parsed.scopes) {
|
|
215
|
-
if (scope.kind !== 'Class')
|
|
216
|
-
continue;
|
|
217
|
-
// Check if ANY class def in this scope has an associated namespace.
|
|
218
|
-
let isAssociatedClass = false;
|
|
219
|
-
for (const def of scope.ownedDefs) {
|
|
220
|
-
if (def.type !== 'Class' && def.type !== 'Struct' && def.type !== 'Interface')
|
|
221
|
-
continue;
|
|
222
|
-
const nsQName = classToNamespaceQualifiedName.get(def.nodeId);
|
|
223
|
-
if (nsQName !== undefined && associatedNamespaces.has(nsQName)) {
|
|
224
|
-
isAssociatedClass = true;
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
if (!isAssociatedClass)
|
|
229
|
-
continue;
|
|
230
|
-
// Also scan Function scopes that are direct children of this class
|
|
231
|
-
// scope — friend function definitions create their own Function scope
|
|
232
|
-
// underneath the Class scope.
|
|
233
|
-
for (const childScope of parsed.scopes) {
|
|
234
|
-
if (childScope.parent !== scope.id)
|
|
235
|
-
continue;
|
|
236
|
-
if (childScope.kind !== 'Function')
|
|
237
|
-
continue;
|
|
238
|
-
for (const def of childScope.ownedDefs) {
|
|
239
|
-
if (def.type !== 'Function' && def.type !== 'Method' && def.type !== 'Constructor') {
|
|
240
|
-
continue;
|
|
241
|
-
}
|
|
242
|
-
const simple = def.qualifiedName?.split('.').pop() ?? def.qualifiedName ?? '';
|
|
243
|
-
if (simple !== site.name)
|
|
244
|
-
continue;
|
|
245
|
-
if (seenKey.has(def.nodeId))
|
|
246
|
-
continue;
|
|
247
|
-
seenKey.add(def.nodeId);
|
|
248
|
-
candidates.push(def);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
for (const def of scope.ownedDefs) {
|
|
252
|
-
if (def.type !== 'Function' && def.type !== 'Method' && def.type !== 'Constructor') {
|
|
253
|
-
continue;
|
|
254
|
-
}
|
|
255
|
-
const simple = def.qualifiedName?.split('.').pop() ?? def.qualifiedName ?? '';
|
|
256
|
-
if (simple !== site.name)
|
|
257
|
-
continue;
|
|
258
|
-
if (seenKey.has(def.nodeId))
|
|
259
|
-
continue;
|
|
260
|
-
seenKey.add(def.nodeId);
|
|
261
|
-
candidates.push(def);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
if (candidates.length === 0)
|
|
511
|
+
};
|
|
512
|
+
collectFrom(idx.nsCandidates);
|
|
513
|
+
collectFrom(idx.friendCandidates);
|
|
514
|
+
if (bySeq.size === 0)
|
|
266
515
|
return undefined;
|
|
267
|
-
return
|
|
516
|
+
return [...bySeq.entries()].sort((a, b) => a[0] - b[0]).map(([, def]) => def);
|
|
268
517
|
}
|
|
269
518
|
function collectAssociatedNamespacesForAdlArg(arg, scopes, associatedNamespaces) {
|
|
270
519
|
// For template args this may be the template name itself (e.g. `vector`);
|
|
@@ -287,7 +536,7 @@ function collectAssociatedNamespacesForAdlArg(arg, scopes, associatedNamespaces)
|
|
|
287
536
|
function addAssociatedNamespaceForClassName(simpleClassName, scopes, associatedNamespaces) {
|
|
288
537
|
if (simpleClassName.length === 0)
|
|
289
538
|
return;
|
|
290
|
-
const classLookup = findCppClassDefBySimpleName(simpleClassName
|
|
539
|
+
const classLookup = findCppClassDefBySimpleName(simpleClassName);
|
|
291
540
|
if (classLookup === undefined)
|
|
292
541
|
return;
|
|
293
542
|
const { classDef, ambiguous } = classLookup;
|
|
@@ -380,32 +629,25 @@ function findNamespaceDefInScope(scope) {
|
|
|
380
629
|
*
|
|
381
630
|
* ISO C++ `[basic.lookup.argdep]` §2: enumerations contribute their
|
|
382
631
|
* enclosing namespace to the associated set, just like class types. */
|
|
383
|
-
function findCppClassDefBySimpleName(simpleName
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
const simple = def.qualifiedName?.split('.').pop() ?? def.qualifiedName ?? '';
|
|
392
|
-
if (simple !== simpleName)
|
|
393
|
-
continue;
|
|
394
|
-
if (firstMatch === undefined) {
|
|
395
|
-
firstMatch = def;
|
|
396
|
-
continue;
|
|
397
|
-
}
|
|
398
|
-
return { classDef: firstMatch, ambiguous: true };
|
|
399
|
-
}
|
|
400
|
-
if (firstMatch === undefined)
|
|
632
|
+
function findCppClassDefBySimpleName(simpleName) {
|
|
633
|
+
// `classDefsBySimple` preserves `scopes.defs.byId` order, so `[0]` is the
|
|
634
|
+
// legacy first-match and `length > 1` is the legacy `ambiguous` flag.
|
|
635
|
+
const matches = adlIndex?.classDefsBySimple.get(simpleName);
|
|
636
|
+
if (matches === undefined)
|
|
637
|
+
return undefined;
|
|
638
|
+
const first = matches[0];
|
|
639
|
+
if (first === undefined)
|
|
401
640
|
return undefined;
|
|
402
|
-
return { classDef:
|
|
641
|
+
return { classDef: first, ambiguous: matches.length > 1 };
|
|
403
642
|
}
|
|
404
643
|
/**
|
|
405
644
|
* Contribute associated namespaces for a function-reference argument by walking
|
|
406
645
|
* the referenced overload set's parameter and return types.
|
|
407
646
|
*/
|
|
408
|
-
function collectFunctionTypeAssociatedNamespaces(refText, scopes,
|
|
647
|
+
function collectFunctionTypeAssociatedNamespaces(refText, scopes, out) {
|
|
648
|
+
const idx = adlIndex;
|
|
649
|
+
if (idx === undefined)
|
|
650
|
+
return;
|
|
409
651
|
const colonIdx = refText.lastIndexOf('::');
|
|
410
652
|
if (colonIdx !== -1) {
|
|
411
653
|
// Qualified ref: extract namespace prefix and normalise :: → dot notation.
|
|
@@ -413,27 +655,14 @@ function collectFunctionTypeAssociatedNamespaces(refText, scopes, parsedFiles, o
|
|
|
413
655
|
if (nsText === '')
|
|
414
656
|
return;
|
|
415
657
|
const simpleName = refText.slice(colonIdx + 2);
|
|
416
|
-
//
|
|
417
|
-
//
|
|
418
|
-
// enum value
|
|
419
|
-
// to the associated set
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
for (const
|
|
423
|
-
|
|
424
|
-
for (const scope of parsed.scopes) {
|
|
425
|
-
if (scope.kind !== 'Namespace')
|
|
426
|
-
continue;
|
|
427
|
-
if (computeNamespaceQName(scope, scopesById) !== nsText)
|
|
428
|
-
continue;
|
|
429
|
-
for (const def of scope.ownedDefs) {
|
|
430
|
-
if (def.type !== 'Function' && def.type !== 'Method')
|
|
431
|
-
continue;
|
|
432
|
-
const simple = def.qualifiedName?.split('.').pop() ?? def.qualifiedName ?? '';
|
|
433
|
-
if (simple === simpleName)
|
|
434
|
-
collectAssociatedNamespacesForFunctionDef(def, scopes, out);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
658
|
+
// Only Function/Method defs named `simpleName` in `nsText` contribute
|
|
659
|
+
// (the index already restricts to those types); this guards against an
|
|
660
|
+
// `a::b` arg that names a variable / enum value / type alias blindly
|
|
661
|
+
// contributing `a` to the associated set (false-positive CALLS edge).
|
|
662
|
+
const matches = idx.nsFunctionsByQName.get(nsText)?.get(simpleName);
|
|
663
|
+
if (matches !== undefined) {
|
|
664
|
+
for (const def of matches)
|
|
665
|
+
collectAssociatedNamespacesForFunctionDef(def, scopes, out);
|
|
437
666
|
}
|
|
438
667
|
return;
|
|
439
668
|
}
|
|
@@ -441,19 +670,10 @@ function collectFunctionTypeAssociatedNamespaces(refText, scopes, parsedFiles, o
|
|
|
441
670
|
// the previous V1 lookup scope. The stricter part of this PR is what each
|
|
442
671
|
// overload contributes: only namespaces from parameter/return types, never
|
|
443
672
|
// the function's own enclosing namespace.
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
for (const def of scope.ownedDefs) {
|
|
449
|
-
if (def.type !== 'Function' && def.type !== 'Method')
|
|
450
|
-
continue;
|
|
451
|
-
const simple = def.qualifiedName?.split('.').pop() ?? def.qualifiedName ?? '';
|
|
452
|
-
if (simple !== refText)
|
|
453
|
-
continue;
|
|
454
|
-
collectAssociatedNamespacesForFunctionDef(def, scopes, out);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
673
|
+
const matches = idx.nsFunctionsBySimple.get(refText);
|
|
674
|
+
if (matches !== undefined) {
|
|
675
|
+
for (const def of matches)
|
|
676
|
+
collectAssociatedNamespacesForFunctionDef(def, scopes, out);
|
|
457
677
|
}
|
|
458
678
|
}
|
|
459
679
|
function collectAssociatedNamespacesForFunctionDef(def, scopes, out) {
|
|
@@ -23,7 +23,6 @@ export function computeCppDeclarationArity(node) {
|
|
|
23
23
|
continue;
|
|
24
24
|
if (child.type === 'parameter_declaration' ||
|
|
25
25
|
child.type === 'optional_parameter_declaration' ||
|
|
26
|
-
child.type === 'variadic_parameter' ||
|
|
27
26
|
child.type === 'variadic_parameter_declaration') {
|
|
28
27
|
params.push(child);
|
|
29
28
|
}
|
|
@@ -47,8 +46,7 @@ export function computeCppDeclarationArity(node) {
|
|
|
47
46
|
// token in tree-sitter-cpp, detected via `hasEllipsis` above.
|
|
48
47
|
// C++ parameter packs: `template<typename... Ts> void foo(Ts... args)` —
|
|
49
48
|
// detected as `variadic_parameter_declaration`.
|
|
50
|
-
const isVariadic = hasEllipsis ||
|
|
51
|
-
params.some((p) => p.type === 'variadic_parameter' || p.type === 'variadic_parameter_declaration');
|
|
49
|
+
const isVariadic = hasEllipsis || params.some((p) => p.type === 'variadic_parameter_declaration');
|
|
52
50
|
const optionalCount = params.filter((p) => p.type === 'optional_parameter_declaration').length;
|
|
53
51
|
const requiredCount = params.filter((p) => p.type === 'parameter_declaration' ||
|
|
54
52
|
// variadic_parameter_declaration with a name is a parameter pack — counts as one
|
|
@@ -57,11 +55,7 @@ export function computeCppDeclarationArity(node) {
|
|
|
57
55
|
const types = [];
|
|
58
56
|
const typeClasses = [];
|
|
59
57
|
for (const p of params) {
|
|
60
|
-
if (p.type === '
|
|
61
|
-
types.push('...');
|
|
62
|
-
typeClasses.push(unknownTypeClass('...'));
|
|
63
|
-
}
|
|
64
|
-
else if (p.type === 'variadic_parameter_declaration') {
|
|
58
|
+
if (p.type === 'variadic_parameter_declaration') {
|
|
65
59
|
// Parameter pack: treated as variadic
|
|
66
60
|
types.push('...');
|
|
67
61
|
typeClasses.push(unknownTypeClass('...'));
|