cotx-engine 0.1.0
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/LICENSE +94 -0
- package/README.md +103 -0
- package/dist/commands/compile.d.ts +3 -0
- package/dist/commands/compile.js +93 -0
- package/dist/commands/compile.js.map +1 -0
- package/dist/commands/context.d.ts +1 -0
- package/dist/commands/context.js +98 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/diff.d.ts +19 -0
- package/dist/commands/diff.js +127 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/impact.d.ts +3 -0
- package/dist/commands/impact.js +91 -0
- package/dist/commands/impact.js.map +1 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +13 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/lint.d.ts +13 -0
- package/dist/commands/lint.js +290 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/map.d.ts +6 -0
- package/dist/commands/map.js +409 -0
- package/dist/commands/map.js.map +1 -0
- package/dist/commands/migrate.d.ts +16 -0
- package/dist/commands/migrate.js +150 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/query.d.ts +3 -0
- package/dist/commands/query.js +47 -0
- package/dist/commands/query.js.map +1 -0
- package/dist/commands/rename.d.ts +5 -0
- package/dist/commands/rename.js +163 -0
- package/dist/commands/rename.js.map +1 -0
- package/dist/commands/snapshot.d.ts +6 -0
- package/dist/commands/snapshot.js +48 -0
- package/dist/commands/snapshot.js.map +1 -0
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +72 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/update.d.ts +8 -0
- package/dist/commands/update.js +163 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/write.d.ts +6 -0
- package/dist/commands/write.js +221 -0
- package/dist/commands/write.js.map +1 -0
- package/dist/compiler/auto-describe.d.ts +13 -0
- package/dist/compiler/auto-describe.js +91 -0
- package/dist/compiler/auto-describe.js.map +1 -0
- package/dist/compiler/concept-compiler.d.ts +21 -0
- package/dist/compiler/concept-compiler.js +125 -0
- package/dist/compiler/concept-compiler.js.map +1 -0
- package/dist/compiler/contract-compiler.d.ts +16 -0
- package/dist/compiler/contract-compiler.js +90 -0
- package/dist/compiler/contract-compiler.js.map +1 -0
- package/dist/compiler/delta-detector.d.ts +8 -0
- package/dist/compiler/delta-detector.js +34 -0
- package/dist/compiler/delta-detector.js.map +1 -0
- package/dist/compiler/flow-compiler.d.ts +18 -0
- package/dist/compiler/flow-compiler.js +69 -0
- package/dist/compiler/flow-compiler.js.map +1 -0
- package/dist/compiler/module-compiler.d.ts +18 -0
- package/dist/compiler/module-compiler.js +420 -0
- package/dist/compiler/module-compiler.js.map +1 -0
- package/dist/compiler/stale-detector.d.ts +22 -0
- package/dist/compiler/stale-detector.js +79 -0
- package/dist/compiler/stale-detector.js.map +1 -0
- package/dist/config/ignore-service.d.ts +26 -0
- package/dist/config/ignore-service.js +366 -0
- package/dist/config/ignore-service.js.map +1 -0
- package/dist/core/analysis/cluster-enricher.d.ts +38 -0
- package/dist/core/analysis/cluster-enricher.js +169 -0
- package/dist/core/analysis/cluster-enricher.js.map +1 -0
- package/dist/core/analysis/community-processor.d.ts +39 -0
- package/dist/core/analysis/community-processor.js +319 -0
- package/dist/core/analysis/community-processor.js.map +1 -0
- package/dist/core/analysis/process-processor.d.ts +51 -0
- package/dist/core/analysis/process-processor.js +318 -0
- package/dist/core/analysis/process-processor.js.map +1 -0
- package/dist/core/bridge.d.ts +15 -0
- package/dist/core/bridge.js +63 -0
- package/dist/core/bridge.js.map +1 -0
- package/dist/core/export/json-exporter.d.ts +43 -0
- package/dist/core/export/json-exporter.js +13 -0
- package/dist/core/export/json-exporter.js.map +1 -0
- package/dist/core/graph/graph.d.ts +2 -0
- package/dist/core/graph/graph.js +79 -0
- package/dist/core/graph/graph.js.map +1 -0
- package/dist/core/graph/types.d.ts +25 -0
- package/dist/core/graph/types.js +2 -0
- package/dist/core/graph/types.js.map +1 -0
- package/dist/core/parser/ast-cache.d.ts +11 -0
- package/dist/core/parser/ast-cache.js +36 -0
- package/dist/core/parser/ast-cache.js.map +1 -0
- package/dist/core/parser/call-processor.d.ts +105 -0
- package/dist/core/parser/call-processor.js +1807 -0
- package/dist/core/parser/call-processor.js.map +1 -0
- package/dist/core/parser/call-routing.d.ts +55 -0
- package/dist/core/parser/call-routing.js +113 -0
- package/dist/core/parser/call-routing.js.map +1 -0
- package/dist/core/parser/call-sites/extract-language-call-site.d.ts +10 -0
- package/dist/core/parser/call-sites/extract-language-call-site.js +23 -0
- package/dist/core/parser/call-sites/extract-language-call-site.js.map +1 -0
- package/dist/core/parser/call-sites/java.d.ts +9 -0
- package/dist/core/parser/call-sites/java.js +31 -0
- package/dist/core/parser/call-sites/java.js.map +1 -0
- package/dist/core/parser/cluster-enricher.d.ts +38 -0
- package/dist/core/parser/cluster-enricher.js +169 -0
- package/dist/core/parser/cluster-enricher.js.map +1 -0
- package/dist/core/parser/community-processor.d.ts +39 -0
- package/dist/core/parser/community-processor.js +321 -0
- package/dist/core/parser/community-processor.js.map +1 -0
- package/dist/core/parser/constants.d.ts +16 -0
- package/dist/core/parser/constants.js +17 -0
- package/dist/core/parser/constants.js.map +1 -0
- package/dist/core/parser/entry-point-scoring.d.ts +57 -0
- package/dist/core/parser/entry-point-scoring.js +377 -0
- package/dist/core/parser/entry-point-scoring.js.map +1 -0
- package/dist/core/parser/export-detection.d.ts +57 -0
- package/dist/core/parser/export-detection.js +234 -0
- package/dist/core/parser/export-detection.js.map +1 -0
- package/dist/core/parser/field-extractor.d.ts +34 -0
- package/dist/core/parser/field-extractor.js +33 -0
- package/dist/core/parser/field-extractor.js.map +1 -0
- package/dist/core/parser/field-extractors/configs/c-cpp.d.ts +16 -0
- package/dist/core/parser/field-extractors/configs/c-cpp.js +129 -0
- package/dist/core/parser/field-extractors/configs/c-cpp.js.map +1 -0
- package/dist/core/parser/field-extractors/configs/csharp.d.ts +15 -0
- package/dist/core/parser/field-extractors/configs/csharp.js +129 -0
- package/dist/core/parser/field-extractors/configs/csharp.js.map +1 -0
- package/dist/core/parser/field-extractors/configs/dart.d.ts +12 -0
- package/dist/core/parser/field-extractors/configs/dart.js +93 -0
- package/dist/core/parser/field-extractors/configs/dart.js.map +1 -0
- package/dist/core/parser/field-extractors/configs/go.d.ts +12 -0
- package/dist/core/parser/field-extractors/configs/go.js +66 -0
- package/dist/core/parser/field-extractors/configs/go.js.map +1 -0
- package/dist/core/parser/field-extractors/configs/helpers.d.ts +40 -0
- package/dist/core/parser/field-extractors/configs/helpers.js +118 -0
- package/dist/core/parser/field-extractors/configs/helpers.js.map +1 -0
- package/dist/core/parser/field-extractors/configs/jvm.d.ts +17 -0
- package/dist/core/parser/field-extractors/configs/jvm.js +139 -0
- package/dist/core/parser/field-extractors/configs/jvm.js.map +1 -0
- package/dist/core/parser/field-extractors/configs/php.d.ts +12 -0
- package/dist/core/parser/field-extractors/configs/php.js +69 -0
- package/dist/core/parser/field-extractors/configs/php.js.map +1 -0
- package/dist/core/parser/field-extractors/configs/python.d.ts +15 -0
- package/dist/core/parser/field-extractors/configs/python.js +92 -0
- package/dist/core/parser/field-extractors/configs/python.js.map +1 -0
- package/dist/core/parser/field-extractors/configs/ruby.d.ts +15 -0
- package/dist/core/parser/field-extractors/configs/ruby.js +68 -0
- package/dist/core/parser/field-extractors/configs/ruby.js.map +1 -0
- package/dist/core/parser/field-extractors/configs/rust.d.ts +12 -0
- package/dist/core/parser/field-extractors/configs/rust.js +58 -0
- package/dist/core/parser/field-extractors/configs/rust.js.map +1 -0
- package/dist/core/parser/field-extractors/configs/swift.d.ts +15 -0
- package/dist/core/parser/field-extractors/configs/swift.js +75 -0
- package/dist/core/parser/field-extractors/configs/swift.js.map +1 -0
- package/dist/core/parser/field-extractors/configs/typescript-javascript.d.ts +14 -0
- package/dist/core/parser/field-extractors/configs/typescript-javascript.js +72 -0
- package/dist/core/parser/field-extractors/configs/typescript-javascript.js.map +1 -0
- package/dist/core/parser/field-extractors/generic.d.ts +61 -0
- package/dist/core/parser/field-extractors/generic.js +170 -0
- package/dist/core/parser/field-extractors/generic.js.map +1 -0
- package/dist/core/parser/field-extractors/typescript.d.ts +16 -0
- package/dist/core/parser/field-extractors/typescript.js +167 -0
- package/dist/core/parser/field-extractors/typescript.js.map +1 -0
- package/dist/core/parser/field-types.d.ts +46 -0
- package/dist/core/parser/field-types.js +2 -0
- package/dist/core/parser/field-types.js.map +1 -0
- package/dist/core/parser/filesystem-walker.d.ts +28 -0
- package/dist/core/parser/filesystem-walker.js +82 -0
- package/dist/core/parser/filesystem-walker.js.map +1 -0
- package/dist/core/parser/framework-detection.d.ts +149 -0
- package/dist/core/parser/framework-detection.js +782 -0
- package/dist/core/parser/framework-detection.js.map +1 -0
- package/dist/core/parser/heritage-processor.d.ts +52 -0
- package/dist/core/parser/heritage-processor.js +339 -0
- package/dist/core/parser/heritage-processor.js.map +1 -0
- package/dist/core/parser/import-processor.d.ts +33 -0
- package/dist/core/parser/import-processor.js +382 -0
- package/dist/core/parser/import-processor.js.map +1 -0
- package/dist/core/parser/import-resolvers/csharp.d.ts +19 -0
- package/dist/core/parser/import-resolvers/csharp.js +132 -0
- package/dist/core/parser/import-resolvers/csharp.js.map +1 -0
- package/dist/core/parser/import-resolvers/dart.d.ts +7 -0
- package/dist/core/parser/import-resolvers/dart.js +45 -0
- package/dist/core/parser/import-resolvers/dart.js.map +1 -0
- package/dist/core/parser/import-resolvers/go.d.ts +18 -0
- package/dist/core/parser/import-resolvers/go.js +62 -0
- package/dist/core/parser/import-resolvers/go.js.map +1 -0
- package/dist/core/parser/import-resolvers/jvm.d.ts +32 -0
- package/dist/core/parser/import-resolvers/jvm.js +160 -0
- package/dist/core/parser/import-resolvers/jvm.js.map +1 -0
- package/dist/core/parser/import-resolvers/php.d.ts +25 -0
- package/dist/core/parser/import-resolvers/php.js +81 -0
- package/dist/core/parser/import-resolvers/php.js.map +1 -0
- package/dist/core/parser/import-resolvers/python.d.ts +25 -0
- package/dist/core/parser/import-resolvers/python.js +85 -0
- package/dist/core/parser/import-resolvers/python.js.map +1 -0
- package/dist/core/parser/import-resolvers/ruby.d.ts +15 -0
- package/dist/core/parser/import-resolvers/ruby.js +21 -0
- package/dist/core/parser/import-resolvers/ruby.js.map +1 -0
- package/dist/core/parser/import-resolvers/rust.d.ts +18 -0
- package/dist/core/parser/import-resolvers/rust.js +119 -0
- package/dist/core/parser/import-resolvers/rust.js.map +1 -0
- package/dist/core/parser/import-resolvers/standard.d.ts +36 -0
- package/dist/core/parser/import-resolvers/standard.js +144 -0
- package/dist/core/parser/import-resolvers/standard.js.map +1 -0
- package/dist/core/parser/import-resolvers/swift.d.ts +7 -0
- package/dist/core/parser/import-resolvers/swift.js +25 -0
- package/dist/core/parser/import-resolvers/swift.js.map +1 -0
- package/dist/core/parser/import-resolvers/types.d.ts +44 -0
- package/dist/core/parser/import-resolvers/types.js +7 -0
- package/dist/core/parser/import-resolvers/types.js.map +1 -0
- package/dist/core/parser/import-resolvers/utils.d.ts +35 -0
- package/dist/core/parser/import-resolvers/utils.js +150 -0
- package/dist/core/parser/import-resolvers/utils.js.map +1 -0
- package/dist/core/parser/import-resolvers/vue.d.ts +8 -0
- package/dist/core/parser/import-resolvers/vue.js +10 -0
- package/dist/core/parser/import-resolvers/vue.js.map +1 -0
- package/dist/core/parser/language-config.d.ts +52 -0
- package/dist/core/parser/language-config.js +182 -0
- package/dist/core/parser/language-config.js.map +1 -0
- package/dist/core/parser/language-provider.d.ts +126 -0
- package/dist/core/parser/language-provider.js +25 -0
- package/dist/core/parser/language-provider.js.map +1 -0
- package/dist/core/parser/languages/c-cpp.d.ts +12 -0
- package/dist/core/parser/languages/c-cpp.js +312 -0
- package/dist/core/parser/languages/c-cpp.js.map +1 -0
- package/dist/core/parser/languages/csharp.d.ts +8 -0
- package/dist/core/parser/languages/csharp.js +127 -0
- package/dist/core/parser/languages/csharp.js.map +1 -0
- package/dist/core/parser/languages/dart.d.ts +12 -0
- package/dist/core/parser/languages/dart.js +91 -0
- package/dist/core/parser/languages/dart.js.map +1 -0
- package/dist/core/parser/languages/go.d.ts +11 -0
- package/dist/core/parser/languages/go.js +32 -0
- package/dist/core/parser/languages/go.js.map +1 -0
- package/dist/core/parser/languages/index.d.ts +38 -0
- package/dist/core/parser/languages/index.js +63 -0
- package/dist/core/parser/languages/index.js.map +1 -0
- package/dist/core/parser/languages/java.d.ts +9 -0
- package/dist/core/parser/languages/java.js +33 -0
- package/dist/core/parser/languages/java.js.map +1 -0
- package/dist/core/parser/languages/kotlin.d.ts +9 -0
- package/dist/core/parser/languages/kotlin.js +112 -0
- package/dist/core/parser/languages/kotlin.js.map +1 -0
- package/dist/core/parser/languages/php.d.ts +8 -0
- package/dist/core/parser/languages/php.js +226 -0
- package/dist/core/parser/languages/php.js.map +1 -0
- package/dist/core/parser/languages/python.d.ts +12 -0
- package/dist/core/parser/languages/python.js +66 -0
- package/dist/core/parser/languages/python.js.map +1 -0
- package/dist/core/parser/languages/ruby.d.ts +9 -0
- package/dist/core/parser/languages/ruby.js +109 -0
- package/dist/core/parser/languages/ruby.js.map +1 -0
- package/dist/core/parser/languages/rust.d.ts +12 -0
- package/dist/core/parser/languages/rust.js +121 -0
- package/dist/core/parser/languages/rust.js.map +1 -0
- package/dist/core/parser/languages/swift.d.ts +12 -0
- package/dist/core/parser/languages/swift.js +233 -0
- package/dist/core/parser/languages/swift.js.map +1 -0
- package/dist/core/parser/languages/typescript.d.ts +11 -0
- package/dist/core/parser/languages/typescript.js +169 -0
- package/dist/core/parser/languages/typescript.js.map +1 -0
- package/dist/core/parser/languages/vue.d.ts +13 -0
- package/dist/core/parser/languages/vue.js +65 -0
- package/dist/core/parser/languages/vue.js.map +1 -0
- package/dist/core/parser/markdown-processor.d.ts +17 -0
- package/dist/core/parser/markdown-processor.js +125 -0
- package/dist/core/parser/markdown-processor.js.map +1 -0
- package/dist/core/parser/method-extractors/configs/c-cpp.d.ts +3 -0
- package/dist/core/parser/method-extractors/configs/c-cpp.js +276 -0
- package/dist/core/parser/method-extractors/configs/c-cpp.js.map +1 -0
- package/dist/core/parser/method-extractors/configs/csharp.d.ts +2 -0
- package/dist/core/parser/method-extractors/configs/csharp.js +243 -0
- package/dist/core/parser/method-extractors/configs/csharp.js.map +1 -0
- package/dist/core/parser/method-extractors/configs/dart.d.ts +2 -0
- package/dist/core/parser/method-extractors/configs/dart.js +263 -0
- package/dist/core/parser/method-extractors/configs/dart.js.map +1 -0
- package/dist/core/parser/method-extractors/configs/go.d.ts +2 -0
- package/dist/core/parser/method-extractors/configs/go.js +120 -0
- package/dist/core/parser/method-extractors/configs/go.js.map +1 -0
- package/dist/core/parser/method-extractors/configs/jvm.d.ts +3 -0
- package/dist/core/parser/method-extractors/configs/jvm.js +309 -0
- package/dist/core/parser/method-extractors/configs/jvm.js.map +1 -0
- package/dist/core/parser/method-extractors/configs/php.d.ts +2 -0
- package/dist/core/parser/method-extractors/configs/php.js +243 -0
- package/dist/core/parser/method-extractors/configs/php.js.map +1 -0
- package/dist/core/parser/method-extractors/configs/python.d.ts +2 -0
- package/dist/core/parser/method-extractors/configs/python.js +219 -0
- package/dist/core/parser/method-extractors/configs/python.js.map +1 -0
- package/dist/core/parser/method-extractors/configs/ruby.d.ts +2 -0
- package/dist/core/parser/method-extractors/configs/ruby.js +201 -0
- package/dist/core/parser/method-extractors/configs/ruby.js.map +1 -0
- package/dist/core/parser/method-extractors/configs/rust.d.ts +2 -0
- package/dist/core/parser/method-extractors/configs/rust.js +120 -0
- package/dist/core/parser/method-extractors/configs/rust.js.map +1 -0
- package/dist/core/parser/method-extractors/configs/swift.d.ts +2 -0
- package/dist/core/parser/method-extractors/configs/swift.js +191 -0
- package/dist/core/parser/method-extractors/configs/swift.js.map +1 -0
- package/dist/core/parser/method-extractors/configs/typescript-javascript.d.ts +3 -0
- package/dist/core/parser/method-extractors/configs/typescript-javascript.js +231 -0
- package/dist/core/parser/method-extractors/configs/typescript-javascript.js.map +1 -0
- package/dist/core/parser/method-extractors/generic.d.ts +11 -0
- package/dist/core/parser/method-extractors/generic.js +162 -0
- package/dist/core/parser/method-extractors/generic.js.map +1 -0
- package/dist/core/parser/method-types.d.ts +110 -0
- package/dist/core/parser/method-types.js +2 -0
- package/dist/core/parser/method-types.js.map +1 -0
- package/dist/core/parser/mro-processor.d.ts +46 -0
- package/dist/core/parser/mro-processor.js +677 -0
- package/dist/core/parser/mro-processor.js.map +1 -0
- package/dist/core/parser/named-binding-processor.d.ts +18 -0
- package/dist/core/parser/named-binding-processor.js +43 -0
- package/dist/core/parser/named-binding-processor.js.map +1 -0
- package/dist/core/parser/named-bindings/csharp.d.ts +3 -0
- package/dist/core/parser/named-bindings/csharp.js +38 -0
- package/dist/core/parser/named-bindings/csharp.js.map +1 -0
- package/dist/core/parser/named-bindings/java.d.ts +3 -0
- package/dist/core/parser/named-bindings/java.js +30 -0
- package/dist/core/parser/named-bindings/java.js.map +1 -0
- package/dist/core/parser/named-bindings/kotlin.d.ts +3 -0
- package/dist/core/parser/named-bindings/kotlin.js +37 -0
- package/dist/core/parser/named-bindings/kotlin.js.map +1 -0
- package/dist/core/parser/named-bindings/php.d.ts +3 -0
- package/dist/core/parser/named-bindings/php.js +62 -0
- package/dist/core/parser/named-bindings/php.js.map +1 -0
- package/dist/core/parser/named-bindings/python.d.ts +3 -0
- package/dist/core/parser/named-bindings/python.js +50 -0
- package/dist/core/parser/named-bindings/python.js.map +1 -0
- package/dist/core/parser/named-bindings/rust.d.ts +3 -0
- package/dist/core/parser/named-bindings/rust.js +67 -0
- package/dist/core/parser/named-bindings/rust.js.map +1 -0
- package/dist/core/parser/named-bindings/types.d.ts +16 -0
- package/dist/core/parser/named-bindings/types.js +7 -0
- package/dist/core/parser/named-bindings/types.js.map +1 -0
- package/dist/core/parser/named-bindings/typescript.d.ts +3 -0
- package/dist/core/parser/named-bindings/typescript.js +59 -0
- package/dist/core/parser/named-bindings/typescript.js.map +1 -0
- package/dist/core/parser/parsing-processor.d.ts +23 -0
- package/dist/core/parser/parsing-processor.js +464 -0
- package/dist/core/parser/parsing-processor.js.map +1 -0
- package/dist/core/parser/pipeline.d.ts +17 -0
- package/dist/core/parser/pipeline.js +1405 -0
- package/dist/core/parser/pipeline.js.map +1 -0
- package/dist/core/parser/process-processor.d.ts +51 -0
- package/dist/core/parser/process-processor.js +318 -0
- package/dist/core/parser/process-processor.js.map +1 -0
- package/dist/core/parser/resolution-context.d.ts +58 -0
- package/dist/core/parser/resolution-context.js +136 -0
- package/dist/core/parser/resolution-context.js.map +1 -0
- package/dist/core/parser/route-extractors/expo.d.ts +1 -0
- package/dist/core/parser/route-extractors/expo.js +37 -0
- package/dist/core/parser/route-extractors/expo.js.map +1 -0
- package/dist/core/parser/route-extractors/middleware.d.ts +47 -0
- package/dist/core/parser/route-extractors/middleware.js +168 -0
- package/dist/core/parser/route-extractors/middleware.js.map +1 -0
- package/dist/core/parser/route-extractors/nextjs.d.ts +3 -0
- package/dist/core/parser/route-extractors/nextjs.js +77 -0
- package/dist/core/parser/route-extractors/nextjs.js.map +1 -0
- package/dist/core/parser/route-extractors/php.d.ts +7 -0
- package/dist/core/parser/route-extractors/php.js +23 -0
- package/dist/core/parser/route-extractors/php.js.map +1 -0
- package/dist/core/parser/route-extractors/response-shapes.d.ts +20 -0
- package/dist/core/parser/route-extractors/response-shapes.js +295 -0
- package/dist/core/parser/route-extractors/response-shapes.js.map +1 -0
- package/dist/core/parser/structure-processor.d.ts +2 -0
- package/dist/core/parser/structure-processor.js +37 -0
- package/dist/core/parser/structure-processor.js.map +1 -0
- package/dist/core/parser/symbol-table.d.ts +79 -0
- package/dist/core/parser/symbol-table.js +116 -0
- package/dist/core/parser/symbol-table.js.map +1 -0
- package/dist/core/parser/tree-sitter-queries.d.ts +16 -0
- package/dist/core/parser/tree-sitter-queries.js +1180 -0
- package/dist/core/parser/tree-sitter-queries.js.map +1 -0
- package/dist/core/parser/type-env.d.ts +81 -0
- package/dist/core/parser/type-env.js +1048 -0
- package/dist/core/parser/type-env.js.map +1 -0
- package/dist/core/parser/type-extractors/c-cpp.d.ts +7 -0
- package/dist/core/parser/type-extractors/c-cpp.js +533 -0
- package/dist/core/parser/type-extractors/c-cpp.js.map +1 -0
- package/dist/core/parser/type-extractors/csharp.d.ts +2 -0
- package/dist/core/parser/type-extractors/csharp.js +584 -0
- package/dist/core/parser/type-extractors/csharp.js.map +1 -0
- package/dist/core/parser/type-extractors/dart.d.ts +15 -0
- package/dist/core/parser/type-extractors/dart.js +370 -0
- package/dist/core/parser/type-extractors/dart.js.map +1 -0
- package/dist/core/parser/type-extractors/go.d.ts +2 -0
- package/dist/core/parser/type-extractors/go.js +514 -0
- package/dist/core/parser/type-extractors/go.js.map +1 -0
- package/dist/core/parser/type-extractors/jvm.d.ts +3 -0
- package/dist/core/parser/type-extractors/jvm.js +857 -0
- package/dist/core/parser/type-extractors/jvm.js.map +1 -0
- package/dist/core/parser/type-extractors/php.d.ts +2 -0
- package/dist/core/parser/type-extractors/php.js +535 -0
- package/dist/core/parser/type-extractors/php.js.map +1 -0
- package/dist/core/parser/type-extractors/python.d.ts +2 -0
- package/dist/core/parser/type-extractors/python.js +475 -0
- package/dist/core/parser/type-extractors/python.js.map +1 -0
- package/dist/core/parser/type-extractors/ruby.d.ts +2 -0
- package/dist/core/parser/type-extractors/ruby.js +378 -0
- package/dist/core/parser/type-extractors/ruby.js.map +1 -0
- package/dist/core/parser/type-extractors/rust.d.ts +2 -0
- package/dist/core/parser/type-extractors/rust.js +516 -0
- package/dist/core/parser/type-extractors/rust.js.map +1 -0
- package/dist/core/parser/type-extractors/shared.d.ts +131 -0
- package/dist/core/parser/type-extractors/shared.js +797 -0
- package/dist/core/parser/type-extractors/shared.js.map +1 -0
- package/dist/core/parser/type-extractors/swift.d.ts +2 -0
- package/dist/core/parser/type-extractors/swift.js +485 -0
- package/dist/core/parser/type-extractors/swift.js.map +1 -0
- package/dist/core/parser/type-extractors/types.d.ts +172 -0
- package/dist/core/parser/type-extractors/types.js +2 -0
- package/dist/core/parser/type-extractors/types.js.map +1 -0
- package/dist/core/parser/type-extractors/typescript.d.ts +2 -0
- package/dist/core/parser/type-extractors/typescript.js +662 -0
- package/dist/core/parser/type-extractors/typescript.js.map +1 -0
- package/dist/core/parser/utils/ast-helpers.d.ts +73 -0
- package/dist/core/parser/utils/ast-helpers.js +415 -0
- package/dist/core/parser/utils/ast-helpers.js.map +1 -0
- package/dist/core/parser/utils/call-analysis.d.ts +75 -0
- package/dist/core/parser/utils/call-analysis.js +575 -0
- package/dist/core/parser/utils/call-analysis.js.map +1 -0
- package/dist/core/parser/utils/event-loop.d.ts +5 -0
- package/dist/core/parser/utils/event-loop.js +6 -0
- package/dist/core/parser/utils/event-loop.js.map +1 -0
- package/dist/core/parser/utils/method-props.d.ts +8 -0
- package/dist/core/parser/utils/method-props.js +39 -0
- package/dist/core/parser/utils/method-props.js.map +1 -0
- package/dist/core/parser/utils/verbose.d.ts +1 -0
- package/dist/core/parser/utils/verbose.js +8 -0
- package/dist/core/parser/utils/verbose.js.map +1 -0
- package/dist/core/parser/vue-sfc-extractor.d.ts +44 -0
- package/dist/core/parser/vue-sfc-extractor.js +95 -0
- package/dist/core/parser/vue-sfc-extractor.js.map +1 -0
- package/dist/core/parser/workers/parse-worker.d.ts +171 -0
- package/dist/core/parser/workers/parse-worker.js +1724 -0
- package/dist/core/parser/workers/parse-worker.js.map +1 -0
- package/dist/core/parser/workers/worker-pool.d.ts +16 -0
- package/dist/core/parser/workers/worker-pool.js +124 -0
- package/dist/core/parser/workers/worker-pool.js.map +1 -0
- package/dist/core/shared/graph-types.d.ts +61 -0
- package/dist/core/shared/graph-types.js +5 -0
- package/dist/core/shared/graph-types.js.map +1 -0
- package/dist/core/shared/index.d.ts +4 -0
- package/dist/core/shared/index.js +4 -0
- package/dist/core/shared/index.js.map +1 -0
- package/dist/core/shared/language-detection.d.ts +22 -0
- package/dist/core/shared/language-detection.js +137 -0
- package/dist/core/shared/language-detection.js.map +1 -0
- package/dist/core/shared/languages.d.ts +23 -0
- package/dist/core/shared/languages.js +25 -0
- package/dist/core/shared/languages.js.map +1 -0
- package/dist/core/shared/pipeline.d.ts +15 -0
- package/dist/core/shared/pipeline.js +5 -0
- package/dist/core/shared/pipeline.js.map +1 -0
- package/dist/core/tree-sitter/parser-loader.d.ts +5 -0
- package/dist/core/tree-sitter/parser-loader.js +71 -0
- package/dist/core/tree-sitter/parser-loader.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +132 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/hash.d.ts +1 -0
- package/dist/lib/hash.js +6 -0
- package/dist/lib/hash.js.map +1 -0
- package/dist/lib/naming.d.ts +12 -0
- package/dist/lib/naming.js +28 -0
- package/dist/lib/naming.js.map +1 -0
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.js +4 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/mcp/server.d.ts +26 -0
- package/dist/mcp/server.js +282 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +37 -0
- package/dist/mcp/tools.js +650 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/query/bm25.d.ts +19 -0
- package/dist/query/bm25.js +60 -0
- package/dist/query/bm25.js.map +1 -0
- package/dist/query/graph-index.d.ts +40 -0
- package/dist/query/graph-index.js +178 -0
- package/dist/query/graph-index.js.map +1 -0
- package/dist/store/derived-index.d.ts +4 -0
- package/dist/store/derived-index.js +68 -0
- package/dist/store/derived-index.js.map +1 -0
- package/dist/store/meta.d.ts +1 -0
- package/dist/store/meta.js +3 -0
- package/dist/store/meta.js.map +1 -0
- package/dist/store/schema.d.ts +135 -0
- package/dist/store/schema.js +2 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/store.d.ts +49 -0
- package/dist/store/store.js +254 -0
- package/dist/store/store.js.map +1 -0
- package/dist/types/pipeline.d.ts +12 -0
- package/dist/types/pipeline.js +2 -0
- package/dist/types/pipeline.js.map +1 -0
- package/package.json +69 -0
- package/skills/cotx-enrich/SKILL.md +59 -0
- package/vendor/leiden/index.cjs +355 -0
- package/vendor/leiden/utils.cjs +392 -0
|
@@ -0,0 +1,1048 @@
|
|
|
1
|
+
import { FUNCTION_NODE_TYPES, CLASS_CONTAINER_TYPES, genericFuncName, } from './utils/ast-helpers.js';
|
|
2
|
+
import { CALL_EXPRESSION_TYPES } from './utils/call-analysis.js';
|
|
3
|
+
import { TYPED_PARAMETER_TYPES } from './type-extractors/shared.js';
|
|
4
|
+
import { getProvider } from './languages/index.js';
|
|
5
|
+
import { extractSimpleTypeName, extractVarName, stripNullable, extractReturnTypeName, } from './type-extractors/shared.js';
|
|
6
|
+
/** File-level scope key */
|
|
7
|
+
const FILE_SCOPE = '';
|
|
8
|
+
/** Shared empty map for files with no file-scope bindings. */
|
|
9
|
+
const EMPTY_FILE_SCOPE = new Map();
|
|
10
|
+
/** Fallback for languages where class names aren't in a 'name' field (e.g. Kotlin uses type_identifier). */
|
|
11
|
+
const findTypeIdentifierChild = (node) => {
|
|
12
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
13
|
+
const child = node.child(i);
|
|
14
|
+
if (child && child.type === 'type_identifier')
|
|
15
|
+
return child;
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
};
|
|
19
|
+
/** AST node types that represent mutually exclusive branch containers for pattern bindings.
|
|
20
|
+
* Includes both multi-arm pattern-match branches AND if-statement bodies for null-check narrowing. */
|
|
21
|
+
const NARROWING_BRANCH_TYPES = new Set([
|
|
22
|
+
'when_entry', // Kotlin when
|
|
23
|
+
'switch_block_label', // Java switch (enhanced)
|
|
24
|
+
'if_statement', // TS/JS, Java, C/C++
|
|
25
|
+
'if_expression', // Kotlin (if is an expression)
|
|
26
|
+
'statement_block', // TS/JS: { ... } body of if
|
|
27
|
+
'control_structure_body', // Kotlin: body of if
|
|
28
|
+
]);
|
|
29
|
+
/** Walk up the AST from a pattern node to find the enclosing branch container. */
|
|
30
|
+
const findNarrowingBranchScope = (node) => {
|
|
31
|
+
let current = node.parent;
|
|
32
|
+
while (current) {
|
|
33
|
+
if (NARROWING_BRANCH_TYPES.has(current.type))
|
|
34
|
+
return current;
|
|
35
|
+
if (FUNCTION_NODE_TYPES.has(current.type))
|
|
36
|
+
return undefined;
|
|
37
|
+
current = current.parent;
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
};
|
|
41
|
+
/** Bare nullable keywords that fastStripNullable must reject. */
|
|
42
|
+
const FAST_NULLABLE_KEYWORDS = new Set(['null', 'undefined', 'void', 'None', 'nil']);
|
|
43
|
+
/**
|
|
44
|
+
* Fast-path nullable check: 90%+ of type names are simple identifiers (e.g. "User")
|
|
45
|
+
* that don't need the full stripNullable parse. Only call stripNullable when the
|
|
46
|
+
* string contains nullable markers ('|' for union types, '?' for nullable suffix).
|
|
47
|
+
*/
|
|
48
|
+
const fastStripNullable = (typeName) => {
|
|
49
|
+
if (FAST_NULLABLE_KEYWORDS.has(typeName))
|
|
50
|
+
return undefined;
|
|
51
|
+
return typeName.indexOf('|') === -1 && typeName.indexOf('?') === -1
|
|
52
|
+
? typeName
|
|
53
|
+
: stripNullable(typeName);
|
|
54
|
+
};
|
|
55
|
+
/** Implementation of the lookup logic — shared between TypeEnvironment and the legacy export. */
|
|
56
|
+
const lookupInEnv = (env, varName, callNode, patternOverrides, enclosingFunctionFinder, extractFunctionNameHook) => {
|
|
57
|
+
// Self/this receiver: resolve to enclosing class name via AST walk
|
|
58
|
+
if (varName === 'self' || varName === 'this' || varName === '$this') {
|
|
59
|
+
return findEnclosingClassName(callNode);
|
|
60
|
+
}
|
|
61
|
+
// Super/base/parent receiver: resolve to the parent class name via AST walk.
|
|
62
|
+
// Walks up to the enclosing class, then extracts the superclass from its heritage node.
|
|
63
|
+
if (varName === 'super' || varName === 'base' || varName === 'parent') {
|
|
64
|
+
return findEnclosingParentClassName(callNode);
|
|
65
|
+
}
|
|
66
|
+
// Determine the enclosing function scope for the call
|
|
67
|
+
const scopeKey = findEnclosingScopeKey(callNode, enclosingFunctionFinder, extractFunctionNameHook);
|
|
68
|
+
// Check position-indexed pattern overrides first (e.g., Kotlin when/is smart casts).
|
|
69
|
+
// These take priority over flat scopeEnv because they represent per-branch narrowing.
|
|
70
|
+
if (scopeKey && patternOverrides) {
|
|
71
|
+
const varOverrides = patternOverrides.get(scopeKey)?.get(varName);
|
|
72
|
+
if (varOverrides) {
|
|
73
|
+
const pos = callNode.startIndex;
|
|
74
|
+
for (const override of varOverrides) {
|
|
75
|
+
if (pos >= override.rangeStart && pos <= override.rangeEnd) {
|
|
76
|
+
return fastStripNullable(override.typeName);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Try function-local scope first
|
|
82
|
+
if (scopeKey) {
|
|
83
|
+
const scopeEnv = env.get(scopeKey);
|
|
84
|
+
if (scopeEnv) {
|
|
85
|
+
const result = scopeEnv.get(varName);
|
|
86
|
+
if (result)
|
|
87
|
+
return fastStripNullable(result);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Fall back to file-level scope
|
|
91
|
+
const fileEnv = env.get(FILE_SCOPE);
|
|
92
|
+
const raw = fileEnv?.get(varName);
|
|
93
|
+
return raw ? fastStripNullable(raw) : undefined;
|
|
94
|
+
};
|
|
95
|
+
/** Per-file memoization caches for expensive parent-walk functions.
|
|
96
|
+
* Cleared at the start of each buildTypeEnv call (one call per file). */
|
|
97
|
+
const enclosingClassNameCache = new Map();
|
|
98
|
+
const enclosingParentClassNameCache = new Map();
|
|
99
|
+
/**
|
|
100
|
+
* Walk up the AST from a node to find the enclosing class/module name.
|
|
101
|
+
* Used to resolve `self`/`this` receivers to their containing type.
|
|
102
|
+
* Memoized per-file: cache is cleared at buildTypeEnv entry.
|
|
103
|
+
*/
|
|
104
|
+
const findEnclosingClassName = (node) => {
|
|
105
|
+
if (enclosingClassNameCache.has(node))
|
|
106
|
+
return enclosingClassNameCache.get(node);
|
|
107
|
+
let current = node.parent;
|
|
108
|
+
while (current) {
|
|
109
|
+
if (CLASS_CONTAINER_TYPES.has(current.type)) {
|
|
110
|
+
const nameNode = current.childForFieldName('name') ?? findTypeIdentifierChild(current);
|
|
111
|
+
if (nameNode) {
|
|
112
|
+
enclosingClassNameCache.set(node, nameNode.text);
|
|
113
|
+
return nameNode.text;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
current = current.parent;
|
|
117
|
+
}
|
|
118
|
+
enclosingClassNameCache.set(node, undefined);
|
|
119
|
+
return undefined;
|
|
120
|
+
};
|
|
121
|
+
/** Keywords that refer to the current instance across languages. */
|
|
122
|
+
const THIS_RECEIVERS = new Set(['this', 'self', '$this', 'Me']);
|
|
123
|
+
/**
|
|
124
|
+
* If a pending assignment's receiver is this/self/$this/Me, substitute the
|
|
125
|
+
* enclosing class name. Returns the item unchanged for non-receiver kinds
|
|
126
|
+
* or when the receiver is not a this-keyword. Properties are readonly in the
|
|
127
|
+
* discriminated union, so a new object is returned when substitution occurs.
|
|
128
|
+
*/
|
|
129
|
+
const substituteThisReceiver = (item, node) => {
|
|
130
|
+
if (item.kind !== 'fieldAccess' && item.kind !== 'methodCallResult')
|
|
131
|
+
return item;
|
|
132
|
+
if (!THIS_RECEIVERS.has(item.receiver))
|
|
133
|
+
return item;
|
|
134
|
+
const className = findEnclosingClassName(node);
|
|
135
|
+
if (!className)
|
|
136
|
+
return item;
|
|
137
|
+
return { ...item, receiver: className };
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Walk up the AST to find the enclosing class, then extract its parent class name
|
|
141
|
+
* from the heritage/superclass AST node. Used to resolve `super`/`base`/`parent`.
|
|
142
|
+
*
|
|
143
|
+
* Supported patterns per tree-sitter grammar:
|
|
144
|
+
* - Java/Ruby: `superclass` field → type_identifier/constant
|
|
145
|
+
* - Python: `superclasses` field → argument_list → first identifier
|
|
146
|
+
* - TypeScript/JS: unnamed `class_heritage` child → `extends_clause` → identifier
|
|
147
|
+
* - C#: unnamed `base_list` child → first identifier
|
|
148
|
+
* - PHP: unnamed `base_clause` child → name
|
|
149
|
+
* - Kotlin: unnamed `delegation_specifier` child → constructor_invocation → user_type → type_identifier
|
|
150
|
+
* - C++: unnamed `base_class_clause` child → type_identifier
|
|
151
|
+
* - Swift: unnamed `inheritance_specifier` child → user_type → type_identifier
|
|
152
|
+
*/
|
|
153
|
+
const findEnclosingParentClassName = (node) => {
|
|
154
|
+
if (enclosingParentClassNameCache.has(node))
|
|
155
|
+
return enclosingParentClassNameCache.get(node);
|
|
156
|
+
let current = node.parent;
|
|
157
|
+
while (current) {
|
|
158
|
+
if (CLASS_CONTAINER_TYPES.has(current.type)) {
|
|
159
|
+
const result = extractParentClassFromNode(current);
|
|
160
|
+
enclosingParentClassNameCache.set(node, result);
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
current = current.parent;
|
|
164
|
+
}
|
|
165
|
+
enclosingParentClassNameCache.set(node, undefined);
|
|
166
|
+
return undefined;
|
|
167
|
+
};
|
|
168
|
+
/** Extract the parent/superclass name from a class declaration AST node. */
|
|
169
|
+
const extractParentClassFromNode = (classNode) => {
|
|
170
|
+
// 1. Named fields: Java (superclass), Ruby (superclass), Python (superclasses)
|
|
171
|
+
const superclassNode = classNode.childForFieldName('superclass');
|
|
172
|
+
if (superclassNode) {
|
|
173
|
+
// Java: superclass > type_identifier or generic_type, Ruby: superclass > constant
|
|
174
|
+
const inner = superclassNode.childForFieldName('type') ?? superclassNode.firstNamedChild ?? superclassNode;
|
|
175
|
+
return extractSimpleTypeName(inner) ?? inner.text;
|
|
176
|
+
}
|
|
177
|
+
const superclassesNode = classNode.childForFieldName('superclasses');
|
|
178
|
+
if (superclassesNode) {
|
|
179
|
+
// Python: argument_list with identifiers or attribute nodes (e.g. models.Model)
|
|
180
|
+
const first = superclassesNode.firstNamedChild;
|
|
181
|
+
if (first)
|
|
182
|
+
return extractSimpleTypeName(first) ?? first.text;
|
|
183
|
+
}
|
|
184
|
+
// 2. Unnamed children: walk class node's children looking for heritage nodes
|
|
185
|
+
for (let i = 0; i < classNode.childCount; i++) {
|
|
186
|
+
const child = classNode.child(i);
|
|
187
|
+
if (!child)
|
|
188
|
+
continue;
|
|
189
|
+
switch (child.type) {
|
|
190
|
+
// TypeScript: class_heritage > extends_clause > type_identifier
|
|
191
|
+
// JavaScript: class_heritage > identifier (no extends_clause wrapper)
|
|
192
|
+
case 'class_heritage': {
|
|
193
|
+
for (let j = 0; j < child.childCount; j++) {
|
|
194
|
+
const clause = child.child(j);
|
|
195
|
+
if (clause?.type === 'extends_clause') {
|
|
196
|
+
const typeNode = clause.firstNamedChild;
|
|
197
|
+
if (typeNode)
|
|
198
|
+
return extractSimpleTypeName(typeNode) ?? typeNode.text;
|
|
199
|
+
}
|
|
200
|
+
// JS: direct identifier child (no extends_clause wrapper)
|
|
201
|
+
if (clause?.type === 'identifier' || clause?.type === 'type_identifier') {
|
|
202
|
+
return clause.text;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
// C#: base_list > identifier or generic_name > identifier
|
|
208
|
+
case 'base_list': {
|
|
209
|
+
const first = child.firstNamedChild;
|
|
210
|
+
if (first) {
|
|
211
|
+
// generic_name wraps the identifier: BaseClass<T>
|
|
212
|
+
if (first.type === 'generic_name') {
|
|
213
|
+
const inner = first.childForFieldName('name') ?? first.firstNamedChild;
|
|
214
|
+
if (inner)
|
|
215
|
+
return inner.text;
|
|
216
|
+
}
|
|
217
|
+
return first.text;
|
|
218
|
+
}
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
// PHP: base_clause > name
|
|
222
|
+
case 'base_clause': {
|
|
223
|
+
const name = child.firstNamedChild;
|
|
224
|
+
if (name)
|
|
225
|
+
return name.text;
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
// C++: base_class_clause > type_identifier (with optional access_specifier before it)
|
|
229
|
+
case 'base_class_clause': {
|
|
230
|
+
for (let j = 0; j < child.childCount; j++) {
|
|
231
|
+
const inner = child.child(j);
|
|
232
|
+
if (inner?.type === 'type_identifier')
|
|
233
|
+
return inner.text;
|
|
234
|
+
}
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
// Kotlin: delegation_specifier > constructor_invocation > user_type > type_identifier
|
|
238
|
+
case 'delegation_specifier': {
|
|
239
|
+
const delegate = child.firstNamedChild;
|
|
240
|
+
if (delegate?.type === 'constructor_invocation') {
|
|
241
|
+
const userType = delegate.firstNamedChild;
|
|
242
|
+
if (userType?.type === 'user_type') {
|
|
243
|
+
const typeId = userType.firstNamedChild;
|
|
244
|
+
if (typeId)
|
|
245
|
+
return typeId.text;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
// Also handle plain user_type (interface conformance without parentheses)
|
|
249
|
+
if (delegate?.type === 'user_type') {
|
|
250
|
+
const typeId = delegate.firstNamedChild;
|
|
251
|
+
if (typeId)
|
|
252
|
+
return typeId.text;
|
|
253
|
+
}
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
// Swift: inheritance_specifier > user_type > type_identifier
|
|
257
|
+
case 'inheritance_specifier': {
|
|
258
|
+
const userType = child.childForFieldName('inherits_from') ?? child.firstNamedChild;
|
|
259
|
+
if (userType?.type === 'user_type') {
|
|
260
|
+
const typeId = userType.firstNamedChild;
|
|
261
|
+
if (typeId)
|
|
262
|
+
return typeId.text;
|
|
263
|
+
}
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return undefined;
|
|
269
|
+
};
|
|
270
|
+
/** Find the enclosing function name for scope lookup.
|
|
271
|
+
* When an `enclosingFunctionFinder` hook is provided (from the language provider),
|
|
272
|
+
* it is consulted for each ancestor before the default FUNCTION_NODE_TYPES check.
|
|
273
|
+
* This handles languages like Dart where the function body is a sibling of the
|
|
274
|
+
* signature instead of a child. */
|
|
275
|
+
const findEnclosingScopeKey = (node, enclosingFunctionFinder, extractFunctionNameHook) => {
|
|
276
|
+
let current = node.parent;
|
|
277
|
+
while (current) {
|
|
278
|
+
if (FUNCTION_NODE_TYPES.has(current.type)) {
|
|
279
|
+
const funcName = extractFunctionNameHook?.(current)?.funcName ?? genericFuncName(current);
|
|
280
|
+
if (funcName)
|
|
281
|
+
return `${funcName}@${current.startIndex}`;
|
|
282
|
+
}
|
|
283
|
+
// Language-specific hook (e.g., Dart function_body → sibling function_signature)
|
|
284
|
+
if (enclosingFunctionFinder) {
|
|
285
|
+
const result = enclosingFunctionFinder(current);
|
|
286
|
+
if (result) {
|
|
287
|
+
const sigNode = current.previousSibling;
|
|
288
|
+
const startIdx = sigNode?.startIndex ?? current.startIndex;
|
|
289
|
+
return `${result.funcName}@${startIdx}`;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
current = current.parent;
|
|
293
|
+
}
|
|
294
|
+
return undefined;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* Create a lookup that checks both local AST class names AND the SymbolTable's
|
|
298
|
+
* global index. This allows extractInitializer functions to distinguish
|
|
299
|
+
* constructor calls from function calls (e.g. Kotlin `User()` vs `getUser()`)
|
|
300
|
+
* using cross-file type information when available.
|
|
301
|
+
*
|
|
302
|
+
* Only `.has()` is exposed — the SymbolTable doesn't support iteration.
|
|
303
|
+
* Results are memoized to avoid redundant lookupFuzzy scans across declarations.
|
|
304
|
+
*/
|
|
305
|
+
const createClassNameLookup = (localNames, symbolTable) => {
|
|
306
|
+
if (!symbolTable)
|
|
307
|
+
return localNames;
|
|
308
|
+
const memo = new Map();
|
|
309
|
+
return {
|
|
310
|
+
has(name) {
|
|
311
|
+
if (localNames.has(name))
|
|
312
|
+
return true;
|
|
313
|
+
const cached = memo.get(name);
|
|
314
|
+
if (cached !== undefined)
|
|
315
|
+
return cached;
|
|
316
|
+
const result = symbolTable
|
|
317
|
+
.lookupFuzzy(name)
|
|
318
|
+
.some((def) => def.type === 'Class' || def.type === 'Enum' || def.type === 'Struct');
|
|
319
|
+
memo.set(name, result);
|
|
320
|
+
return result;
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* Build a TypeEnvironment from a tree-sitter AST for a given language.
|
|
326
|
+
* Single-pass: collects class/struct names, type bindings, AND constructor
|
|
327
|
+
* bindings that couldn't be resolved locally — all in one AST walk.
|
|
328
|
+
*
|
|
329
|
+
* When a symbolTable is provided (call-processor path), class names from across
|
|
330
|
+
* the project are available for constructor inference in languages like Kotlin
|
|
331
|
+
* where constructors are syntactically identical to function calls.
|
|
332
|
+
*/
|
|
333
|
+
/**
|
|
334
|
+
* Node types whose subtrees can NEVER contain type-relevant descendants
|
|
335
|
+
* (declarations, parameters, for-loops, class definitions, pattern bindings).
|
|
336
|
+
* Conservative leaf-only set — verified safe across all 12 supported language grammars.
|
|
337
|
+
* IMPORTANT: Do NOT add expression containers (arguments, binary_expression, etc.) —
|
|
338
|
+
* they can contain arrow functions with typed parameters.
|
|
339
|
+
*/
|
|
340
|
+
const SKIP_SUBTREE_TYPES = new Set([
|
|
341
|
+
// Plain string literals (NOT template_string — it contains interpolated expressions
|
|
342
|
+
// that can hold arrow functions with typed parameters, e.g. `${(x: T) => x}`)
|
|
343
|
+
'string',
|
|
344
|
+
'string_literal',
|
|
345
|
+
'string_content',
|
|
346
|
+
'string_fragment',
|
|
347
|
+
'heredoc_body',
|
|
348
|
+
// Comments
|
|
349
|
+
'comment',
|
|
350
|
+
'line_comment',
|
|
351
|
+
'block_comment',
|
|
352
|
+
// Numeric/boolean/null literals
|
|
353
|
+
'number',
|
|
354
|
+
'integer_literal',
|
|
355
|
+
'float_literal',
|
|
356
|
+
'true',
|
|
357
|
+
'false',
|
|
358
|
+
'null',
|
|
359
|
+
// Regex
|
|
360
|
+
'regex',
|
|
361
|
+
'regex_pattern',
|
|
362
|
+
]);
|
|
363
|
+
const CLASS_LIKE_TYPES = new Set(['Class', 'Struct', 'Interface']);
|
|
364
|
+
/** Memoize class definition lookups during fixpoint iteration.
|
|
365
|
+
* SymbolTable is immutable during type resolution, so results never change.
|
|
366
|
+
* Eliminates redundant array allocations + filter scans across iterations. */
|
|
367
|
+
const createClassDefCache = (symbolTable) => {
|
|
368
|
+
const cache = new Map();
|
|
369
|
+
return (typeName) => {
|
|
370
|
+
let result = cache.get(typeName);
|
|
371
|
+
if (result === undefined) {
|
|
372
|
+
result = symbolTable
|
|
373
|
+
? symbolTable.lookupFuzzy(typeName).filter((d) => CLASS_LIKE_TYPES.has(d.type))
|
|
374
|
+
: [];
|
|
375
|
+
cache.set(typeName, result);
|
|
376
|
+
}
|
|
377
|
+
return result;
|
|
378
|
+
};
|
|
379
|
+
};
|
|
380
|
+
/** AST node types representing constructor expressions across languages.
|
|
381
|
+
* Note: C# also has `implicit_object_creation_expression` (`new()` with type
|
|
382
|
+
* inference) which is NOT captured — the type is inferred, not explicit.
|
|
383
|
+
* Kotlin constructors use `call_expression` (no `new` keyword) — not detected. */
|
|
384
|
+
const CONSTRUCTOR_EXPR_TYPES = new Set([
|
|
385
|
+
'new_expression', // TS/JS/C++: new Dog()
|
|
386
|
+
'object_creation_expression', // Java/C#: new Dog()
|
|
387
|
+
]);
|
|
388
|
+
/** Extract the constructor class name from a declaration node's initializer.
|
|
389
|
+
* Searches for new_expression / object_creation_expression in the node's subtree.
|
|
390
|
+
* Returns the class name or undefined if no constructor is found.
|
|
391
|
+
* Depth-limited to 5 to avoid expensive traversals. */
|
|
392
|
+
const extractConstructorTypeName = (node, depth = 0) => {
|
|
393
|
+
if (depth > 5)
|
|
394
|
+
return undefined;
|
|
395
|
+
if (CONSTRUCTOR_EXPR_TYPES.has(node.type)) {
|
|
396
|
+
// Java/C#: object_creation_expression has 'type' field
|
|
397
|
+
const typeField = node.childForFieldName('type');
|
|
398
|
+
if (typeField)
|
|
399
|
+
return extractSimpleTypeName(typeField);
|
|
400
|
+
// TS/JS: new_expression has 'constructor' field (but tree-sitter often just has identifier child)
|
|
401
|
+
const ctorField = node.childForFieldName('constructor');
|
|
402
|
+
if (ctorField)
|
|
403
|
+
return extractSimpleTypeName(ctorField);
|
|
404
|
+
// Fallback: first named child is often the class identifier
|
|
405
|
+
if (node.firstNamedChild)
|
|
406
|
+
return extractSimpleTypeName(node.firstNamedChild);
|
|
407
|
+
}
|
|
408
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
409
|
+
const child = node.namedChild(i);
|
|
410
|
+
if (!child)
|
|
411
|
+
continue;
|
|
412
|
+
// Don't descend into nested functions/classes or call expressions (prevents
|
|
413
|
+
// finding constructor args inside method calls, e.g. processAll(new Dog()))
|
|
414
|
+
if (FUNCTION_NODE_TYPES.has(child.type) ||
|
|
415
|
+
CLASS_CONTAINER_TYPES.has(child.type) ||
|
|
416
|
+
CALL_EXPRESSION_TYPES.has(child.type))
|
|
417
|
+
continue;
|
|
418
|
+
const result = extractConstructorTypeName(child, depth + 1);
|
|
419
|
+
if (result)
|
|
420
|
+
return result;
|
|
421
|
+
}
|
|
422
|
+
return undefined;
|
|
423
|
+
};
|
|
424
|
+
/** Max depth for MRO parent chain walking. Real-world inheritance rarely exceeds 3-4 levels. */
|
|
425
|
+
const MAX_MRO_DEPTH = 5;
|
|
426
|
+
/** Check if `child` is a subclass of `parent` using the parentMap.
|
|
427
|
+
* BFS up from child, depth-limited (5), cycle-safe. */
|
|
428
|
+
export const isSubclassOf = (child, parent, parentMap) => {
|
|
429
|
+
if (!parentMap || child === parent)
|
|
430
|
+
return false;
|
|
431
|
+
const visited = new Set([child]);
|
|
432
|
+
let current = [child];
|
|
433
|
+
for (let depth = 0; depth < MAX_MRO_DEPTH && current.length > 0; depth++) {
|
|
434
|
+
const next = [];
|
|
435
|
+
for (const cls of current) {
|
|
436
|
+
const parents = parentMap.get(cls);
|
|
437
|
+
if (!parents)
|
|
438
|
+
continue;
|
|
439
|
+
for (const p of parents) {
|
|
440
|
+
if (p === parent)
|
|
441
|
+
return true;
|
|
442
|
+
if (!visited.has(p)) {
|
|
443
|
+
visited.add(p);
|
|
444
|
+
next.push(p);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
current = next;
|
|
449
|
+
}
|
|
450
|
+
return false;
|
|
451
|
+
};
|
|
452
|
+
/** Walk up the parent class chain to find a field or method on an ancestor.
|
|
453
|
+
* BFS-like traversal with depth limit and cycle detection. First match wins.
|
|
454
|
+
* Used by resolveFieldType and resolveMethodReturnType when direct lookup fails. */
|
|
455
|
+
const walkParentChain = (typeName, parentMap, getClassDefs, lookupOnClass) => {
|
|
456
|
+
if (!parentMap)
|
|
457
|
+
return undefined;
|
|
458
|
+
const visited = new Set([typeName]);
|
|
459
|
+
let current = [typeName];
|
|
460
|
+
for (let depth = 0; depth < MAX_MRO_DEPTH && current.length > 0; depth++) {
|
|
461
|
+
const next = [];
|
|
462
|
+
for (const cls of current) {
|
|
463
|
+
const parents = parentMap.get(cls);
|
|
464
|
+
if (!parents)
|
|
465
|
+
continue;
|
|
466
|
+
for (const parent of parents) {
|
|
467
|
+
if (visited.has(parent))
|
|
468
|
+
continue;
|
|
469
|
+
visited.add(parent);
|
|
470
|
+
const parentDefs = getClassDefs(parent);
|
|
471
|
+
if (parentDefs.length === 1) {
|
|
472
|
+
const result = lookupOnClass(parentDefs[0].nodeId);
|
|
473
|
+
if (result !== undefined)
|
|
474
|
+
return result;
|
|
475
|
+
}
|
|
476
|
+
next.push(parent);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
current = next;
|
|
480
|
+
}
|
|
481
|
+
return undefined;
|
|
482
|
+
};
|
|
483
|
+
/** Resolve a field's declared type given a receiver variable and field name.
|
|
484
|
+
* Uses SymbolTable to find the class nodeId for the receiver's type, then
|
|
485
|
+
* looks up the field via the eagerly-populated fieldByOwner index.
|
|
486
|
+
* Falls back to MRO parent chain walking if direct lookup fails (Phase 11A). */
|
|
487
|
+
const resolveFieldType = (receiver, field, scopeEnv, symbolTable, getClassDefs, parentMap) => {
|
|
488
|
+
if (!symbolTable)
|
|
489
|
+
return undefined;
|
|
490
|
+
const receiverType = scopeEnv.get(receiver);
|
|
491
|
+
if (!receiverType)
|
|
492
|
+
return undefined;
|
|
493
|
+
const lookup = getClassDefs ??
|
|
494
|
+
((name) => symbolTable.lookupFuzzy(name).filter((d) => CLASS_LIKE_TYPES.has(d.type)));
|
|
495
|
+
const classDefs = lookup(receiverType);
|
|
496
|
+
if (classDefs.length !== 1)
|
|
497
|
+
return undefined;
|
|
498
|
+
// Direct lookup first
|
|
499
|
+
const fieldDef = symbolTable.lookupFieldByOwner(classDefs[0].nodeId, field);
|
|
500
|
+
if (fieldDef?.declaredType)
|
|
501
|
+
return extractReturnTypeName(fieldDef.declaredType);
|
|
502
|
+
// MRO parent chain walking on miss
|
|
503
|
+
const inherited = walkParentChain(receiverType, parentMap, lookup, (nodeId) => {
|
|
504
|
+
const f = symbolTable.lookupFieldByOwner(nodeId, field);
|
|
505
|
+
return f?.declaredType ? extractReturnTypeName(f.declaredType) : undefined;
|
|
506
|
+
});
|
|
507
|
+
return inherited;
|
|
508
|
+
};
|
|
509
|
+
/** Resolve a method's return type given a receiver variable and method name.
|
|
510
|
+
* Uses SymbolTable to find class nodeIds for the receiver's type, then
|
|
511
|
+
* looks up the method via lookupFuzzyCallable filtered by ownerId.
|
|
512
|
+
* Falls back to MRO parent chain walking if direct lookup fails (Phase 11A). */
|
|
513
|
+
const resolveMethodReturnType = (receiver, method, scopeEnv, symbolTable, getClassDefs, parentMap) => {
|
|
514
|
+
if (!symbolTable)
|
|
515
|
+
return undefined;
|
|
516
|
+
let receiverType = scopeEnv.get(receiver);
|
|
517
|
+
// When substituteThisReceiver replaced $this/self with the enclosing class name,
|
|
518
|
+
// the receiver IS the type — look it up directly as a class name.
|
|
519
|
+
if (!receiverType) {
|
|
520
|
+
const lookup = getClassDefs ??
|
|
521
|
+
((name) => symbolTable.lookupFuzzy(name).filter((d) => CLASS_LIKE_TYPES.has(d.type)));
|
|
522
|
+
if (lookup(receiver).length > 0)
|
|
523
|
+
receiverType = receiver;
|
|
524
|
+
}
|
|
525
|
+
if (!receiverType)
|
|
526
|
+
return undefined;
|
|
527
|
+
const lookup = getClassDefs ??
|
|
528
|
+
((name) => symbolTable.lookupFuzzy(name).filter((d) => CLASS_LIKE_TYPES.has(d.type)));
|
|
529
|
+
const classDefs = lookup(receiverType);
|
|
530
|
+
if (classDefs.length === 0)
|
|
531
|
+
return undefined;
|
|
532
|
+
// Direct lookup first
|
|
533
|
+
const classNodeIds = new Set(classDefs.map((d) => d.nodeId));
|
|
534
|
+
const methods = symbolTable
|
|
535
|
+
.lookupFuzzyCallable(method)
|
|
536
|
+
.filter((d) => d.ownerId && classNodeIds.has(d.ownerId));
|
|
537
|
+
if (methods.length === 1 && methods[0].returnType) {
|
|
538
|
+
return extractReturnTypeName(methods[0].returnType);
|
|
539
|
+
}
|
|
540
|
+
// MRO parent chain walking on miss
|
|
541
|
+
if (methods.length === 0) {
|
|
542
|
+
const inherited = walkParentChain(receiverType, parentMap, lookup, (nodeId) => {
|
|
543
|
+
const parentMethods = symbolTable
|
|
544
|
+
.lookupFuzzyCallable(method)
|
|
545
|
+
.filter((d) => d.ownerId === nodeId);
|
|
546
|
+
if (parentMethods.length !== 1 || !parentMethods[0].returnType)
|
|
547
|
+
return undefined;
|
|
548
|
+
return extractReturnTypeName(parentMethods[0].returnType);
|
|
549
|
+
});
|
|
550
|
+
return inherited;
|
|
551
|
+
}
|
|
552
|
+
return undefined;
|
|
553
|
+
};
|
|
554
|
+
/**
|
|
555
|
+
* Unified fixpoint propagation: iterate over ALL pending items (copy, callResult,
|
|
556
|
+
* fieldAccess, methodCallResult) until no new bindings are produced.
|
|
557
|
+
* Handles arbitrary-depth mixed chains:
|
|
558
|
+
* const user = getUser(); // callResult → User
|
|
559
|
+
* const addr = user.address; // fieldAccess → Address (depends on user)
|
|
560
|
+
* const city = addr.getCity(); // methodCallResult → City (depends on addr)
|
|
561
|
+
* const alias = city; // copy → City (depends on city)
|
|
562
|
+
* Data flow: SymbolTable (immutable) + scopeEnv → resolve → scopeEnv.
|
|
563
|
+
* Termination: finite entries, each bound at most once (first-writer-wins), max 10 iterations.
|
|
564
|
+
*/
|
|
565
|
+
const MAX_FIXPOINT_ITERATIONS = 10;
|
|
566
|
+
const resolveFixpointBindings = (pendingItems, env, returnTypeLookup, symbolTable, parentMap) => {
|
|
567
|
+
if (pendingItems.length === 0)
|
|
568
|
+
return;
|
|
569
|
+
const getClassDefs = createClassDefCache(symbolTable);
|
|
570
|
+
const resolved = new Set();
|
|
571
|
+
for (let iter = 0; iter < MAX_FIXPOINT_ITERATIONS; iter++) {
|
|
572
|
+
let changed = false;
|
|
573
|
+
for (let i = 0; i < pendingItems.length; i++) {
|
|
574
|
+
if (resolved.has(i))
|
|
575
|
+
continue;
|
|
576
|
+
const item = pendingItems[i];
|
|
577
|
+
const scopeEnv = env.get(item.scope);
|
|
578
|
+
if (!scopeEnv || scopeEnv.has(item.lhs)) {
|
|
579
|
+
resolved.add(i);
|
|
580
|
+
continue;
|
|
581
|
+
}
|
|
582
|
+
let typeName;
|
|
583
|
+
switch (item.kind) {
|
|
584
|
+
case 'callResult':
|
|
585
|
+
// Phase 9: Prefer FQN lookup when available for higher precision
|
|
586
|
+
typeName = item.calleeFqn
|
|
587
|
+
? returnTypeLookup.lookupReturnType(item.calleeFqn)
|
|
588
|
+
: returnTypeLookup.lookupReturnType(item.callee);
|
|
589
|
+
break;
|
|
590
|
+
case 'copy':
|
|
591
|
+
typeName = scopeEnv.get(item.rhs) ?? env.get(FILE_SCOPE)?.get(item.rhs);
|
|
592
|
+
break;
|
|
593
|
+
case 'fieldAccess':
|
|
594
|
+
typeName = resolveFieldType(item.receiver, item.field, scopeEnv, symbolTable, getClassDefs, parentMap);
|
|
595
|
+
break;
|
|
596
|
+
case 'methodCallResult':
|
|
597
|
+
typeName = resolveMethodReturnType(item.receiver, item.method, scopeEnv, symbolTable, getClassDefs, parentMap);
|
|
598
|
+
break;
|
|
599
|
+
default: {
|
|
600
|
+
// Exhaustive check: TypeScript will error here if a new PendingAssignment
|
|
601
|
+
// kind is added without handling it in the switch.
|
|
602
|
+
const _exhaustive = item;
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
if (typeName) {
|
|
607
|
+
scopeEnv.set(item.lhs, typeName);
|
|
608
|
+
resolved.add(i);
|
|
609
|
+
changed = true;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
if (!changed)
|
|
613
|
+
break;
|
|
614
|
+
if (iter === MAX_FIXPOINT_ITERATIONS - 1 && process.env.COTX_DEBUG) {
|
|
615
|
+
const unresolved = pendingItems.length - resolved.size;
|
|
616
|
+
if (unresolved > 0) {
|
|
617
|
+
console.warn(`[type-env] fixpoint hit iteration cap (${MAX_FIXPOINT_ITERATIONS}), ${unresolved} items unresolved`);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
/** Seed cross-file type bindings into the file scope.
|
|
623
|
+
* MUST be called AFTER walk() completes so that local declarations
|
|
624
|
+
* (Tier 0/1) always take precedence over imported bindings (first-writer-wins). */
|
|
625
|
+
function seedImportedBindings(env, importedBindings) {
|
|
626
|
+
let fileEnv = env.get(FILE_SCOPE);
|
|
627
|
+
if (!fileEnv) {
|
|
628
|
+
fileEnv = new Map();
|
|
629
|
+
env.set(FILE_SCOPE, fileEnv);
|
|
630
|
+
}
|
|
631
|
+
for (const [name, type] of importedBindings) {
|
|
632
|
+
if (!fileEnv.has(name)) {
|
|
633
|
+
fileEnv.set(name, type);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
export const buildTypeEnv = (tree, language, options) => {
|
|
638
|
+
// Clear per-file memoization caches from the previous file.
|
|
639
|
+
enclosingClassNameCache.clear();
|
|
640
|
+
enclosingParentClassNameCache.clear();
|
|
641
|
+
const symbolTable = options?.symbolTable;
|
|
642
|
+
const parentMap = options?.parentMap;
|
|
643
|
+
const extractFuncNameHook = options?.extractFunctionName;
|
|
644
|
+
const env = new Map();
|
|
645
|
+
const patternOverrides = new Map();
|
|
646
|
+
// Phase P: maps `scope\0varName` → constructor type when a declaration has BOTH
|
|
647
|
+
// a base type annotation AND a more specific constructor initializer.
|
|
648
|
+
// e.g., `Animal a = new Dog()` → constructorTypeMap.set('func@42\0a', 'Dog')
|
|
649
|
+
const constructorTypeMap = new Map();
|
|
650
|
+
const localClassNames = new Set();
|
|
651
|
+
const classNames = createClassNameLookup(localClassNames, symbolTable);
|
|
652
|
+
const provider = getProvider(language);
|
|
653
|
+
const config = provider.typeConfig;
|
|
654
|
+
const bindings = [];
|
|
655
|
+
// Build ReturnTypeLookup: SymbolTable is authoritative when it has an unambiguous match.
|
|
656
|
+
// Cross-file importedReturnTypes are consulted ONLY when SymbolTable has 0 matches.
|
|
657
|
+
// Ambiguous (2+) → undefined, no cross-file fallback (conservative, local-first principle).
|
|
658
|
+
const returnTypeLookup = {
|
|
659
|
+
lookupReturnType(callee) {
|
|
660
|
+
// SymbolTable is authoritative when it has an unambiguous match
|
|
661
|
+
if (symbolTable) {
|
|
662
|
+
if (provider.isBuiltInName(callee))
|
|
663
|
+
return undefined;
|
|
664
|
+
const callables = symbolTable.lookupFuzzyCallable(callee);
|
|
665
|
+
if (callables.length === 1) {
|
|
666
|
+
const rawReturn = callables[0].returnType;
|
|
667
|
+
if (rawReturn)
|
|
668
|
+
return extractReturnTypeName(rawReturn);
|
|
669
|
+
}
|
|
670
|
+
// Ambiguous (2+) → return undefined (conservative, no cross-file fallback)
|
|
671
|
+
if (callables.length > 1)
|
|
672
|
+
return undefined;
|
|
673
|
+
}
|
|
674
|
+
// No match (0 results or no symbolTable) → fall back to cross-file
|
|
675
|
+
return options?.importedReturnTypes?.get(callee);
|
|
676
|
+
},
|
|
677
|
+
lookupRawReturnType(callee) {
|
|
678
|
+
if (symbolTable) {
|
|
679
|
+
if (provider.isBuiltInName(callee))
|
|
680
|
+
return undefined;
|
|
681
|
+
const callables = symbolTable.lookupFuzzyCallable(callee);
|
|
682
|
+
if (callables.length === 1)
|
|
683
|
+
return callables[0].returnType;
|
|
684
|
+
// Ambiguous (2+) → return undefined (conservative, no cross-file fallback)
|
|
685
|
+
if (callables.length > 1)
|
|
686
|
+
return undefined;
|
|
687
|
+
}
|
|
688
|
+
// Cross-file fallback uses importedRawReturnTypes (raw declared types, e.g., 'User[]')
|
|
689
|
+
// NOT importedReturnTypes (which contains processed/simple types via extractReturnTypeName)
|
|
690
|
+
return options?.importedRawReturnTypes?.get(callee);
|
|
691
|
+
},
|
|
692
|
+
};
|
|
693
|
+
// Pre-compute combined set of node types that need extractTypeBinding.
|
|
694
|
+
// Single Set.has() replaces 3 separate checks per node in walk().
|
|
695
|
+
const interestingNodeTypes = new Set();
|
|
696
|
+
TYPED_PARAMETER_TYPES.forEach((t) => interestingNodeTypes.add(t));
|
|
697
|
+
config.declarationNodeTypes.forEach((t) => interestingNodeTypes.add(t));
|
|
698
|
+
config.forLoopNodeTypes?.forEach((t) => interestingNodeTypes.add(t));
|
|
699
|
+
// Tier 2: unified fixpoint propagation — collects copy, callResult, fieldAccess, and
|
|
700
|
+
// methodCallResult items during walk(), then iterates until no new bindings are produced.
|
|
701
|
+
// Handles arbitrary-depth mixed chains: callResult → fieldAccess → methodCallResult → copy.
|
|
702
|
+
const pendingItems = [];
|
|
703
|
+
// For-loop nodes whose iterable was unresolved at walk-time. Replayed after the fixpoint
|
|
704
|
+
// resolves the iterable's type, bridging the walk-time/fixpoint gap (Phase 10 / ex-9B).
|
|
705
|
+
const pendingForLoops = [];
|
|
706
|
+
// Maps `scope\0varName` → the type annotation AST node from the original declaration.
|
|
707
|
+
// Allows pattern extractors to navigate back to the declaration's generic type arguments
|
|
708
|
+
// (e.g., to extract T from Result<T, E> for `if let Ok(x) = res`).
|
|
709
|
+
// NOTE: This is a SUPERSET of scopeEnv — entries exist even when extractSimpleTypeName
|
|
710
|
+
// returns undefined for container types (User[], []User, List[User]). This is intentional:
|
|
711
|
+
// for-loop Strategy 1 needs the raw AST type node for exactly those container types.
|
|
712
|
+
const declarationTypeNodes = new Map();
|
|
713
|
+
/**
|
|
714
|
+
* Try to extract a (variableName → typeName) binding from a single AST node.
|
|
715
|
+
*
|
|
716
|
+
* Resolution tiers (first match wins):
|
|
717
|
+
* - Tier 0: explicit type annotations via extractDeclaration / extractForLoopBinding
|
|
718
|
+
* - Tier 1: constructor-call inference via extractInitializer (fallback)
|
|
719
|
+
*
|
|
720
|
+
* Side effect: populates declarationTypeNodes for variables that have an explicit
|
|
721
|
+
* type annotation field on the declaration node. This allows pattern extractors to
|
|
722
|
+
* retrieve generic type arguments from the original declaration (e.g., extracting T
|
|
723
|
+
* from Result<T, E> for `if let Ok(x) = res`).
|
|
724
|
+
*/
|
|
725
|
+
const extractTypeBinding = (node, scopeEnv, scope) => {
|
|
726
|
+
// This guard eliminates 90%+ of calls before any language dispatch.
|
|
727
|
+
if (TYPED_PARAMETER_TYPES.has(node.type)) {
|
|
728
|
+
// Capture the raw type annotation BEFORE extractParameter.
|
|
729
|
+
// Most languages use 'name' field; Rust uses 'pattern'; TS uses 'pattern' for some param types.
|
|
730
|
+
// Kotlin `parameter` nodes use positional children instead of named fields,
|
|
731
|
+
// so we fall back to scanning children by type when childForFieldName returns null.
|
|
732
|
+
const typeNode = node.childForFieldName('type');
|
|
733
|
+
if (typeNode) {
|
|
734
|
+
const nameNode = node.childForFieldName('name') ??
|
|
735
|
+
node.childForFieldName('pattern') ??
|
|
736
|
+
// Python typed_parameter: name is a positional child (identifier), not a named field
|
|
737
|
+
(node.firstNamedChild?.type === 'identifier' ? node.firstNamedChild : null);
|
|
738
|
+
if (nameNode) {
|
|
739
|
+
const varName = extractVarName(nameNode);
|
|
740
|
+
if (varName && !declarationTypeNodes.has(`${scope}\0${varName}`)) {
|
|
741
|
+
declarationTypeNodes.set(`${scope}\0${varName}`, typeNode);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
else {
|
|
746
|
+
// Fallback: positional children (Kotlin `parameter` → simple_identifier + user_type)
|
|
747
|
+
let fallbackName = null;
|
|
748
|
+
let fallbackType = null;
|
|
749
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
750
|
+
const child = node.namedChild(i);
|
|
751
|
+
if (!child)
|
|
752
|
+
continue;
|
|
753
|
+
if (!fallbackName &&
|
|
754
|
+
(child.type === 'simple_identifier' || child.type === 'identifier')) {
|
|
755
|
+
fallbackName = child;
|
|
756
|
+
}
|
|
757
|
+
if (!fallbackType &&
|
|
758
|
+
(child.type === 'user_type' ||
|
|
759
|
+
child.type === 'type_identifier' ||
|
|
760
|
+
child.type === 'generic_type' ||
|
|
761
|
+
child.type === 'parameterized_type' ||
|
|
762
|
+
child.type === 'nullable_type')) {
|
|
763
|
+
fallbackType = child;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
if (fallbackName && fallbackType) {
|
|
767
|
+
const varName = extractVarName(fallbackName);
|
|
768
|
+
if (varName && !declarationTypeNodes.has(`${scope}\0${varName}`)) {
|
|
769
|
+
declarationTypeNodes.set(`${scope}\0${varName}`, fallbackType);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
config.extractParameter(node, scopeEnv);
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
// For-each loop variable bindings (Java/C#/Kotlin): explicit element types in the AST.
|
|
777
|
+
// Checked before declarationNodeTypes — loop variables are not declarations.
|
|
778
|
+
if (config.forLoopNodeTypes?.has(node.type)) {
|
|
779
|
+
if (config.extractForLoopBinding) {
|
|
780
|
+
const sizeBefore = scopeEnv.size;
|
|
781
|
+
const forLoopCtx = {
|
|
782
|
+
scopeEnv,
|
|
783
|
+
declarationTypeNodes,
|
|
784
|
+
scope,
|
|
785
|
+
returnTypeLookup,
|
|
786
|
+
};
|
|
787
|
+
config.extractForLoopBinding(node, forLoopCtx);
|
|
788
|
+
// If no new binding was produced, the iterable's type may not yet be resolved.
|
|
789
|
+
// Store for post-fixpoint replay (Phase 10 / ex-9B loop-fixpoint bridge).
|
|
790
|
+
if (scopeEnv.size === sizeBefore) {
|
|
791
|
+
pendingForLoops.push({ node, scope });
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
if (config.declarationNodeTypes.has(node.type)) {
|
|
797
|
+
// Capture the raw type annotation AST node BEFORE extractDeclaration.
|
|
798
|
+
// This decouples type node capture from scopeEnv success — container types
|
|
799
|
+
// (User[], []User, List[User]) that fail extractSimpleTypeName still get
|
|
800
|
+
// their AST type node recorded for Strategy 1 for-loop resolution.
|
|
801
|
+
//
|
|
802
|
+
// Prefer language-specific locator when provided (keeps buildTypeEnv generic),
|
|
803
|
+
// then fall back to a small set of safe, cross-grammar heuristics.
|
|
804
|
+
let typeNode = config.getDeclarationTypeNode?.(node) ?? node.childForFieldName('type') ?? null;
|
|
805
|
+
// Fallback: some grammars wrap type annotations in a `type_annotation` child
|
|
806
|
+
// instead of exposing a named `type` field on the declaration node.
|
|
807
|
+
if (!typeNode) {
|
|
808
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
809
|
+
const c = node.namedChild(i);
|
|
810
|
+
if (c?.type === 'type_annotation') {
|
|
811
|
+
typeNode = c.firstNamedChild ?? c;
|
|
812
|
+
break;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
if (typeNode) {
|
|
817
|
+
const nameNode = node.childForFieldName('name') ??
|
|
818
|
+
node.childForFieldName('left') ??
|
|
819
|
+
node.childForFieldName('pattern');
|
|
820
|
+
if (nameNode) {
|
|
821
|
+
const varName = extractVarName(nameNode);
|
|
822
|
+
if (varName && !declarationTypeNodes.has(`${scope}\0${varName}`)) {
|
|
823
|
+
declarationTypeNodes.set(`${scope}\0${varName}`, typeNode);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
// Run the language-specific declaration extractor (may or may not add to scopeEnv).
|
|
828
|
+
const sizeBefore = typeNode ? scopeEnv.size : -1;
|
|
829
|
+
config.extractDeclaration(node, scopeEnv);
|
|
830
|
+
// Fallback: for multi-declarator languages (TS, C#, Java) where the type field
|
|
831
|
+
// is on variable_declarator children, capture newly-added keys.
|
|
832
|
+
// Map preserves insertion order, so new keys are always at the end —
|
|
833
|
+
// skip the first sizeBefore entries to find only newly-added variables.
|
|
834
|
+
if (sizeBefore >= 0 && scopeEnv.size > sizeBefore) {
|
|
835
|
+
let skip = sizeBefore;
|
|
836
|
+
for (const varName of scopeEnv.keys()) {
|
|
837
|
+
if (skip > 0) {
|
|
838
|
+
skip--;
|
|
839
|
+
continue;
|
|
840
|
+
}
|
|
841
|
+
if (!declarationTypeNodes.has(`${scope}\0${varName}`)) {
|
|
842
|
+
declarationTypeNodes.set(`${scope}\0${varName}`, typeNode);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
// Tier 1: constructor-call inference as fallback.
|
|
847
|
+
// Always called when available — each language's extractInitializer
|
|
848
|
+
// internally skips declarators that already have explicit annotations,
|
|
849
|
+
// so this handles mixed cases like `const a: A = x, b = new B()`.
|
|
850
|
+
if (config.extractInitializer) {
|
|
851
|
+
config.extractInitializer(node, scopeEnv, classNames);
|
|
852
|
+
}
|
|
853
|
+
// Phase P: detect constructor-visible virtual dispatch.
|
|
854
|
+
// When a declaration has BOTH a type annotation AND a constructor initializer,
|
|
855
|
+
// record the constructor type for receiver override at call resolution time.
|
|
856
|
+
// e.g., `Animal a = new Dog()` → constructorTypeMap.set('scope\0a', 'Dog')
|
|
857
|
+
if (sizeBefore >= 0 && scopeEnv.size > sizeBefore) {
|
|
858
|
+
let ctorSkip = sizeBefore;
|
|
859
|
+
for (const varName of scopeEnv.keys()) {
|
|
860
|
+
if (ctorSkip > 0) {
|
|
861
|
+
ctorSkip--;
|
|
862
|
+
continue;
|
|
863
|
+
}
|
|
864
|
+
const declaredType = scopeEnv.get(varName);
|
|
865
|
+
if (!declaredType)
|
|
866
|
+
continue;
|
|
867
|
+
const ctorType = extractConstructorTypeName(node) ?? config.detectConstructorType?.(node, classNames);
|
|
868
|
+
if (!ctorType || ctorType === declaredType)
|
|
869
|
+
continue;
|
|
870
|
+
// Unwrap wrapper types (e.g., C++ shared_ptr<Animal> → Animal) for an
|
|
871
|
+
// accurate isSubclassOf comparison. Language-specific via config hook.
|
|
872
|
+
const declTypeNode = declarationTypeNodes.get(`${scope}\0${varName}`);
|
|
873
|
+
const effectiveDeclaredType = declTypeNode && config.unwrapDeclaredType
|
|
874
|
+
? (config.unwrapDeclaredType(declaredType, declTypeNode) ?? declaredType)
|
|
875
|
+
: declaredType;
|
|
876
|
+
if (ctorType !== effectiveDeclaredType) {
|
|
877
|
+
constructorTypeMap.set(`${scope}\0${varName}`, ctorType);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
const walk = (node, currentScope) => {
|
|
884
|
+
// Fast skip: subtrees that can never contain type-relevant nodes (leaf-like literals).
|
|
885
|
+
if (SKIP_SUBTREE_TYPES.has(node.type))
|
|
886
|
+
return;
|
|
887
|
+
// Collect class/struct names as we encounter them (used by extractInitializer
|
|
888
|
+
// to distinguish constructor calls from function calls, e.g. C++ `User()` vs `getUser()`)
|
|
889
|
+
// Currently only C++ uses this locally; other languages rely on the SymbolTable path.
|
|
890
|
+
if (CLASS_CONTAINER_TYPES.has(node.type)) {
|
|
891
|
+
// Most languages use 'name' field; Kotlin uses a type_identifier child instead
|
|
892
|
+
const nameNode = node.childForFieldName('name') ?? findTypeIdentifierChild(node);
|
|
893
|
+
if (nameNode)
|
|
894
|
+
localClassNames.add(nameNode.text);
|
|
895
|
+
}
|
|
896
|
+
// Detect scope boundaries (function/method definitions)
|
|
897
|
+
let scope = currentScope;
|
|
898
|
+
if (FUNCTION_NODE_TYPES.has(node.type)) {
|
|
899
|
+
const funcName = extractFuncNameHook?.(node)?.funcName ?? genericFuncName(node);
|
|
900
|
+
if (funcName)
|
|
901
|
+
scope = `${funcName}@${node.startIndex}`;
|
|
902
|
+
}
|
|
903
|
+
// Only create scope map and call extractTypeBinding for interesting node types.
|
|
904
|
+
// Single Set.has() replaces 3 separate checks inside extractTypeBinding.
|
|
905
|
+
if (interestingNodeTypes.has(node.type)) {
|
|
906
|
+
if (!env.has(scope))
|
|
907
|
+
env.set(scope, new Map());
|
|
908
|
+
const scopeEnv = env.get(scope);
|
|
909
|
+
extractTypeBinding(node, scopeEnv, scope);
|
|
910
|
+
}
|
|
911
|
+
// Pattern binding extraction: handles constructs that introduce NEW typed variables
|
|
912
|
+
// via pattern matching (e.g. `if let Some(x) = opt`, `x instanceof T t`)
|
|
913
|
+
// or narrow existing variables within a branch (null-check narrowing).
|
|
914
|
+
// Runs after Tier 0/1 so scopeEnv already contains the source variable's type.
|
|
915
|
+
// Conservative: extractor returns undefined when source type is unknown.
|
|
916
|
+
if (config.extractPatternBinding &&
|
|
917
|
+
(!config.patternBindingNodeTypes || config.patternBindingNodeTypes.has(node.type))) {
|
|
918
|
+
// Ensure scopeEnv exists for pattern binding reads/writes
|
|
919
|
+
if (!env.has(scope))
|
|
920
|
+
env.set(scope, new Map());
|
|
921
|
+
const scopeEnv = env.get(scope);
|
|
922
|
+
const patternBinding = config.extractPatternBinding(node, scopeEnv, declarationTypeNodes, scope);
|
|
923
|
+
if (patternBinding) {
|
|
924
|
+
if (patternBinding.narrowingRange) {
|
|
925
|
+
// Explicit narrowing range (null-check narrowing): always store in patternOverrides
|
|
926
|
+
// using the extractor-provided range (typically the if-body block).
|
|
927
|
+
if (!patternOverrides.has(scope))
|
|
928
|
+
patternOverrides.set(scope, new Map());
|
|
929
|
+
const varMap = patternOverrides.get(scope);
|
|
930
|
+
if (!varMap.has(patternBinding.varName))
|
|
931
|
+
varMap.set(patternBinding.varName, []);
|
|
932
|
+
varMap.get(patternBinding.varName).push({
|
|
933
|
+
rangeStart: patternBinding.narrowingRange.startIndex,
|
|
934
|
+
rangeEnd: patternBinding.narrowingRange.endIndex,
|
|
935
|
+
typeName: patternBinding.typeName,
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
else if (config.allowPatternBindingOverwrite) {
|
|
939
|
+
// Position-indexed: store per-branch binding for smart-cast narrowing.
|
|
940
|
+
// Each when arm / switch case gets its own type for the variable,
|
|
941
|
+
// preventing cross-arm contamination (e.g., Kotlin when/is).
|
|
942
|
+
const branchNode = findNarrowingBranchScope(node);
|
|
943
|
+
if (branchNode) {
|
|
944
|
+
if (!patternOverrides.has(scope))
|
|
945
|
+
patternOverrides.set(scope, new Map());
|
|
946
|
+
const varMap = patternOverrides.get(scope);
|
|
947
|
+
if (!varMap.has(patternBinding.varName))
|
|
948
|
+
varMap.set(patternBinding.varName, []);
|
|
949
|
+
varMap.get(patternBinding.varName).push({
|
|
950
|
+
rangeStart: branchNode.startIndex,
|
|
951
|
+
rangeEnd: branchNode.endIndex,
|
|
952
|
+
typeName: patternBinding.typeName,
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
// Also store in flat scopeEnv as fallback (last arm wins — same as before
|
|
956
|
+
// for code that doesn't use position-indexed lookup).
|
|
957
|
+
scopeEnv.set(patternBinding.varName, patternBinding.typeName);
|
|
958
|
+
}
|
|
959
|
+
else if (!scopeEnv.has(patternBinding.varName)) {
|
|
960
|
+
// First-writer-wins for languages without smart-cast overwrite (Java instanceof, etc.)
|
|
961
|
+
scopeEnv.set(patternBinding.varName, patternBinding.typeName);
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
// Tier 2: collect plain-identifier RHS assignments for post-walk propagation.
|
|
966
|
+
// Delegates to per-language extractPendingAssignment — AST shapes differ widely
|
|
967
|
+
// (JS uses variable_declarator/name/value, Rust uses let_declaration/pattern/value,
|
|
968
|
+
// Python uses assignment/left/right, Go uses short_var_declaration/expression_list).
|
|
969
|
+
// May return a single item or an array (for destructuring: N fieldAccess items).
|
|
970
|
+
if (config.extractPendingAssignment && config.declarationNodeTypes.has(node.type)) {
|
|
971
|
+
// scopeEnv is guaranteed to exist here because declarationNodeTypes is a subset
|
|
972
|
+
// of interestingNodeTypes, so extractTypeBinding already created the scope map above.
|
|
973
|
+
const scopeEnv = env.get(scope);
|
|
974
|
+
if (scopeEnv) {
|
|
975
|
+
const pending = config.extractPendingAssignment(node, scopeEnv);
|
|
976
|
+
if (pending) {
|
|
977
|
+
const items = Array.isArray(pending) ? pending : [pending];
|
|
978
|
+
for (const item of items) {
|
|
979
|
+
// Substitute this/self/$this/Me receivers with enclosing class name
|
|
980
|
+
const resolved = substituteThisReceiver(item, node);
|
|
981
|
+
pendingItems.push({ scope, ...resolved });
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
// Scan for constructor bindings that couldn't be resolved locally.
|
|
987
|
+
// Only collect if TypeEnv didn't already resolve this binding.
|
|
988
|
+
if (config.scanConstructorBinding) {
|
|
989
|
+
const result = config.scanConstructorBinding(node);
|
|
990
|
+
if (result) {
|
|
991
|
+
const scopeEnv = env.get(scope);
|
|
992
|
+
if (!scopeEnv?.has(result.varName)) {
|
|
993
|
+
bindings.push({ scope, ...result });
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
// Recurse into children
|
|
998
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
999
|
+
const child = node.child(i);
|
|
1000
|
+
if (child)
|
|
1001
|
+
walk(child, scope);
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
walk(tree.rootNode, FILE_SCOPE);
|
|
1005
|
+
// Phase 14: Seed cross-file bindings from upstream files AFTER walk
|
|
1006
|
+
// (local declarations from walk() take precedence — first-writer-wins)
|
|
1007
|
+
if (options?.importedBindings && options.importedBindings.size > 0) {
|
|
1008
|
+
seedImportedBindings(env, options.importedBindings);
|
|
1009
|
+
}
|
|
1010
|
+
resolveFixpointBindings(pendingItems, env, returnTypeLookup, symbolTable, parentMap);
|
|
1011
|
+
// Post-fixpoint for-loop replay (Phase 10 / ex-9B loop-fixpoint bridge):
|
|
1012
|
+
// For-loop nodes whose iterables were unresolved at walk-time may now be
|
|
1013
|
+
// resolvable because the fixpoint bound the iterable's type.
|
|
1014
|
+
// Example: `const users = getUsers(); for (const u of users) { u.save(); }`
|
|
1015
|
+
// - walk-time: users untyped → u unresolved
|
|
1016
|
+
// - fixpoint: users → User[]
|
|
1017
|
+
// - replay: users now typed → u → User
|
|
1018
|
+
if (pendingForLoops.length > 0 && config.extractForLoopBinding) {
|
|
1019
|
+
for (const { node, scope } of pendingForLoops) {
|
|
1020
|
+
if (!env.has(scope))
|
|
1021
|
+
env.set(scope, new Map());
|
|
1022
|
+
const scopeEnv = env.get(scope);
|
|
1023
|
+
config.extractForLoopBinding(node, {
|
|
1024
|
+
scopeEnv,
|
|
1025
|
+
declarationTypeNodes,
|
|
1026
|
+
scope,
|
|
1027
|
+
returnTypeLookup,
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
// Re-run the main fixpoint to resolve items that depended on loop variables.
|
|
1031
|
+
// Only needed if replay actually produced new bindings.
|
|
1032
|
+
const unresolvedBefore = pendingItems.filter((item) => {
|
|
1033
|
+
const scopeEnv = env.get(item.scope);
|
|
1034
|
+
return scopeEnv && !scopeEnv.has(item.lhs);
|
|
1035
|
+
});
|
|
1036
|
+
if (unresolvedBefore.length > 0) {
|
|
1037
|
+
resolveFixpointBindings(unresolvedBefore, env, returnTypeLookup, symbolTable);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
return {
|
|
1041
|
+
lookup: (varName, callNode) => lookupInEnv(env, varName, callNode, patternOverrides, options?.enclosingFunctionFinder, extractFuncNameHook),
|
|
1042
|
+
constructorBindings: bindings,
|
|
1043
|
+
fileScope: () => env.get(FILE_SCOPE) ?? EMPTY_FILE_SCOPE,
|
|
1044
|
+
allScopes: () => env,
|
|
1045
|
+
constructorTypeMap,
|
|
1046
|
+
};
|
|
1047
|
+
};
|
|
1048
|
+
//# sourceMappingURL=type-env.js.map
|