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
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C capture-time side-channel serialization (#1983).
|
|
3
|
+
*
|
|
4
|
+
* `emitCScopeCaptures` populates one MODULE-LEVEL, per-file map as a side
|
|
5
|
+
* effect that is NOT part of the returned `ParsedFile`'s scopes/defs:
|
|
6
|
+
*
|
|
7
|
+
* - `staticNames` (static-linkage.ts) — the simple names of functions
|
|
8
|
+
* declared with `static` storage class (file-local / translation-unit
|
|
9
|
+
* linkage in C), recorded via `markStaticName` from the
|
|
10
|
+
* `@declaration.name` capture when the function node has a `static`
|
|
11
|
+
* storage-class specifier.
|
|
12
|
+
*
|
|
13
|
+
* On the worker path that map is filled in the WORKER process and lost across
|
|
14
|
+
* the worker→main MessageChannel (and the disk-backed parsedfile-store),
|
|
15
|
+
* because scope-resolution reuses the serialized `ParsedFile` and SKIPS the
|
|
16
|
+
* main-thread re-extraction (the #1983 fix that avoids a main-thread
|
|
17
|
+
* tree-sitter re-parse / OOM on huge repos — e.g. the Linux kernel). The main
|
|
18
|
+
* thread then reads the map empty in `isStaticName` (consulted by
|
|
19
|
+
* `isFileLocalDef` in `c/scope-resolver.ts` and by `expandCWildcardNames` in
|
|
20
|
+
* static-linkage.ts) — so file-local `static` functions become eligible for
|
|
21
|
+
* cross-file global free-call resolution (false CALLS edges) and `#include`
|
|
22
|
+
* wildcard imports over-expose them.
|
|
23
|
+
*
|
|
24
|
+
* This module snapshots the per-file slice of that map into a plain,
|
|
25
|
+
* JSON-serializable object (carried on `ParsedFile.captureSideChannel`) and
|
|
26
|
+
* restores it on the main thread WITHOUT any parse. It mirrors the C++ pattern
|
|
27
|
+
* in `cpp/capture-side-channel.ts` and the Kotlin pattern in
|
|
28
|
+
* `kotlin/capture-side-channel.ts`.
|
|
29
|
+
*
|
|
30
|
+
* The single generic `ParsedFile.captureSideChannel` field is shared with C++
|
|
31
|
+
* and Kotlin, which is safe because each file is one language (a `.c` file uses
|
|
32
|
+
* the C provider). The payload is self-describing (`{ kind: 'c', staticNames }`)
|
|
33
|
+
* so `applyCStaticLinkageSideChannel` only restores C state and ignores a
|
|
34
|
+
* foreign-shaped snapshot.
|
|
35
|
+
*/
|
|
36
|
+
import type { ParsedFile } from '../../../../_shared/index.js';
|
|
37
|
+
/**
|
|
38
|
+
* Plain JSON-serializable snapshot of the per-file C capture-time
|
|
39
|
+
* side-channel. Carried opaquely on `ParsedFile.captureSideChannel`. The
|
|
40
|
+
* `kind` tag makes the payload self-describing so `apply` can distinguish a C
|
|
41
|
+
* snapshot from another language's (C++ and Kotlin share the same field).
|
|
42
|
+
*/
|
|
43
|
+
export interface CCaptureSideChannel {
|
|
44
|
+
readonly kind: 'c';
|
|
45
|
+
/** Simple names of `static` (file-local linkage) functions in this file. */
|
|
46
|
+
readonly staticNames: readonly string[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* `LanguageProvider.collectCaptureSideChannel` implementation for C.
|
|
50
|
+
* Returns `undefined` when this file recorded no static names at all, so the
|
|
51
|
+
* produced `ParsedFile` carries the field only when there's data to ship.
|
|
52
|
+
*/
|
|
53
|
+
export declare function collectCStaticLinkageSideChannel(filePath: string): CCaptureSideChannel | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* `ScopeResolver.applyCaptureSideChannel` implementation for C. Reads the
|
|
56
|
+
* worker-serialized snapshot from `parsed.captureSideChannel` and re-populates
|
|
57
|
+
* the module-level static-linkage map via `markStaticName`. Tolerant of
|
|
58
|
+
* `undefined` (file carried no data) and of an unexpected / foreign shape
|
|
59
|
+
* (defensive — the `kind` tag guards against restoring a non-C payload).
|
|
60
|
+
* Does NO tree-sitter parse.
|
|
61
|
+
*/
|
|
62
|
+
export declare function applyCStaticLinkageSideChannel(parsed: ParsedFile): void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C capture-time side-channel serialization (#1983).
|
|
3
|
+
*
|
|
4
|
+
* `emitCScopeCaptures` populates one MODULE-LEVEL, per-file map as a side
|
|
5
|
+
* effect that is NOT part of the returned `ParsedFile`'s scopes/defs:
|
|
6
|
+
*
|
|
7
|
+
* - `staticNames` (static-linkage.ts) — the simple names of functions
|
|
8
|
+
* declared with `static` storage class (file-local / translation-unit
|
|
9
|
+
* linkage in C), recorded via `markStaticName` from the
|
|
10
|
+
* `@declaration.name` capture when the function node has a `static`
|
|
11
|
+
* storage-class specifier.
|
|
12
|
+
*
|
|
13
|
+
* On the worker path that map is filled in the WORKER process and lost across
|
|
14
|
+
* the worker→main MessageChannel (and the disk-backed parsedfile-store),
|
|
15
|
+
* because scope-resolution reuses the serialized `ParsedFile` and SKIPS the
|
|
16
|
+
* main-thread re-extraction (the #1983 fix that avoids a main-thread
|
|
17
|
+
* tree-sitter re-parse / OOM on huge repos — e.g. the Linux kernel). The main
|
|
18
|
+
* thread then reads the map empty in `isStaticName` (consulted by
|
|
19
|
+
* `isFileLocalDef` in `c/scope-resolver.ts` and by `expandCWildcardNames` in
|
|
20
|
+
* static-linkage.ts) — so file-local `static` functions become eligible for
|
|
21
|
+
* cross-file global free-call resolution (false CALLS edges) and `#include`
|
|
22
|
+
* wildcard imports over-expose them.
|
|
23
|
+
*
|
|
24
|
+
* This module snapshots the per-file slice of that map into a plain,
|
|
25
|
+
* JSON-serializable object (carried on `ParsedFile.captureSideChannel`) and
|
|
26
|
+
* restores it on the main thread WITHOUT any parse. It mirrors the C++ pattern
|
|
27
|
+
* in `cpp/capture-side-channel.ts` and the Kotlin pattern in
|
|
28
|
+
* `kotlin/capture-side-channel.ts`.
|
|
29
|
+
*
|
|
30
|
+
* The single generic `ParsedFile.captureSideChannel` field is shared with C++
|
|
31
|
+
* and Kotlin, which is safe because each file is one language (a `.c` file uses
|
|
32
|
+
* the C provider). The payload is self-describing (`{ kind: 'c', staticNames }`)
|
|
33
|
+
* so `applyCStaticLinkageSideChannel` only restores C state and ignores a
|
|
34
|
+
* foreign-shaped snapshot.
|
|
35
|
+
*/
|
|
36
|
+
import { getStaticNamesForFile, markStaticName } from './static-linkage.js';
|
|
37
|
+
/**
|
|
38
|
+
* `LanguageProvider.collectCaptureSideChannel` implementation for C.
|
|
39
|
+
* Returns `undefined` when this file recorded no static names at all, so the
|
|
40
|
+
* produced `ParsedFile` carries the field only when there's data to ship.
|
|
41
|
+
*/
|
|
42
|
+
export function collectCStaticLinkageSideChannel(filePath) {
|
|
43
|
+
const staticNames = getStaticNamesForFile(filePath);
|
|
44
|
+
if (staticNames.length === 0)
|
|
45
|
+
return undefined;
|
|
46
|
+
return { kind: 'c', staticNames };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* `ScopeResolver.applyCaptureSideChannel` implementation for C. Reads the
|
|
50
|
+
* worker-serialized snapshot from `parsed.captureSideChannel` and re-populates
|
|
51
|
+
* the module-level static-linkage map via `markStaticName`. Tolerant of
|
|
52
|
+
* `undefined` (file carried no data) and of an unexpected / foreign shape
|
|
53
|
+
* (defensive — the `kind` tag guards against restoring a non-C payload).
|
|
54
|
+
* Does NO tree-sitter parse.
|
|
55
|
+
*/
|
|
56
|
+
export function applyCStaticLinkageSideChannel(parsed) {
|
|
57
|
+
const data = parsed.captureSideChannel;
|
|
58
|
+
if (data === undefined || data === null || typeof data !== 'object')
|
|
59
|
+
return;
|
|
60
|
+
if (data.kind !== 'c' || !Array.isArray(data.staticNames))
|
|
61
|
+
return;
|
|
62
|
+
for (const name of data.staticNames) {
|
|
63
|
+
markStaticName(parsed.filePath, name);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { nodeIfType, nodeToCapture, syntheticCapture, } from '../../utils/ast-helpers.js';
|
|
2
2
|
import { getCParser, getCScopeQuery } from './query.js';
|
|
3
3
|
import { getTreeSitterBufferSize } from '../../constants.js';
|
|
4
4
|
import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
|
|
@@ -14,23 +14,36 @@ export function emitCScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
14
14
|
}
|
|
15
15
|
const rawMatches = getCScopeQuery().matches(tree.rootNode);
|
|
16
16
|
const out = [];
|
|
17
|
-
// Track ranges where typedef-struct/union was captured as
|
|
18
|
-
// so we can suppress the duplicate @declaration.typedef match
|
|
19
|
-
const
|
|
17
|
+
// Track ranges where typedef-struct/union/enum was captured as its concrete
|
|
18
|
+
// type so we can suppress the duplicate @declaration.typedef match.
|
|
19
|
+
const concreteTypedefRanges = new Set();
|
|
20
20
|
for (const m of rawMatches) {
|
|
21
21
|
const grouped = {};
|
|
22
|
+
// Parallel tag -> captured SyntaxNode map. The tree-sitter query already
|
|
23
|
+
// hands us each matched node as `c.node`, so anchors resolve via a
|
|
24
|
+
// type-guarded lookup (`nodeIfType`) instead of re-deriving them with
|
|
25
|
+
// `findNodeAtRange(tree.rootNode, ...)` per match — the
|
|
26
|
+
// O(matches × rootChildren) root-walk fixed for go #1848 / python #1918 /
|
|
27
|
+
// rust/csharp #1915 / java #1951, mirrored here for C. Every C scope-query
|
|
28
|
+
// anchor below captures directly ON the node the old root-walk re-derived
|
|
29
|
+
// (verified against C_SCOPE_QUERY in query.ts: @import.statement on
|
|
30
|
+
// preproc_include, @declaration.function on function_definition/declaration,
|
|
31
|
+
// @reference.call.free/.member on call_expression), so the type check is
|
|
32
|
+
// exact. C has no inheritance construct, so there is no heritage synthesis.
|
|
33
|
+
const nodeMap = {};
|
|
22
34
|
for (const c of m.captures) {
|
|
23
35
|
const tag = '@' + c.name;
|
|
24
36
|
if (tag.startsWith('@_'))
|
|
25
37
|
continue;
|
|
26
38
|
grouped[tag] = nodeToCapture(tag, c.node);
|
|
39
|
+
nodeMap[tag] = c.node;
|
|
27
40
|
}
|
|
28
41
|
if (Object.keys(grouped).length === 0)
|
|
29
42
|
continue;
|
|
30
|
-
// Handle #include statements
|
|
43
|
+
// Handle #include statements. `@import.statement` is captured directly on
|
|
44
|
+
// the `preproc_include` node.
|
|
31
45
|
if (grouped['@import.statement'] !== undefined) {
|
|
32
|
-
const
|
|
33
|
-
const includeNode = findNodeAtRange(tree.rootNode, anchor.range, 'preproc_include');
|
|
46
|
+
const includeNode = nodeIfType(nodeMap['@import.statement'], 'preproc_include');
|
|
34
47
|
if (includeNode !== null) {
|
|
35
48
|
const split = splitCInclude(includeNode);
|
|
36
49
|
if (split !== null) {
|
|
@@ -39,25 +52,28 @@ export function emitCScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
39
52
|
}
|
|
40
53
|
}
|
|
41
54
|
}
|
|
42
|
-
// Track typedef
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
// Track typedef struct/union/enum ranges to suppress duplicate typedef declarations
|
|
56
|
+
const concreteTypeAnchor = grouped['@declaration.struct'] ??
|
|
57
|
+
grouped['@declaration.union'] ??
|
|
58
|
+
grouped['@declaration.enum'];
|
|
59
|
+
if (concreteTypeAnchor !== undefined) {
|
|
60
|
+
const r = concreteTypeAnchor.range;
|
|
61
|
+
concreteTypedefRanges.add(`${r.startLine}:${r.startCol}:${r.endLine}:${r.endCol}`);
|
|
47
62
|
}
|
|
48
|
-
// Suppress @declaration.typedef if the same range was already captured as
|
|
63
|
+
// Suppress @declaration.typedef if the same range was already captured as a concrete type.
|
|
49
64
|
const typedefAnchor = grouped['@declaration.typedef'];
|
|
50
65
|
if (typedefAnchor !== undefined) {
|
|
51
66
|
const r = typedefAnchor.range;
|
|
52
67
|
const key = `${r.startLine}:${r.startCol}:${r.endLine}:${r.endCol}`;
|
|
53
|
-
if (
|
|
68
|
+
if (concreteTypedefRanges.has(key))
|
|
54
69
|
continue;
|
|
55
70
|
}
|
|
56
|
-
// Enrich function declarations with arity metadata and detect static linkage
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
// Enrich function declarations with arity metadata and detect static linkage.
|
|
72
|
+
// `@declaration.function` is captured directly on the `function_definition`
|
|
73
|
+
// node (definitions) or the `declaration` node (prototypes) — the captured
|
|
74
|
+
// node IS what the old findNodeAtRange re-derived.
|
|
75
|
+
if (grouped['@declaration.function'] !== undefined) {
|
|
76
|
+
const fnNode = nodeIfType(nodeMap['@declaration.function'], 'function_definition', 'declaration');
|
|
61
77
|
if (fnNode !== null) {
|
|
62
78
|
const arity = computeCDeclarationArity(fnNode);
|
|
63
79
|
if (arity.parameterCount !== undefined) {
|
|
@@ -78,10 +94,12 @@ export function emitCScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
78
94
|
}
|
|
79
95
|
}
|
|
80
96
|
}
|
|
81
|
-
// Enrich call references with arity
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
97
|
+
// Enrich call references with arity. @reference.call.free / .member are both
|
|
98
|
+
// captured directly on the `call_expression` node — the captured node IS
|
|
99
|
+
// what the old findNodeAtRange re-derived.
|
|
100
|
+
const callAnchorNode = nodeMap['@reference.call.free'] ?? nodeMap['@reference.call.member'];
|
|
101
|
+
if (callAnchorNode !== undefined && grouped['@reference.arity'] === undefined) {
|
|
102
|
+
const callNode = nodeIfType(callAnchorNode, 'call_expression');
|
|
85
103
|
if (callNode !== null) {
|
|
86
104
|
grouped['@reference.arity'] = syntheticCapture('@reference.arity', callNode, String(computeCCallArity(callNode)));
|
|
87
105
|
}
|
|
@@ -4,5 +4,14 @@ import { type SyntaxNode } from '../../utils/ast-helpers.js';
|
|
|
4
4
|
* Decompose a `preproc_include` node into a CaptureMatch with structured
|
|
5
5
|
* import captures. C #include maps to a wildcard import (all symbols
|
|
6
6
|
* from the header are visible).
|
|
7
|
+
*
|
|
8
|
+
* Only literal include paths are emitted as import sources:
|
|
9
|
+
* #include <stdio.h> → system_lib_string
|
|
10
|
+
* #include "local.h" → string_literal
|
|
11
|
+
* A computed include like `#include HEADER_MACRO` carries an `identifier`
|
|
12
|
+
* path node (the macro name, not a header path). Emitting it as an import
|
|
13
|
+
* source produces a garbage literal edge, so we skip it entirely — matching
|
|
14
|
+
* the convention in interpretCImport, which drops imports with no resolvable
|
|
15
|
+
* source (issue #1919 F5).
|
|
7
16
|
*/
|
|
8
17
|
export declare function splitCInclude(node: SyntaxNode): CaptureMatch | null;
|
|
@@ -3,10 +3,20 @@ import { nodeToCapture, syntheticCapture } from '../../utils/ast-helpers.js';
|
|
|
3
3
|
* Decompose a `preproc_include` node into a CaptureMatch with structured
|
|
4
4
|
* import captures. C #include maps to a wildcard import (all symbols
|
|
5
5
|
* from the header are visible).
|
|
6
|
+
*
|
|
7
|
+
* Only literal include paths are emitted as import sources:
|
|
8
|
+
* #include <stdio.h> → system_lib_string
|
|
9
|
+
* #include "local.h" → string_literal
|
|
10
|
+
* A computed include like `#include HEADER_MACRO` carries an `identifier`
|
|
11
|
+
* path node (the macro name, not a header path). Emitting it as an import
|
|
12
|
+
* source produces a garbage literal edge, so we skip it entirely — matching
|
|
13
|
+
* the convention in interpretCImport, which drops imports with no resolvable
|
|
14
|
+
* source (issue #1919 F5).
|
|
6
15
|
*/
|
|
7
16
|
export function splitCInclude(node) {
|
|
8
17
|
// node.type === 'preproc_include'
|
|
9
18
|
// path field: (string_literal (string_content)) | (system_lib_string)
|
|
19
|
+
// | (identifier) ← computed macro include, NOT a header path
|
|
10
20
|
const pathNode = node.childForFieldName?.('path') ?? null;
|
|
11
21
|
if (pathNode === null) {
|
|
12
22
|
// Fallback: scan children
|
|
@@ -23,6 +33,11 @@ export function splitCInclude(node) {
|
|
|
23
33
|
return buildIncludeCapture(node, pathNode);
|
|
24
34
|
}
|
|
25
35
|
function buildIncludeCapture(node, pathNode) {
|
|
36
|
+
// Skip computed includes (`#include MACRO`) — the path is an `identifier`,
|
|
37
|
+
// not a literal header path. Emitting it would create a garbage import.
|
|
38
|
+
if (pathNode.type !== 'string_literal' && pathNode.type !== 'system_lib_string') {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
26
41
|
let raw;
|
|
27
42
|
if (pathNode.type === 'string_literal') {
|
|
28
43
|
// string_literal has children: `"`, string_content, `"`
|
|
@@ -1,4 +1,39 @@
|
|
|
1
1
|
import { dirname, join } from 'path';
|
|
2
|
+
/**
|
|
3
|
+
* Per-pass memo: workspace paths bucketed by basename (last path segment),
|
|
4
|
+
* keyed on the `allFilePaths` set identity.
|
|
5
|
+
*
|
|
6
|
+
* `resolveCImportTarget` is called once per (quoted) C/C++ `#include` with the
|
|
7
|
+
* same `allFilePaths` set per pass (the augmented set is itself memoized in
|
|
8
|
+
* the C resolver). The old suffix-match fallback scanned ALL workspace paths
|
|
9
|
+
* per include — with a per-element `.replace`/`.split` and no early exit
|
|
10
|
+
* (the fewest-path-components tie-break forces a full scan) — i.e.
|
|
11
|
+
* O(R_suffix × (F+H)). A path can satisfy `endsWith('/'+target)` (or equal
|
|
12
|
+
* the target) ONLY IF its basename equals the target's last segment, so we
|
|
13
|
+
* pre-bucket by basename once (O(F+H), `normalized`/`depth` precomputed) and
|
|
14
|
+
* the fallback inspects a single small bucket → O(F+H) build + ~O(1)/include.
|
|
15
|
+
* `WeakMap`-keyed so it is reclaimed with the pass (no cross-pass staleness).
|
|
16
|
+
* Shared by C and C++ (`resolveCppImportTarget` delegates here).
|
|
17
|
+
*/
|
|
18
|
+
const suffixIndexByPaths = new WeakMap();
|
|
19
|
+
function suffixIndex(allFilePaths) {
|
|
20
|
+
let index = suffixIndexByPaths.get(allFilePaths);
|
|
21
|
+
if (index === undefined) {
|
|
22
|
+
index = new Map();
|
|
23
|
+
for (const original of allFilePaths) {
|
|
24
|
+
const normalized = original.replace(/\\/g, '/');
|
|
25
|
+
const basename = normalized.slice(normalized.lastIndexOf('/') + 1);
|
|
26
|
+
let bucket = index.get(basename);
|
|
27
|
+
if (bucket === undefined) {
|
|
28
|
+
bucket = [];
|
|
29
|
+
index.set(basename, bucket);
|
|
30
|
+
}
|
|
31
|
+
bucket.push({ original, normalized, depth: normalized.split('/').length });
|
|
32
|
+
}
|
|
33
|
+
suffixIndexByPaths.set(allFilePaths, index);
|
|
34
|
+
}
|
|
35
|
+
return index;
|
|
36
|
+
}
|
|
2
37
|
/**
|
|
3
38
|
* Resolve a C #include path to a file in the workspace.
|
|
4
39
|
*
|
|
@@ -36,20 +71,28 @@ export function resolveCImportTarget(targetRaw, fromFile, allFilePaths) {
|
|
|
36
71
|
// Exact match (path as-is in the workspace)
|
|
37
72
|
if (allFilePaths.has(normalizedTarget))
|
|
38
73
|
return normalizedTarget;
|
|
39
|
-
// Suffix match: find files ending with /targetRaw or equal to targetRaw
|
|
74
|
+
// Suffix match: find files ending with /targetRaw or equal to targetRaw.
|
|
75
|
+
// A path can only match `=== normalizedTarget` or `endsWith('/'+target)` if
|
|
76
|
+
// its basename equals the target's last segment, so we inspect only that
|
|
77
|
+
// basename bucket (built once per pass) instead of scanning every workspace
|
|
78
|
+
// path. Match condition + tie-break (fewest path components, then
|
|
79
|
+
// lexicographic on the normalized path) are byte-identical to the prior scan.
|
|
40
80
|
const suffix = '/' + normalizedTarget;
|
|
81
|
+
const targetBasename = normalizedTarget.slice(normalizedTarget.lastIndexOf('/') + 1);
|
|
82
|
+
const bucket = suffixIndex(allFilePaths).get(targetBasename);
|
|
83
|
+
if (bucket === undefined)
|
|
84
|
+
return null;
|
|
41
85
|
let bestMatch = null;
|
|
42
86
|
let bestDepth = Infinity;
|
|
43
87
|
let bestNormalized = '';
|
|
44
|
-
for (const
|
|
45
|
-
|
|
46
|
-
if (normalized === normalizedTarget || normalized.endsWith(suffix)) {
|
|
88
|
+
for (const cand of bucket) {
|
|
89
|
+
if (cand.normalized === normalizedTarget || cand.normalized.endsWith(suffix)) {
|
|
47
90
|
// Prefer shortest path (closest match)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
bestDepth = depth;
|
|
51
|
-
bestMatch =
|
|
52
|
-
bestNormalized = normalized;
|
|
91
|
+
if (cand.depth < bestDepth ||
|
|
92
|
+
(cand.depth === bestDepth && cand.normalized < bestNormalized)) {
|
|
93
|
+
bestDepth = cand.depth;
|
|
94
|
+
bestMatch = cand.original;
|
|
95
|
+
bestNormalized = cand.normalized;
|
|
53
96
|
}
|
|
54
97
|
}
|
|
55
98
|
}
|
|
@@ -8,4 +8,5 @@ export { cArityCompatibility } from './arity.js';
|
|
|
8
8
|
export { cMergeBindings } from './merge-bindings.js';
|
|
9
9
|
export { cBindingScopeFor, cImportOwningScope, cReceiverBinding } from './simple-hooks.js';
|
|
10
10
|
export { resolveCImportTarget } from './import-target.js';
|
|
11
|
-
export { markStaticName, isStaticName, clearStaticNames, expandCWildcardNames, } from './static-linkage.js';
|
|
11
|
+
export { markStaticName, isStaticName, clearStaticNames, expandCWildcardNames, getStaticNamesForFile, } from './static-linkage.js';
|
|
12
|
+
export { collectCStaticLinkageSideChannel, applyCStaticLinkageSideChannel, } from './capture-side-channel.js';
|
|
@@ -8,4 +8,5 @@ export { cArityCompatibility } from './arity.js';
|
|
|
8
8
|
export { cMergeBindings } from './merge-bindings.js';
|
|
9
9
|
export { cBindingScopeFor, cImportOwningScope, cReceiverBinding } from './simple-hooks.js';
|
|
10
10
|
export { resolveCImportTarget } from './import-target.js';
|
|
11
|
-
export { markStaticName, isStaticName, clearStaticNames, expandCWildcardNames, } from './static-linkage.js';
|
|
11
|
+
export { markStaticName, isStaticName, clearStaticNames, expandCWildcardNames, getStaticNamesForFile, } from './static-linkage.js';
|
|
12
|
+
export { collectCStaticLinkageSideChannel, applyCStaticLinkageSideChannel, } from './capture-side-channel.js';
|
|
@@ -40,6 +40,12 @@ const C_SCOPE_QUERY = `
|
|
|
40
40
|
(enum_specifier
|
|
41
41
|
name: (type_identifier) @declaration.name) @declaration.enum
|
|
42
42
|
|
|
43
|
+
;; Declarations — enum (typedef enum { ... } Name)
|
|
44
|
+
(type_definition
|
|
45
|
+
type: (enum_specifier
|
|
46
|
+
body: (enumerator_list))
|
|
47
|
+
declarator: (type_identifier) @declaration.name) @declaration.enum
|
|
48
|
+
|
|
43
49
|
;; Declarations — function definition
|
|
44
50
|
(function_definition
|
|
45
51
|
declarator: (function_declarator
|
|
@@ -92,6 +98,15 @@ const C_SCOPE_QUERY = `
|
|
|
92
98
|
declarator: (init_declarator
|
|
93
99
|
declarator: (identifier) @declaration.name)) @declaration.variable
|
|
94
100
|
|
|
101
|
+
;; Declarations — variables (without initializer), including non-leading
|
|
102
|
+
;; declarators in mixed declaration lists.
|
|
103
|
+
(declaration
|
|
104
|
+
declarator: (identifier) @declaration.name) @declaration.variable
|
|
105
|
+
|
|
106
|
+
(declaration
|
|
107
|
+
declarator: (pointer_declarator
|
|
108
|
+
declarator: (identifier) @declaration.name)) @declaration.variable
|
|
109
|
+
|
|
95
110
|
;; Declarations — macro definitions
|
|
96
111
|
(preproc_def
|
|
97
112
|
name: (identifier) @declaration.name) @declaration.macro
|
|
@@ -5,6 +5,36 @@ import { cProvider } from '../c-cpp.js';
|
|
|
5
5
|
import { cArityCompatibility, cMergeBindings, resolveCImportTarget } from './index.js';
|
|
6
6
|
import { scanHeaderFiles } from './header-scan.js';
|
|
7
7
|
import { expandCWildcardNames, isStaticName, clearStaticNames } from './static-linkage.js';
|
|
8
|
+
import { applyCStaticLinkageSideChannel } from './capture-side-channel.js';
|
|
9
|
+
/**
|
|
10
|
+
* Per-pass memo of the augmented `#include`-resolution file set
|
|
11
|
+
* (`allFilePaths` ∪ header `.h` paths), keyed on the two stable source sets.
|
|
12
|
+
*
|
|
13
|
+
* `resolveImportTarget` is called once per C `#include`; the old code rebuilt
|
|
14
|
+
* a fresh ~F-entry `Set` on EVERY call (O(R × (F+H)) inserts + GC churn) and,
|
|
15
|
+
* worse, defeated `resolveCImportTarget`'s own per-set suffix-index memo by
|
|
16
|
+
* handing it a new set identity each time. Both `allFilePaths` (built once in
|
|
17
|
+
* scope-resolution `run.ts`) and the header set (`loadResolutionConfig`
|
|
18
|
+
* result) are stable per pass, so the union is built once and reused.
|
|
19
|
+
* `WeakMap`-keyed → reclaimed with the pass (no cross-pass staleness).
|
|
20
|
+
*/
|
|
21
|
+
const augmentedPathsByPass = new WeakMap();
|
|
22
|
+
function augmentedFilePaths(allFilePaths, headerPaths) {
|
|
23
|
+
let byHeaders = augmentedPathsByPass.get(allFilePaths);
|
|
24
|
+
if (byHeaders === undefined) {
|
|
25
|
+
byHeaders = new WeakMap();
|
|
26
|
+
augmentedPathsByPass.set(allFilePaths, byHeaders);
|
|
27
|
+
}
|
|
28
|
+
let augmented = byHeaders.get(headerPaths);
|
|
29
|
+
if (augmented === undefined) {
|
|
30
|
+
const set = new Set(allFilePaths);
|
|
31
|
+
for (const h of headerPaths)
|
|
32
|
+
set.add(h);
|
|
33
|
+
augmented = set;
|
|
34
|
+
byHeaders.set(headerPaths, augmented);
|
|
35
|
+
}
|
|
36
|
+
return augmented;
|
|
37
|
+
}
|
|
8
38
|
/**
|
|
9
39
|
* C `ScopeResolver` registered in `SCOPE_RESOLVERS` and consumed by
|
|
10
40
|
* the generic `runScopeResolution` orchestrator (RFC #909 Ring 3).
|
|
@@ -26,16 +56,29 @@ export const cScopeResolver = {
|
|
|
26
56
|
clearStaticNames();
|
|
27
57
|
return scanHeaderFiles(repoPath);
|
|
28
58
|
},
|
|
59
|
+
// Worker-boundary restore (see `ScopeResolver.applyCaptureSideChannel`).
|
|
60
|
+
// `emitCScopeCaptures` records per-file `static`-linkage names
|
|
61
|
+
// (`markStaticName` → `staticNames`) as a SIDE EFFECT — that state is NOT
|
|
62
|
+
// serialized onto the returned ParsedFile's scopes/defs. On the worker path
|
|
63
|
+
// those marks are populated in the worker process and lost across the
|
|
64
|
+
// MessageChannel / disk store; the main thread reuses the serialized
|
|
65
|
+
// ParsedFile and skips `extractParsedFile`, so `isStaticName` (read by
|
|
66
|
+
// `isFileLocalDef` and `expandCWildcardNames`) sees an empty map and C
|
|
67
|
+
// `static` functions leak into cross-file global free-call resolution
|
|
68
|
+
// (false CALLS edges) and `#include` wildcard imports. The worker stashed a
|
|
69
|
+
// plain-data snapshot on `parsed.captureSideChannel` via
|
|
70
|
+
// `cProvider.collectCaptureSideChannel`; this restores it into the module
|
|
71
|
+
// map WITHOUT any tree-sitter re-parse (the #1983 fix). The
|
|
72
|
+
// freshly-extracted leg never calls this — its marks were just populated in
|
|
73
|
+
// this process. Runs BEFORE `populateOwners`.
|
|
74
|
+
applyCaptureSideChannel: applyCStaticLinkageSideChannel,
|
|
29
75
|
resolveImportTarget: (targetRaw, fromFile, allFilePaths, resolutionConfig) => {
|
|
30
76
|
// Augment allFilePaths with .h files discovered via loadResolutionConfig
|
|
31
77
|
// since the phase only passes .c files to the C resolver but #include
|
|
32
78
|
// targets .h files classified as C++ in language detection.
|
|
33
79
|
const headerPaths = resolutionConfig;
|
|
34
80
|
if (headerPaths !== undefined && headerPaths.size > 0) {
|
|
35
|
-
|
|
36
|
-
for (const h of headerPaths)
|
|
37
|
-
augmented.add(h);
|
|
38
|
-
return resolveCImportTarget(targetRaw, fromFile, augmented);
|
|
81
|
+
return resolveCImportTarget(targetRaw, fromFile, augmentedFilePaths(allFilePaths, headerPaths));
|
|
39
82
|
}
|
|
40
83
|
return resolveCImportTarget(targetRaw, fromFile, allFilePaths);
|
|
41
84
|
},
|
|
@@ -3,6 +3,14 @@ import type { ParsedFile, ScopeId } from '../../../../_shared/index.js';
|
|
|
3
3
|
export declare function markStaticName(filePath: string, name: string): void;
|
|
4
4
|
/** Check whether a symbol name has `static` linkage in the given file. */
|
|
5
5
|
export declare function isStaticName(filePath: string, name: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Return the `static` (file-local) names recorded for the given file as a
|
|
8
|
+
* plain array (empty when none). Used to snapshot the per-file slice of the
|
|
9
|
+
* module-level `staticNames` map into `ParsedFile.captureSideChannel` so it
|
|
10
|
+
* survives the worker→main boundary (#1983 — the worker is the sole parse
|
|
11
|
+
* path). See `c/capture-side-channel.ts`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getStaticNamesForFile(filePath: string): string[];
|
|
6
14
|
/** Clear tracked static names (for testing). */
|
|
7
15
|
export declare function clearStaticNames(): void;
|
|
8
16
|
/**
|
|
@@ -24,17 +24,62 @@ export function markStaticName(filePath, name) {
|
|
|
24
24
|
export function isStaticName(filePath, name) {
|
|
25
25
|
return staticNames.get(filePath)?.has(name) ?? false;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Return the `static` (file-local) names recorded for the given file as a
|
|
29
|
+
* plain array (empty when none). Used to snapshot the per-file slice of the
|
|
30
|
+
* module-level `staticNames` map into `ParsedFile.captureSideChannel` so it
|
|
31
|
+
* survives the worker→main boundary (#1983 — the worker is the sole parse
|
|
32
|
+
* path). See `c/capture-side-channel.ts`.
|
|
33
|
+
*/
|
|
34
|
+
export function getStaticNamesForFile(filePath) {
|
|
35
|
+
const names = staticNames.get(filePath);
|
|
36
|
+
return names === undefined ? [] : [...names];
|
|
37
|
+
}
|
|
27
38
|
/** Clear tracked static names (for testing). */
|
|
28
39
|
export function clearStaticNames() {
|
|
29
40
|
staticNames.clear();
|
|
30
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Per-pass memo: `moduleScope` → owning `ParsedFile`, keyed on the
|
|
44
|
+
* `parsedFiles` array identity.
|
|
45
|
+
*
|
|
46
|
+
* The shared finalize Phase-4 loop calls `expandsWildcardTo`
|
|
47
|
+
* (→ `expandCWildcardNames`) ONCE PER RESOLVED `#include` edge, every time
|
|
48
|
+
* with the SAME `parsedFiles` reference (wired at scope-resolution
|
|
49
|
+
* `run.ts` — `allFilePaths`/`parsedFiles` are built once per pass). The old
|
|
50
|
+
* `parsedFiles.find(...)` therefore did a full O(F) scan per edge →
|
|
51
|
+
* O(R_include × F) overall; at Linux-kernel scale (F ≈ 63k C files, tens of
|
|
52
|
+
* thousands of resolved includes) that is ~10^10+ comparisons on a single
|
|
53
|
+
* thread — the dominant term in the scope-resolution finalize grind.
|
|
54
|
+
*
|
|
55
|
+
* Building the lookup once collapses it to O(R_include + F). `WeakMap`-keyed
|
|
56
|
+
* on the array so the index is reclaimed with the pass — no cross-pass
|
|
57
|
+
* staleness (mirrors the {@link clearStaticNames} discipline for server-mode
|
|
58
|
+
* / multi-repo reuse), and a fresh array transparently rebuilds.
|
|
59
|
+
*/
|
|
60
|
+
const moduleScopeIndexByPass = new WeakMap();
|
|
61
|
+
function moduleScopeIndex(parsedFiles) {
|
|
62
|
+
let index = moduleScopeIndexByPass.get(parsedFiles);
|
|
63
|
+
if (index === undefined) {
|
|
64
|
+
index = new Map();
|
|
65
|
+
// First-wins to preserve `Array.find` semantics (returns the first match).
|
|
66
|
+
// `moduleScope` is unique per file in practice, so collisions are absent;
|
|
67
|
+
// the guard only formalises identical behaviour to the prior `.find`.
|
|
68
|
+
for (const p of parsedFiles) {
|
|
69
|
+
if (!index.has(p.moduleScope))
|
|
70
|
+
index.set(p.moduleScope, p);
|
|
71
|
+
}
|
|
72
|
+
moduleScopeIndexByPass.set(parsedFiles, index);
|
|
73
|
+
}
|
|
74
|
+
return index;
|
|
75
|
+
}
|
|
31
76
|
/**
|
|
32
77
|
* Return the names visible through a C wildcard import (`#include`).
|
|
33
78
|
* All module-scope defs from the target file are visible EXCEPT those
|
|
34
79
|
* declared with `static` storage class (file-local linkage in C).
|
|
35
80
|
*/
|
|
36
81
|
export function expandCWildcardNames(targetModuleScope, parsedFiles) {
|
|
37
|
-
const target = parsedFiles.
|
|
82
|
+
const target = moduleScopeIndex(parsedFiles).get(targetModuleScope);
|
|
38
83
|
if (target === undefined)
|
|
39
84
|
return [];
|
|
40
85
|
const seen = new Set();
|
|
@@ -35,10 +35,9 @@ import { createVariableExtractor } from '../variable-extractors/generic.js';
|
|
|
35
35
|
import { cVariableConfig, cppVariableConfig } from '../variable-extractors/configs/c-cpp.js';
|
|
36
36
|
import { createCallExtractor } from '../call-extractors/generic.js';
|
|
37
37
|
import { cCallConfig, cppCallConfig } from '../call-extractors/configs/c-cpp.js';
|
|
38
|
-
import { createHeritageExtractor } from '../heritage-extractors/generic.js';
|
|
39
38
|
import { stripUeMacros } from '../cpp-ue-preprocessor.js';
|
|
40
|
-
import { emitCScopeCaptures, interpretCImport, interpretCTypeBinding, cArityCompatibility, cBindingScopeFor, cImportOwningScope, cReceiverBinding, } from './c/index.js';
|
|
41
|
-
import { emitCppScopeCaptures, interpretCppImport, interpretCppTypeBinding, cppArityCompatibility, cppBindingScopeFor, cppImportOwningScope, cppReceiverBinding, } from './cpp/index.js';
|
|
39
|
+
import { emitCScopeCaptures, interpretCImport, interpretCTypeBinding, cArityCompatibility, cBindingScopeFor, cImportOwningScope, cReceiverBinding, collectCStaticLinkageSideChannel, } from './c/index.js';
|
|
40
|
+
import { emitCppScopeCaptures, interpretCppImport, interpretCppTypeBinding, cppArityCompatibility, cppBindingScopeFor, cppImportOwningScope, cppReceiverBinding, collectCppCaptureSideChannel, } from './cpp/index.js';
|
|
42
41
|
import { extractCppTemplateConstraints } from './cpp/constraint-extractor.js';
|
|
43
42
|
const C_BUILT_INS = new Set([
|
|
44
43
|
'printf',
|
|
@@ -339,7 +338,6 @@ export const cProvider = defineLanguage({
|
|
|
339
338
|
typeConfig: cCppConfig,
|
|
340
339
|
exportChecker: cCppExportChecker,
|
|
341
340
|
importResolver: createImportResolver(cImportConfig),
|
|
342
|
-
importSemantics: 'wildcard-transitive',
|
|
343
341
|
callExtractor: createCallExtractor(cCallConfig),
|
|
344
342
|
fieldExtractor: createFieldExtractor(cFieldConfig),
|
|
345
343
|
methodExtractor: createMethodExtractor({
|
|
@@ -348,11 +346,19 @@ export const cProvider = defineLanguage({
|
|
|
348
346
|
}),
|
|
349
347
|
variableExtractor: createVariableExtractor(cVariableConfig),
|
|
350
348
|
classExtractor: cClassExtractor,
|
|
351
|
-
heritageExtractor: createHeritageExtractor(SupportedLanguages.C),
|
|
352
349
|
labelOverride: cppLabelOverride,
|
|
353
350
|
builtInNames: C_BUILT_INS,
|
|
354
351
|
// ── RFC #909 Ring 3: scope-based resolution hooks (RFC §5) ──────────
|
|
355
352
|
emitScopeCaptures: emitCScopeCaptures,
|
|
353
|
+
// Worker-side: snapshot the module-level `static`-linkage marks
|
|
354
|
+
// `emitCScopeCaptures` just populated for this file (`markStaticName` →
|
|
355
|
+
// `staticNames`) into plain data on `ParsedFile.captureSideChannel`, so the
|
|
356
|
+
// main thread can restore them via `applyCaptureSideChannel` WITHOUT a
|
|
357
|
+
// re-parse (#1983 — the worker is the sole parse path). Without this, C
|
|
358
|
+
// `static` functions look non-file-local on the main thread and leak into
|
|
359
|
+
// cross-file global free-call resolution / wildcard imports. See
|
|
360
|
+
// `c/capture-side-channel.ts`.
|
|
361
|
+
collectCaptureSideChannel: collectCStaticLinkageSideChannel,
|
|
356
362
|
interpretImport: interpretCImport,
|
|
357
363
|
interpretTypeBinding: interpretCTypeBinding,
|
|
358
364
|
bindingScopeFor: cBindingScopeFor,
|
|
@@ -407,7 +413,6 @@ export const cppProvider = defineLanguage({
|
|
|
407
413
|
typeConfig: cCppConfig,
|
|
408
414
|
exportChecker: cCppExportChecker,
|
|
409
415
|
importResolver: createImportResolver(cppImportConfig),
|
|
410
|
-
importSemantics: 'wildcard-transitive',
|
|
411
416
|
mroStrategy: 'leftmost-base',
|
|
412
417
|
callExtractor: createCallExtractor(cppCallConfig),
|
|
413
418
|
fieldExtractor: createFieldExtractor(cppFieldConfig),
|
|
@@ -417,12 +422,16 @@ export const cppProvider = defineLanguage({
|
|
|
417
422
|
}),
|
|
418
423
|
variableExtractor: createVariableExtractor(cppVariableConfig),
|
|
419
424
|
classExtractor: cppClassExtractor,
|
|
420
|
-
heritageExtractor: createHeritageExtractor(SupportedLanguages.CPlusPlus),
|
|
421
425
|
labelOverride: cppLabelOverride,
|
|
422
426
|
builtInNames: C_BUILT_INS,
|
|
423
427
|
extractTemplateConstraints: extractCppTemplateConstraintsForProvider,
|
|
424
428
|
// ── RFC #909 Ring 3: scope-based resolution hooks (RFC §5) ──────────
|
|
425
429
|
emitScopeCaptures: emitCppScopeCaptures,
|
|
430
|
+
// Worker-side: snapshot the module-level capture marks `emitCppScopeCaptures`
|
|
431
|
+
// just populated for this file into plain data on `ParsedFile.captureSideChannel`,
|
|
432
|
+
// so the main thread can restore them via `applyCaptureSideChannel` WITHOUT a
|
|
433
|
+
// re-parse (#1983). See `cpp/capture-side-channel.ts`.
|
|
434
|
+
collectCaptureSideChannel: collectCppCaptureSideChannel,
|
|
426
435
|
interpretImport: interpretCppImport,
|
|
427
436
|
interpretTypeBinding: interpretCppTypeBinding,
|
|
428
437
|
bindingScopeFor: cppBindingScopeFor,
|