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,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dart scope-resolution hooks (RFC #909 Ring 3, issue #939).
|
|
3
|
+
*
|
|
4
|
+
* Public API barrel. Consumers import from this file rather than the
|
|
5
|
+
* individual modules.
|
|
6
|
+
*
|
|
7
|
+
* Module layout (each file is a single concern):
|
|
8
|
+
*
|
|
9
|
+
* - `query.ts` — tree-sitter scope query + lazy parser/query
|
|
10
|
+
* - `captures.ts` — `emitDartScopeCaptures` orchestrator
|
|
11
|
+
* - `interpret.ts` — capture-match → `ParsedImport` / `ParsedTypeBinding`
|
|
12
|
+
* - `import-target.ts` — `(targetRaw, fromFile, allFilePaths) → file path`
|
|
13
|
+
* - `receiver-binding.ts` — synthesize `this` / `super` type-bindings
|
|
14
|
+
* - `signature-bindings.ts`— synthesize parameter / return type-bindings
|
|
15
|
+
* - `arity.ts` — Dart arity compatibility (count-primary)
|
|
16
|
+
* - `arity-metadata.ts` — synthesize arity metadata from declarations
|
|
17
|
+
* - `merge-bindings.ts` — Dart import-vs-local precedence
|
|
18
|
+
* - `simple-hooks.ts` — `bindingScopeFor` / `importOwningScope` / `receiverBinding`
|
|
19
|
+
* - `scope-resolver.ts` — `ScopeResolver` registered in `SCOPE_RESOLVERS`
|
|
20
|
+
* - `cache-stats.ts` — PROF_SCOPE_RESOLUTION cache hit/miss counters
|
|
21
|
+
*/
|
|
22
|
+
export { emitDartScopeCaptures } from './captures.js';
|
|
23
|
+
export { getDartCaptureCacheStats, resetDartCaptureCacheStats } from './cache-stats.js';
|
|
24
|
+
export { interpretDartImport, interpretDartTypeBinding, normalizeDartType, DART_HERITAGE_PREFIX, } from './interpret.js';
|
|
25
|
+
export { dartMergeBindings } from './merge-bindings.js';
|
|
26
|
+
export { dartArityCompatibility } from './arity.js';
|
|
27
|
+
export { resolveDartImportTarget } from './import-target.js';
|
|
28
|
+
export { dartBindingScopeFor, dartImportOwningScope, dartReceiverBinding } from './simple-hooks.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dart scope-resolution hooks (RFC #909 Ring 3, issue #939).
|
|
3
|
+
*
|
|
4
|
+
* Public API barrel. Consumers import from this file rather than the
|
|
5
|
+
* individual modules.
|
|
6
|
+
*
|
|
7
|
+
* Module layout (each file is a single concern):
|
|
8
|
+
*
|
|
9
|
+
* - `query.ts` — tree-sitter scope query + lazy parser/query
|
|
10
|
+
* - `captures.ts` — `emitDartScopeCaptures` orchestrator
|
|
11
|
+
* - `interpret.ts` — capture-match → `ParsedImport` / `ParsedTypeBinding`
|
|
12
|
+
* - `import-target.ts` — `(targetRaw, fromFile, allFilePaths) → file path`
|
|
13
|
+
* - `receiver-binding.ts` — synthesize `this` / `super` type-bindings
|
|
14
|
+
* - `signature-bindings.ts`— synthesize parameter / return type-bindings
|
|
15
|
+
* - `arity.ts` — Dart arity compatibility (count-primary)
|
|
16
|
+
* - `arity-metadata.ts` — synthesize arity metadata from declarations
|
|
17
|
+
* - `merge-bindings.ts` — Dart import-vs-local precedence
|
|
18
|
+
* - `simple-hooks.ts` — `bindingScopeFor` / `importOwningScope` / `receiverBinding`
|
|
19
|
+
* - `scope-resolver.ts` — `ScopeResolver` registered in `SCOPE_RESOLVERS`
|
|
20
|
+
* - `cache-stats.ts` — PROF_SCOPE_RESOLUTION cache hit/miss counters
|
|
21
|
+
*/
|
|
22
|
+
export { emitDartScopeCaptures } from './captures.js';
|
|
23
|
+
export { getDartCaptureCacheStats, resetDartCaptureCacheStats } from './cache-stats.js';
|
|
24
|
+
export { interpretDartImport, interpretDartTypeBinding, normalizeDartType, DART_HERITAGE_PREFIX, } from './interpret.js';
|
|
25
|
+
export { dartMergeBindings } from './merge-bindings.js';
|
|
26
|
+
export { dartArityCompatibility } from './arity.js';
|
|
27
|
+
export { resolveDartImportTarget } from './import-target.js';
|
|
28
|
+
export { dartBindingScopeFor, dartImportOwningScope, dartReceiverBinding } from './simple-hooks.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dart `CaptureMatch` → semantic-shape interpreters.
|
|
3
|
+
*
|
|
4
|
+
* - `interpretDartImport` — `@import.source` → a whole-library
|
|
5
|
+
* `ParsedImport` (Dart `import`/`export` bring every public top-level
|
|
6
|
+
* symbol of the target into scope — whole-library / wildcard-leaf semantics).
|
|
7
|
+
* `@import.heritage` markers (synthesized by `captures.ts` for
|
|
8
|
+
* `implements`/`with` clauses) become side-effect imports carrying a
|
|
9
|
+
* `__heritage__:` payload that `emitDartHeritageEdges` consumes; they
|
|
10
|
+
* never produce a real IMPORTS edge (`resolveDartImportTarget` returns
|
|
11
|
+
* `null` for them).
|
|
12
|
+
* - `interpretDartTypeBinding` — `@type-binding.*` → a `ParsedTypeBinding`,
|
|
13
|
+
* normalizing the Dart type (strip nullable `?`, unwrap single-arg
|
|
14
|
+
* container generics like `Future<X>`/`List<X>`, drop library prefixes).
|
|
15
|
+
*/
|
|
16
|
+
import type { CaptureMatch, ParsedImport, ParsedTypeBinding } from '../../../../_shared/index.js';
|
|
17
|
+
/** Marker prefix carried on a side-effect `ParsedImport.targetRaw` for
|
|
18
|
+
* `implements`/`with` heritage, consumed by `emitDartHeritageEdges`. Aliased to
|
|
19
|
+
* the shared codec prefix (#1994) so the Dart wire prefix has a single source of
|
|
20
|
+
* truth and cannot desync from `encodeMarker`/`decodeMarker`. */
|
|
21
|
+
export declare const DART_HERITAGE_PREFIX: string;
|
|
22
|
+
export declare function interpretDartImport(captures: CaptureMatch): ParsedImport | null;
|
|
23
|
+
export declare function normalizeDartType(text: string): string;
|
|
24
|
+
export declare function interpretDartTypeBinding(captures: CaptureMatch): ParsedTypeBinding | null;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dart `CaptureMatch` → semantic-shape interpreters.
|
|
3
|
+
*
|
|
4
|
+
* - `interpretDartImport` — `@import.source` → a whole-library
|
|
5
|
+
* `ParsedImport` (Dart `import`/`export` bring every public top-level
|
|
6
|
+
* symbol of the target into scope — whole-library / wildcard-leaf semantics).
|
|
7
|
+
* `@import.heritage` markers (synthesized by `captures.ts` for
|
|
8
|
+
* `implements`/`with` clauses) become side-effect imports carrying a
|
|
9
|
+
* `__heritage__:` payload that `emitDartHeritageEdges` consumes; they
|
|
10
|
+
* never produce a real IMPORTS edge (`resolveDartImportTarget` returns
|
|
11
|
+
* `null` for them).
|
|
12
|
+
* - `interpretDartTypeBinding` — `@type-binding.*` → a `ParsedTypeBinding`,
|
|
13
|
+
* normalizing the Dart type (strip nullable `?`, unwrap single-arg
|
|
14
|
+
* container generics like `Future<X>`/`List<X>`, drop library prefixes).
|
|
15
|
+
*/
|
|
16
|
+
import { HERITAGE_MARKER_PREFIX } from '../../utils/heritage-marker.js';
|
|
17
|
+
/** Marker prefix carried on a side-effect `ParsedImport.targetRaw` for
|
|
18
|
+
* `implements`/`with` heritage, consumed by `emitDartHeritageEdges`. Aliased to
|
|
19
|
+
* the shared codec prefix (#1994) so the Dart wire prefix has a single source of
|
|
20
|
+
* truth and cannot desync from `encodeMarker`/`decodeMarker`. */
|
|
21
|
+
export const DART_HERITAGE_PREFIX = HERITAGE_MARKER_PREFIX;
|
|
22
|
+
function stripQuotes(s) {
|
|
23
|
+
return s.replace(/^['"]|['"]$/g, '');
|
|
24
|
+
}
|
|
25
|
+
export function interpretDartImport(captures) {
|
|
26
|
+
const heritageCap = captures['@import.heritage'];
|
|
27
|
+
if (heritageCap !== undefined) {
|
|
28
|
+
return { kind: 'side-effect', targetRaw: heritageCap.text };
|
|
29
|
+
}
|
|
30
|
+
const sourceCap = captures['@import.source'];
|
|
31
|
+
if (sourceCap === undefined)
|
|
32
|
+
return null;
|
|
33
|
+
const raw = stripQuotes(sourceCap.text);
|
|
34
|
+
// Dart `import '...'` brings every PUBLIC top-level symbol of the target
|
|
35
|
+
// library directly into scope (no prefix) — wildcard semantics. The
|
|
36
|
+
// `expandsWildcardTo` hook enumerates those names so cross-file return
|
|
37
|
+
// types propagate (`var u = importedFn(); u.m()`).
|
|
38
|
+
return { kind: 'wildcard', targetRaw: raw };
|
|
39
|
+
}
|
|
40
|
+
/** Container generics whose single type argument is the runtime element
|
|
41
|
+
* type a receiver resolves against (`Future<User>` → `User`). */
|
|
42
|
+
const SINGLE_ARG_CONTAINERS = /^(?:Future|FutureOr|List|Iterable|Set|Stream|Optional)<(.+)>$/;
|
|
43
|
+
/** Bare container names. When a type normalizes to one of these (e.g. the
|
|
44
|
+
* generic args were stripped upstream so `Future<User>` arrived as `Future`),
|
|
45
|
+
* binding to it would let a same-named user class capture the receiver — a
|
|
46
|
+
* wrong edge. We suppress the binding instead (leaving the call unresolved,
|
|
47
|
+
* matching the legacy DAG) rather than bind to the container name. */
|
|
48
|
+
const BARE_CONTAINER_TYPES = new Set([
|
|
49
|
+
'Future',
|
|
50
|
+
'FutureOr',
|
|
51
|
+
'List',
|
|
52
|
+
'Iterable',
|
|
53
|
+
'Set',
|
|
54
|
+
'Stream',
|
|
55
|
+
'Optional',
|
|
56
|
+
]);
|
|
57
|
+
export function normalizeDartType(text) {
|
|
58
|
+
let s = text.trim();
|
|
59
|
+
// Strip nullable suffix (`User?` → `User`).
|
|
60
|
+
s = s.replace(/\?+$/, '');
|
|
61
|
+
// Unwrap a single-arg container generic once (`Future<User>` → `User`).
|
|
62
|
+
const gen = SINGLE_ARG_CONTAINERS.exec(s);
|
|
63
|
+
if (gen !== null && gen[1] !== undefined)
|
|
64
|
+
s = gen[1].trim().replace(/\?+$/, '');
|
|
65
|
+
// Drop a library/namespace prefix (`prefix.User` → `User`).
|
|
66
|
+
const dot = s.lastIndexOf('.');
|
|
67
|
+
if (dot !== -1)
|
|
68
|
+
s = s.slice(dot + 1);
|
|
69
|
+
return s;
|
|
70
|
+
}
|
|
71
|
+
export function interpretDartTypeBinding(captures) {
|
|
72
|
+
const nameCap = captures['@type-binding.name'];
|
|
73
|
+
const typeCap = captures['@type-binding.type'];
|
|
74
|
+
if (nameCap === undefined || typeCap === undefined)
|
|
75
|
+
return null;
|
|
76
|
+
const rawType = normalizeDartType(typeCap.text);
|
|
77
|
+
if (rawType === '' ||
|
|
78
|
+
rawType === 'void' ||
|
|
79
|
+
rawType === 'dynamic' ||
|
|
80
|
+
BARE_CONTAINER_TYPES.has(rawType)) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
let source = 'annotation';
|
|
84
|
+
if (captures['@type-binding.self'] !== undefined)
|
|
85
|
+
source = 'self';
|
|
86
|
+
else if (captures['@type-binding.constructor'] !== undefined)
|
|
87
|
+
source = 'constructor-inferred';
|
|
88
|
+
else if (captures['@type-binding.parameter'] !== undefined)
|
|
89
|
+
source = 'parameter-annotation';
|
|
90
|
+
else if (captures['@type-binding.return'] !== undefined)
|
|
91
|
+
source = 'return-annotation';
|
|
92
|
+
else if (captures['@type-binding.annotation'] !== undefined)
|
|
93
|
+
source = 'annotation';
|
|
94
|
+
return { boundName: nameCap.text, rawTypeName: rawType, source };
|
|
95
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shadowing precedence for the Dart `mergeBindings` hook. Three tiers:
|
|
3
|
+
* 0 local, 1 import/namespace/reexport, 2 wildcard. Keeps only the best
|
|
4
|
+
* (lowest) tier present, then de-dups survivors by `def.nodeId`
|
|
5
|
+
* (last-write-wins). Mirror of `languages/swift/merge-bindings.ts` — Dart
|
|
6
|
+
* imports bring a whole library namespace into scope (wildcard-leaf), so
|
|
7
|
+
* local declarations always shadow imported names.
|
|
8
|
+
*/
|
|
9
|
+
import type { BindingRef } from '../../../../_shared/index.js';
|
|
10
|
+
export declare function dartMergeBindings(bindings: readonly BindingRef[]): readonly BindingRef[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shadowing precedence for the Dart `mergeBindings` hook. Three tiers:
|
|
3
|
+
* 0 local, 1 import/namespace/reexport, 2 wildcard. Keeps only the best
|
|
4
|
+
* (lowest) tier present, then de-dups survivors by `def.nodeId`
|
|
5
|
+
* (last-write-wins). Mirror of `languages/swift/merge-bindings.ts` — Dart
|
|
6
|
+
* imports bring a whole library namespace into scope (wildcard-leaf), so
|
|
7
|
+
* local declarations always shadow imported names.
|
|
8
|
+
*/
|
|
9
|
+
// Named tiers (lower = stronger), matching `languages/swift/merge-bindings.ts`.
|
|
10
|
+
const TIER_LOCAL = 0;
|
|
11
|
+
const TIER_IMPORT = 1;
|
|
12
|
+
const TIER_WILDCARD = 2;
|
|
13
|
+
const TIER_UNKNOWN = 3;
|
|
14
|
+
function tierOf(b) {
|
|
15
|
+
switch (b.origin) {
|
|
16
|
+
case 'local':
|
|
17
|
+
return TIER_LOCAL;
|
|
18
|
+
case 'import':
|
|
19
|
+
case 'namespace':
|
|
20
|
+
case 'reexport':
|
|
21
|
+
return TIER_IMPORT;
|
|
22
|
+
case 'wildcard':
|
|
23
|
+
return TIER_WILDCARD;
|
|
24
|
+
default:
|
|
25
|
+
return TIER_UNKNOWN;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function dartMergeBindings(bindings) {
|
|
29
|
+
if (bindings.length === 0)
|
|
30
|
+
return bindings;
|
|
31
|
+
let bestTier = Number.POSITIVE_INFINITY;
|
|
32
|
+
for (const b of bindings)
|
|
33
|
+
bestTier = Math.min(bestTier, tierOf(b));
|
|
34
|
+
const survivors = bindings.filter((b) => tierOf(b) === bestTier);
|
|
35
|
+
const seen = new Map();
|
|
36
|
+
for (const b of survivors)
|
|
37
|
+
seen.set(b.def.nodeId, b);
|
|
38
|
+
return [...seen.values()];
|
|
39
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Dart scope-capture tree-sitter query (`DART_SCOPE_QUERY`) plus lazy
|
|
3
|
+
* `Parser`/`Query` singletons. Mirror of `languages/swift/query.ts`.
|
|
4
|
+
*
|
|
5
|
+
* Verified against tree-sitter-dart 1.0.0 (UserNobody14, commit 80e23c07,
|
|
6
|
+
* ABI 14) — every node type below also appears in the legacy `DART_QUERIES`,
|
|
7
|
+
* which is validated against the same grammar.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This query intentionally covers ONLY the constructs that map cleanly
|
|
10
|
+
* to a single node + the suffix-driven scope-extractor vocabulary:
|
|
11
|
+
* - `@scope.module` / `@scope.class` (type bodies)
|
|
12
|
+
* - `@declaration.{class,trait,enum,function,method,constructor,property}`
|
|
13
|
+
* - `@import.source`
|
|
14
|
+
*
|
|
15
|
+
* The hard parts are synthesized in `captures.ts` instead of queried, because
|
|
16
|
+
* Dart's grammar can't express them as a single node:
|
|
17
|
+
* - Function/method SCOPES — `function_signature` and `function_body` are
|
|
18
|
+
* SIBLINGS, so the Function scope must span both (range composition).
|
|
19
|
+
* - Calls / member reads — Dart's postfix `identifier (selector …)` chains
|
|
20
|
+
* have no `call_expression` node; the receiver is a sibling run.
|
|
21
|
+
* - Heritage references (`extends`/`implements`/`with`).
|
|
22
|
+
* - Parameter / return / receiver type bindings and arity metadata.
|
|
23
|
+
*/
|
|
24
|
+
import Parser from 'tree-sitter';
|
|
25
|
+
export declare function getDartParser(): Parser;
|
|
26
|
+
export declare function getDartScopeQuery(): Parser.Query;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Dart scope-capture tree-sitter query (`DART_SCOPE_QUERY`) plus lazy
|
|
3
|
+
* `Parser`/`Query` singletons. Mirror of `languages/swift/query.ts`.
|
|
4
|
+
*
|
|
5
|
+
* Verified against tree-sitter-dart 1.0.0 (UserNobody14, commit 80e23c07,
|
|
6
|
+
* ABI 14) — every node type below also appears in the legacy `DART_QUERIES`,
|
|
7
|
+
* which is validated against the same grammar.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This query intentionally covers ONLY the constructs that map cleanly
|
|
10
|
+
* to a single node + the suffix-driven scope-extractor vocabulary:
|
|
11
|
+
* - `@scope.module` / `@scope.class` (type bodies)
|
|
12
|
+
* - `@declaration.{class,trait,enum,function,method,constructor,property}`
|
|
13
|
+
* - `@import.source`
|
|
14
|
+
*
|
|
15
|
+
* The hard parts are synthesized in `captures.ts` instead of queried, because
|
|
16
|
+
* Dart's grammar can't express them as a single node:
|
|
17
|
+
* - Function/method SCOPES — `function_signature` and `function_body` are
|
|
18
|
+
* SIBLINGS, so the Function scope must span both (range composition).
|
|
19
|
+
* - Calls / member reads — Dart's postfix `identifier (selector …)` chains
|
|
20
|
+
* have no `call_expression` node; the receiver is a sibling run.
|
|
21
|
+
* - Heritage references (`extends`/`implements`/`with`).
|
|
22
|
+
* - Parameter / return / receiver type bindings and arity metadata.
|
|
23
|
+
*/
|
|
24
|
+
import Parser from 'tree-sitter';
|
|
25
|
+
import Dart from 'tree-sitter-dart';
|
|
26
|
+
const DART_SCOPE_QUERY = `
|
|
27
|
+
; ── Scopes ───────────────────────────────────────────────────────────────────
|
|
28
|
+
(program) @scope.module
|
|
29
|
+
(class_definition) @scope.class
|
|
30
|
+
(mixin_declaration) @scope.class
|
|
31
|
+
(extension_declaration) @scope.class
|
|
32
|
+
(enum_declaration) @scope.class
|
|
33
|
+
|
|
34
|
+
; ── Declarations — types ─────────────────────────────────────────────────────
|
|
35
|
+
(class_definition name: (identifier) @declaration.name) @declaration.class
|
|
36
|
+
(mixin_declaration (identifier) @declaration.name) @declaration.trait
|
|
37
|
+
(extension_declaration name: (identifier) @declaration.name) @declaration.class
|
|
38
|
+
(enum_declaration name: (identifier) @declaration.name) @declaration.enum
|
|
39
|
+
|
|
40
|
+
; ── Declarations — type aliases (old-style + new-style function typedefs) ────
|
|
41
|
+
; Both forms parse as type_alias; the name position differs, and a generic
|
|
42
|
+
; <T> parameter list intervenes for the generic variants. Per #1919 review CF2,
|
|
43
|
+
; a generic type_parameters node sits between the name and the next anchor, so
|
|
44
|
+
; the non-generic adjacency patterns silently drop the generic forms. Four
|
|
45
|
+
; standalone patterns (NOT one alternation — the tree-sitter 0.21 hazard drops
|
|
46
|
+
; sibling branches) keep the name capture unambiguous and single-match per form:
|
|
47
|
+
; non-generic old-style typedef int Cmp(int a, int b);
|
|
48
|
+
; children: return-type, NAME, formal_parameter_list
|
|
49
|
+
; generic old-style typedef int Cmp<T>(T a, T b); (CF2)
|
|
50
|
+
; children: return-type, NAME, type_parameters, formal_parameter_list
|
|
51
|
+
; non-generic new-style typedef Pred = bool Function(int);
|
|
52
|
+
; children: NAME, "=", function_type
|
|
53
|
+
; generic new-style typedef Mapper<T> = T Function(T);
|
|
54
|
+
; children: NAME, type_parameters, "=", function_type
|
|
55
|
+
; The alias name is the type_identifier immediately before the param list (old)
|
|
56
|
+
; or before "=" (new); for the generic forms it is the one immediately before
|
|
57
|
+
; the intervening type_parameters. Mirrors Kotlin's @declaration.type_alias
|
|
58
|
+
; rule; the generic scope-extractor maps "type_alias" → TypeAlias.
|
|
59
|
+
(type_alias
|
|
60
|
+
(type_identifier) @declaration.name
|
|
61
|
+
.
|
|
62
|
+
(formal_parameter_list)) @declaration.type_alias
|
|
63
|
+
(type_alias
|
|
64
|
+
(type_identifier) @declaration.name
|
|
65
|
+
.
|
|
66
|
+
(type_parameters)
|
|
67
|
+
.
|
|
68
|
+
(formal_parameter_list)) @declaration.type_alias
|
|
69
|
+
(type_alias
|
|
70
|
+
(type_identifier) @declaration.name
|
|
71
|
+
.
|
|
72
|
+
"=") @declaration.type_alias
|
|
73
|
+
(type_alias
|
|
74
|
+
(type_identifier) @declaration.name
|
|
75
|
+
.
|
|
76
|
+
(type_parameters)
|
|
77
|
+
.
|
|
78
|
+
"=") @declaration.type_alias
|
|
79
|
+
|
|
80
|
+
; ── Declarations — top-level functions (parent is program, not method) ───────
|
|
81
|
+
(program
|
|
82
|
+
(function_signature
|
|
83
|
+
name: (identifier) @declaration.name) @declaration.function)
|
|
84
|
+
|
|
85
|
+
; ── Declarations — methods (inside class/mixin/extension bodies) ─────────────
|
|
86
|
+
(method_signature
|
|
87
|
+
(function_signature
|
|
88
|
+
name: (identifier) @declaration.name)) @declaration.method
|
|
89
|
+
|
|
90
|
+
; ── Declarations — abstract methods (bodyless) ───────────────────────────────
|
|
91
|
+
(declaration
|
|
92
|
+
(function_signature
|
|
93
|
+
name: (identifier) @declaration.name)) @declaration.method
|
|
94
|
+
|
|
95
|
+
; ── Declarations — constructors ──────────────────────────────────────────────
|
|
96
|
+
(constructor_signature
|
|
97
|
+
name: (identifier) @declaration.name) @declaration.constructor
|
|
98
|
+
|
|
99
|
+
; ── Declarations — getters / setters (Property, like the legacy DAG) ─────────
|
|
100
|
+
(method_signature
|
|
101
|
+
(getter_signature
|
|
102
|
+
name: (identifier) @declaration.name)) @declaration.property
|
|
103
|
+
(method_signature
|
|
104
|
+
(setter_signature
|
|
105
|
+
name: (identifier) @declaration.name)) @declaration.property
|
|
106
|
+
|
|
107
|
+
; ── Declarations — class fields ──────────────────────────────────────────────
|
|
108
|
+
(declaration
|
|
109
|
+
(type_identifier)
|
|
110
|
+
(initialized_identifier_list
|
|
111
|
+
(initialized_identifier
|
|
112
|
+
. (identifier) @declaration.name))) @declaration.property
|
|
113
|
+
(declaration
|
|
114
|
+
(nullable_type)
|
|
115
|
+
(initialized_identifier_list
|
|
116
|
+
(initialized_identifier
|
|
117
|
+
. (identifier) @declaration.name))) @declaration.property
|
|
118
|
+
|
|
119
|
+
; ── Imports / re-exports ─────────────────────────────────────────────────────
|
|
120
|
+
(import_or_export
|
|
121
|
+
(library_import
|
|
122
|
+
(import_specification
|
|
123
|
+
(configurable_uri) @import.source))) @import.statement
|
|
124
|
+
(import_or_export
|
|
125
|
+
(library_export
|
|
126
|
+
(configurable_uri) @import.source)) @import.statement
|
|
127
|
+
`;
|
|
128
|
+
let _parser = null;
|
|
129
|
+
let _query = null;
|
|
130
|
+
export function getDartParser() {
|
|
131
|
+
if (_parser === null) {
|
|
132
|
+
_parser = new Parser();
|
|
133
|
+
_parser.setLanguage(Dart);
|
|
134
|
+
}
|
|
135
|
+
return _parser;
|
|
136
|
+
}
|
|
137
|
+
export function getDartScopeQuery() {
|
|
138
|
+
if (_query === null) {
|
|
139
|
+
_query = new Parser.Query(Dart, DART_SCOPE_QUERY);
|
|
140
|
+
}
|
|
141
|
+
return _query;
|
|
142
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthesize the implicit `this` (and `super`) receiver type-binding for a
|
|
3
|
+
* Dart instance method — tree-sitter can't express the implicit receiver via
|
|
4
|
+
* a static query pattern. Mirror of `languages/swift/receiver-binding.ts`,
|
|
5
|
+
* adapted for Dart's grammar:
|
|
6
|
+
*
|
|
7
|
+
* - The receiver name is `this` (Swift's `self`); `super` is the
|
|
8
|
+
* superclass receiver.
|
|
9
|
+
* - Dart's `function_signature`/`function_body` are SIBLINGS (not a
|
|
10
|
+
* `body:` field), so the caller passes the resolved `function_body`
|
|
11
|
+
* node explicitly as the anchor — anchoring the binding inside the body
|
|
12
|
+
* guarantees it lands in the (synthesized) Function scope, not the
|
|
13
|
+
* enclosing Class scope.
|
|
14
|
+
* - Static methods (`dartMethodConfig.isStatic`) and bodyless declarations
|
|
15
|
+
* get no receiver binding.
|
|
16
|
+
*/
|
|
17
|
+
import { type SyntaxNode } from '../../utils/ast-helpers.js';
|
|
18
|
+
import type { CaptureMatch } from '../../../../_shared/index.js';
|
|
19
|
+
/**
|
|
20
|
+
* `declNode` is the method declaration wrapper (`method_signature` /
|
|
21
|
+
* `declaration` / top-level `function_signature`). `bodyNode` is the
|
|
22
|
+
* resolved sibling `function_body` (the anchor for Function-scope landing).
|
|
23
|
+
*/
|
|
24
|
+
export declare function synthesizeDartReceiverBinding(declNode: SyntaxNode, bodyNode: SyntaxNode): CaptureMatch[];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthesize the implicit `this` (and `super`) receiver type-binding for a
|
|
3
|
+
* Dart instance method — tree-sitter can't express the implicit receiver via
|
|
4
|
+
* a static query pattern. Mirror of `languages/swift/receiver-binding.ts`,
|
|
5
|
+
* adapted for Dart's grammar:
|
|
6
|
+
*
|
|
7
|
+
* - The receiver name is `this` (Swift's `self`); `super` is the
|
|
8
|
+
* superclass receiver.
|
|
9
|
+
* - Dart's `function_signature`/`function_body` are SIBLINGS (not a
|
|
10
|
+
* `body:` field), so the caller passes the resolved `function_body`
|
|
11
|
+
* node explicitly as the anchor — anchoring the binding inside the body
|
|
12
|
+
* guarantees it lands in the (synthesized) Function scope, not the
|
|
13
|
+
* enclosing Class scope.
|
|
14
|
+
* - Static methods (`dartMethodConfig.isStatic`) and bodyless declarations
|
|
15
|
+
* get no receiver binding.
|
|
16
|
+
*/
|
|
17
|
+
import { nodeToCapture, syntheticCapture } from '../../utils/ast-helpers.js';
|
|
18
|
+
import { dartMethodConfig } from '../../method-extractors/configs/dart.js';
|
|
19
|
+
const TYPE_DECL_TYPES = new Set([
|
|
20
|
+
'class_definition',
|
|
21
|
+
'mixin_declaration',
|
|
22
|
+
'extension_declaration',
|
|
23
|
+
'enum_declaration',
|
|
24
|
+
]);
|
|
25
|
+
/** Walk up from a method declaration node to its enclosing type declaration. */
|
|
26
|
+
function findEnclosingTypeDeclaration(node) {
|
|
27
|
+
let cur = node.parent;
|
|
28
|
+
while (cur !== null) {
|
|
29
|
+
if (TYPE_DECL_TYPES.has(cur.type))
|
|
30
|
+
return cur;
|
|
31
|
+
cur = cur.parent;
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
/** The bare type name for a type declaration (`class Foo` → `Foo`). */
|
|
36
|
+
function enclosingTypeName(typeNode) {
|
|
37
|
+
if (typeNode.type === 'mixin_declaration') {
|
|
38
|
+
// mixin has no `name:` field — first identifier child is the name.
|
|
39
|
+
for (let i = 0; i < typeNode.namedChildCount; i++) {
|
|
40
|
+
const c = typeNode.namedChild(i);
|
|
41
|
+
if (c !== null && c.type === 'identifier')
|
|
42
|
+
return c.text;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const nameNode = typeNode.childForFieldName('name');
|
|
47
|
+
return nameNode !== null ? nameNode.text : null;
|
|
48
|
+
}
|
|
49
|
+
/** The first `extends` superclass type name, if any (for `super`). */
|
|
50
|
+
function firstSuperType(typeNode) {
|
|
51
|
+
const superclass = typeNode.childForFieldName('superclass');
|
|
52
|
+
if (superclass === null)
|
|
53
|
+
return null;
|
|
54
|
+
for (let i = 0; i < superclass.namedChildCount; i++) {
|
|
55
|
+
const c = superclass.namedChild(i);
|
|
56
|
+
if (c !== null && c.type === 'type_identifier')
|
|
57
|
+
return c.text;
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
function buildReceiverMatch(anchor, name, typeText) {
|
|
62
|
+
return {
|
|
63
|
+
'@type-binding.self': nodeToCapture('@type-binding.self', anchor),
|
|
64
|
+
'@type-binding.name': syntheticCapture('@type-binding.name', anchor, name),
|
|
65
|
+
'@type-binding.type': syntheticCapture('@type-binding.type', anchor, typeText),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* `declNode` is the method declaration wrapper (`method_signature` /
|
|
70
|
+
* `declaration` / top-level `function_signature`). `bodyNode` is the
|
|
71
|
+
* resolved sibling `function_body` (the anchor for Function-scope landing).
|
|
72
|
+
*/
|
|
73
|
+
export function synthesizeDartReceiverBinding(declNode, bodyNode) {
|
|
74
|
+
if (dartMethodConfig.isStatic(declNode))
|
|
75
|
+
return [];
|
|
76
|
+
const enclosingType = findEnclosingTypeDeclaration(declNode);
|
|
77
|
+
if (enclosingType === null)
|
|
78
|
+
return []; // top-level function — no receiver
|
|
79
|
+
const typeName = enclosingTypeName(enclosingType);
|
|
80
|
+
if (typeName === null)
|
|
81
|
+
return [];
|
|
82
|
+
const out = [buildReceiverMatch(bodyNode, 'this', typeName)];
|
|
83
|
+
const superType = firstSuperType(enclosingType);
|
|
84
|
+
if (superType !== null)
|
|
85
|
+
out.push(buildReceiverMatch(bodyNode, 'super', superType));
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dart `ScopeResolver` registered in `SCOPE_RESOLVERS` and consumed by the
|
|
3
|
+
* generic `runScopeResolution` orchestrator (RFC #909 Ring 3, issue #939).
|
|
4
|
+
*
|
|
5
|
+
* Closest reference: Swift (`swiftScopeResolver`) — both are statically typed,
|
|
6
|
+
* have no `new` keyword, and model `Type(...)` as a reference to the type.
|
|
7
|
+
*
|
|
8
|
+
* ## Dart specifics
|
|
9
|
+
*
|
|
10
|
+
* - **`implements` / `with`.** Dart can implement (and mixes in) ordinary
|
|
11
|
+
* classes, so the edge type cannot be decided from the target's symbol
|
|
12
|
+
* kind (the generic `preEmitInheritanceEdges` pre-pass routes
|
|
13
|
+
* `Interface`/`Trait` → IMPLEMENTS, everything else → EXTENDS). `extends`
|
|
14
|
+
* is captured as `@reference.inherits` and rides the generic pre-pass
|
|
15
|
+
* (target is a class → EXTENDS); `implements`/`with` are carried as
|
|
16
|
+
* `__heritage__:` side-effect imports and emitted here as IMPLEMENTS by
|
|
17
|
+
* `emitDartHeritageEdges`. METHOD_IMPLEMENTS then falls out of the shared
|
|
18
|
+
* MRO/interface-dispatch phase.
|
|
19
|
+
* - **Mixin MRO.** `buildDartMro` augments the EXTENDS chain with mixin /
|
|
20
|
+
* interface ancestors (IMPLEMENTS edges) so mixed-in members participate
|
|
21
|
+
* in method lookup (PHP/Ruby trait pattern).
|
|
22
|
+
* - **No `new`.** `Type(...)` resolves to the Class node
|
|
23
|
+
* (`constructorCallTargetsClass`); the cross-file global free-call
|
|
24
|
+
* fallback is allowed (`allowGlobalFreeCallFallback`).
|
|
25
|
+
* - **Statically typed** → `fieldFallbackOnMethodLookup: false` (the
|
|
26
|
+
* field-walk heuristic over-connects when types are reliable).
|
|
27
|
+
*/
|
|
28
|
+
import type { ScopeResolver } from '../../scope-resolution/contract/scope-resolver.js';
|
|
29
|
+
export declare const dartScopeResolver: ScopeResolver;
|