@tsonic/emitter 0.0.73 → 0.0.75
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/dist/.tsbuildinfo +1 -1
- package/dist/adapter-generator.d.ts.map +1 -1
- package/dist/adapter-generator.js +2 -1
- package/dist/adapter-generator.js.map +1 -1
- package/dist/array.test.js +277 -6
- package/dist/array.test.js.map +1 -1
- package/dist/constants.d.ts +3 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +15 -6
- package/dist/constants.js.map +1 -1
- package/dist/core/format/attributes.d.ts +3 -3
- package/dist/core/format/attributes.d.ts.map +1 -1
- package/dist/core/format/attributes.js +8 -59
- package/dist/core/format/attributes.js.map +1 -1
- package/dist/core/format/attributes.test.js +1 -1
- package/dist/core/format/attributes.test.js.map +1 -1
- package/dist/core/format/backend-ast/builders.d.ts +14 -0
- package/dist/core/format/backend-ast/builders.d.ts.map +1 -0
- package/dist/core/format/backend-ast/builders.js +191 -0
- package/dist/core/format/backend-ast/builders.js.map +1 -0
- package/dist/core/format/backend-ast/builders.test.d.ts +2 -0
- package/dist/core/format/backend-ast/builders.test.d.ts.map +1 -0
- package/dist/core/format/backend-ast/builders.test.js +258 -0
- package/dist/core/format/backend-ast/builders.test.js.map +1 -0
- package/dist/core/format/backend-ast/index.d.ts +3 -2
- package/dist/core/format/backend-ast/index.d.ts.map +1 -1
- package/dist/core/format/backend-ast/index.js +2 -1
- package/dist/core/format/backend-ast/index.js.map +1 -1
- package/dist/core/format/backend-ast/invariants.test.d.ts +2 -0
- package/dist/core/format/backend-ast/invariants.test.d.ts.map +1 -0
- package/dist/core/format/backend-ast/invariants.test.js +79 -0
- package/dist/core/format/backend-ast/invariants.test.js.map +1 -0
- package/dist/core/format/backend-ast/printer-cases/basic-and-declarations.test.d.ts +2 -0
- package/dist/core/format/backend-ast/printer-cases/basic-and-declarations.test.d.ts.map +1 -0
- package/dist/core/format/backend-ast/printer-cases/basic-and-declarations.test.js +226 -0
- package/dist/core/format/backend-ast/printer-cases/basic-and-declarations.test.js.map +1 -0
- package/dist/core/format/backend-ast/printer-cases/control-flow-and-switch.test.d.ts +2 -0
- package/dist/core/format/backend-ast/printer-cases/control-flow-and-switch.test.d.ts.map +1 -0
- package/dist/core/format/backend-ast/printer-cases/control-flow-and-switch.test.js +289 -0
- package/dist/core/format/backend-ast/printer-cases/control-flow-and-switch.test.js.map +1 -0
- package/dist/core/format/backend-ast/printer-cases/helpers.d.ts +6 -0
- package/dist/core/format/backend-ast/printer-cases/helpers.d.ts.map +1 -0
- package/dist/core/format/backend-ast/printer-cases/helpers.js +5 -0
- package/dist/core/format/backend-ast/printer-cases/helpers.js.map +1 -0
- package/dist/core/format/backend-ast/printer-cases/identifiers-and-interpolation.test.d.ts +2 -0
- package/dist/core/format/backend-ast/printer-cases/identifiers-and-interpolation.test.d.ts.map +1 -0
- package/dist/core/format/backend-ast/printer-cases/identifiers-and-interpolation.test.js +211 -0
- package/dist/core/format/backend-ast/printer-cases/identifiers-and-interpolation.test.js.map +1 -0
- package/dist/core/format/backend-ast/printer-cases/remaining-nodes.test.d.ts +2 -0
- package/dist/core/format/backend-ast/printer-cases/remaining-nodes.test.d.ts.map +1 -0
- package/dist/core/format/backend-ast/printer-cases/remaining-nodes.test.js +186 -0
- package/dist/core/format/backend-ast/printer-cases/remaining-nodes.test.js.map +1 -0
- package/dist/core/format/backend-ast/printer-colon-detection.d.ts +14 -0
- package/dist/core/format/backend-ast/printer-colon-detection.d.ts.map +1 -0
- package/dist/core/format/backend-ast/printer-colon-detection.js +141 -0
- package/dist/core/format/backend-ast/printer-colon-detection.js.map +1 -0
- package/dist/core/format/backend-ast/printer-declarations.d.ts +12 -0
- package/dist/core/format/backend-ast/printer-declarations.d.ts.map +1 -0
- package/dist/core/format/backend-ast/printer-declarations.js +212 -0
- package/dist/core/format/backend-ast/printer-declarations.js.map +1 -0
- package/dist/core/format/backend-ast/printer-expressions.d.ts +12 -0
- package/dist/core/format/backend-ast/printer-expressions.d.ts.map +1 -0
- package/dist/core/format/backend-ast/printer-expressions.js +363 -0
- package/dist/core/format/backend-ast/printer-expressions.js.map +1 -0
- package/dist/core/format/backend-ast/printer-identifiers.d.ts +31 -0
- package/dist/core/format/backend-ast/printer-identifiers.d.ts.map +1 -0
- package/dist/core/format/backend-ast/printer-identifiers.js +194 -0
- package/dist/core/format/backend-ast/printer-identifiers.js.map +1 -0
- package/dist/core/format/backend-ast/printer-precedence.d.ts +23 -0
- package/dist/core/format/backend-ast/printer-precedence.d.ts.map +1 -0
- package/dist/core/format/backend-ast/printer-precedence.js +225 -0
- package/dist/core/format/backend-ast/printer-precedence.js.map +1 -0
- package/dist/core/format/backend-ast/printer-shared.d.ts +12 -0
- package/dist/core/format/backend-ast/printer-shared.d.ts.map +1 -0
- package/dist/core/format/backend-ast/printer-shared.js +12 -0
- package/dist/core/format/backend-ast/printer-shared.js.map +1 -0
- package/dist/core/format/backend-ast/printer-statements.d.ts +24 -0
- package/dist/core/format/backend-ast/printer-statements.d.ts.map +1 -0
- package/dist/core/format/backend-ast/printer-statements.js +336 -0
- package/dist/core/format/backend-ast/printer-statements.js.map +1 -0
- package/dist/core/format/backend-ast/printer.d.ts +10 -23
- package/dist/core/format/backend-ast/printer.d.ts.map +1 -1
- package/dist/core/format/backend-ast/printer.js +11 -1146
- package/dist/core/format/backend-ast/printer.js.map +1 -1
- package/dist/core/format/backend-ast/printer.test.d.ts +5 -0
- package/dist/core/format/backend-ast/printer.test.d.ts.map +1 -0
- package/dist/core/format/backend-ast/printer.test.js +5 -0
- package/dist/core/format/backend-ast/printer.test.js.map +1 -0
- package/dist/core/format/backend-ast/types/compilation-unit-ast.d.ts +26 -0
- package/dist/core/format/backend-ast/types/compilation-unit-ast.d.ts.map +1 -0
- package/dist/core/format/backend-ast/types/compilation-unit-ast.js +2 -0
- package/dist/core/format/backend-ast/types/compilation-unit-ast.js.map +1 -0
- package/dist/core/format/backend-ast/types/declaration-ast.d.ts +105 -0
- package/dist/core/format/backend-ast/types/declaration-ast.d.ts.map +1 -0
- package/dist/core/format/backend-ast/types/declaration-ast.js +2 -0
- package/dist/core/format/backend-ast/types/declaration-ast.js.map +1 -0
- package/dist/core/format/backend-ast/types/expression-ast.d.ts +219 -0
- package/dist/core/format/backend-ast/types/expression-ast.d.ts.map +1 -0
- package/dist/core/format/backend-ast/types/expression-ast.js +2 -0
- package/dist/core/format/backend-ast/types/expression-ast.js.map +1 -0
- package/dist/core/format/backend-ast/types/pattern-ast.d.ts +28 -0
- package/dist/core/format/backend-ast/types/pattern-ast.d.ts.map +1 -0
- package/dist/core/format/backend-ast/types/pattern-ast.js +2 -0
- package/dist/core/format/backend-ast/types/pattern-ast.js.map +1 -0
- package/dist/core/format/backend-ast/types/signature-ast.d.ts +34 -0
- package/dist/core/format/backend-ast/types/signature-ast.d.ts.map +1 -0
- package/dist/core/format/backend-ast/types/signature-ast.js +2 -0
- package/dist/core/format/backend-ast/types/signature-ast.js.map +1 -0
- package/dist/core/format/backend-ast/types/statement-ast.d.ts +118 -0
- package/dist/core/format/backend-ast/types/statement-ast.d.ts.map +1 -0
- package/dist/core/format/backend-ast/types/statement-ast.js +2 -0
- package/dist/core/format/backend-ast/types/statement-ast.js.map +1 -0
- package/dist/core/format/backend-ast/types/type-ast.d.ts +50 -0
- package/dist/core/format/backend-ast/types/type-ast.d.ts.map +1 -0
- package/dist/core/format/backend-ast/types/type-ast.js +2 -0
- package/dist/core/format/backend-ast/types/type-ast.js.map +1 -0
- package/dist/core/format/backend-ast/types.d.ts +7 -497
- package/dist/core/format/backend-ast/types.d.ts.map +1 -1
- package/dist/core/format/backend-ast/types.js +7 -1
- package/dist/core/format/backend-ast/types.js.map +1 -1
- package/dist/core/format/backend-ast/utils.d.ts +16 -8
- package/dist/core/format/backend-ast/utils.d.ts.map +1 -1
- package/dist/core/format/backend-ast/utils.js +295 -21
- package/dist/core/format/backend-ast/utils.js.map +1 -1
- package/dist/core/format/backend-ast/utils.test.d.ts +2 -0
- package/dist/core/format/backend-ast/utils.test.d.ts.map +1 -0
- package/dist/core/format/backend-ast/utils.test.js +205 -0
- package/dist/core/format/backend-ast/utils.test.js.map +1 -0
- package/dist/core/format/local-names.d.ts +26 -0
- package/dist/core/format/local-names.d.ts.map +1 -1
- package/dist/core/format/local-names.js +59 -0
- package/dist/core/format/local-names.js.map +1 -1
- package/dist/core/format/local-names.test.d.ts +12 -0
- package/dist/core/format/local-names.test.d.ts.map +1 -0
- package/dist/core/format/local-names.test.js +278 -0
- package/dist/core/format/local-names.test.js.map +1 -0
- package/dist/core/format/module-emitter/assembly.d.ts +2 -2
- package/dist/core/format/module-emitter/assembly.d.ts.map +1 -1
- package/dist/core/format/module-emitter/assembly.js +7 -3
- package/dist/core/format/module-emitter/assembly.js.map +1 -1
- package/dist/core/format/module-emitter/header.d.ts +2 -1
- package/dist/core/format/module-emitter/header.d.ts.map +1 -1
- package/dist/core/format/module-emitter/header.js +2 -2
- package/dist/core/format/module-emitter/header.js.map +1 -1
- package/dist/core/format/module-emitter/orchestrator.d.ts.map +1 -1
- package/dist/core/format/module-emitter/orchestrator.js +2 -153
- package/dist/core/format/module-emitter/orchestrator.js.map +1 -1
- package/dist/core/format/module-emitter/static-container.d.ts.map +1 -1
- package/dist/core/format/module-emitter/static-container.js +20 -6
- package/dist/core/format/module-emitter/static-container.js.map +1 -1
- package/dist/core/module-emitter-cases/class-and-recursion.test.d.ts +6 -0
- package/dist/core/module-emitter-cases/class-and-recursion.test.d.ts.map +1 -0
- package/dist/core/module-emitter-cases/class-and-recursion.test.js +263 -0
- package/dist/core/module-emitter-cases/class-and-recursion.test.js.map +1 -0
- package/dist/core/module-emitter-cases/static-containers.test.d.ts +6 -0
- package/dist/core/module-emitter-cases/static-containers.test.d.ts.map +1 -0
- package/dist/core/module-emitter-cases/static-containers.test.js +275 -0
- package/dist/core/module-emitter-cases/static-containers.test.js.map +1 -0
- package/dist/core/module-emitter.test.d.ts +2 -5
- package/dist/core/module-emitter.test.d.ts.map +1 -1
- package/dist/core/module-emitter.test.js +2 -402
- package/dist/core/module-emitter.test.js.map +1 -1
- package/dist/core/semantic/array-expected-types.d.ts +6 -0
- package/dist/core/semantic/array-expected-types.d.ts.map +1 -0
- package/dist/core/semantic/array-expected-types.js +84 -0
- package/dist/core/semantic/array-expected-types.js.map +1 -0
- package/dist/core/semantic/array-expected-types.test.d.ts +2 -0
- package/dist/core/semantic/array-expected-types.test.d.ts.map +1 -0
- package/dist/core/semantic/array-expected-types.test.js +66 -0
- package/dist/core/semantic/array-expected-types.test.js.map +1 -0
- package/dist/core/semantic/assignment-flow.d.ts +9 -0
- package/dist/core/semantic/assignment-flow.d.ts.map +1 -0
- package/dist/core/semantic/assignment-flow.js +161 -0
- package/dist/core/semantic/assignment-flow.js.map +1 -0
- package/dist/core/semantic/async-wrapper-types.d.ts +6 -0
- package/dist/core/semantic/async-wrapper-types.d.ts.map +1 -0
- package/dist/core/semantic/async-wrapper-types.js +65 -0
- package/dist/core/semantic/async-wrapper-types.js.map +1 -0
- package/dist/core/semantic/boolean-condition-emission.d.ts +9 -0
- package/dist/core/semantic/boolean-condition-emission.d.ts.map +1 -0
- package/dist/core/semantic/boolean-condition-emission.js +9 -0
- package/dist/core/semantic/boolean-condition-emission.js.map +1 -0
- package/dist/core/semantic/boolean-condition-main.d.ts +38 -0
- package/dist/core/semantic/boolean-condition-main.d.ts.map +1 -0
- package/dist/core/semantic/boolean-condition-main.js +235 -0
- package/dist/core/semantic/boolean-condition-main.js.map +1 -0
- package/dist/core/semantic/boolean-condition-union.d.ts +20 -0
- package/dist/core/semantic/boolean-condition-union.d.ts.map +1 -0
- package/dist/core/semantic/boolean-condition-union.js +238 -0
- package/dist/core/semantic/boolean-condition-union.js.map +1 -0
- package/dist/core/semantic/boolean-context.d.ts +6 -40
- package/dist/core/semantic/boolean-context.d.ts.map +1 -1
- package/dist/core/semantic/boolean-context.js +6 -713
- package/dist/core/semantic/boolean-context.js.map +1 -1
- package/dist/core/semantic/boolean-context.test.js +22 -2
- package/dist/core/semantic/boolean-context.test.js.map +1 -1
- package/dist/core/semantic/broad-array-storage.d.ts +11 -0
- package/dist/core/semantic/broad-array-storage.d.ts.map +1 -0
- package/dist/core/semantic/broad-array-storage.js +111 -0
- package/dist/core/semantic/broad-array-storage.js.map +1 -0
- package/dist/core/semantic/broad-object-types.d.ts +7 -0
- package/dist/core/semantic/broad-object-types.d.ts.map +1 -0
- package/dist/core/semantic/broad-object-types.js +60 -0
- package/dist/core/semantic/broad-object-types.js.map +1 -0
- package/dist/core/semantic/clr-type-identity.d.ts +21 -0
- package/dist/core/semantic/clr-type-identity.d.ts.map +1 -0
- package/dist/core/semantic/clr-type-identity.js +230 -0
- package/dist/core/semantic/clr-type-identity.js.map +1 -0
- package/dist/core/semantic/comparable-types.d.ts +5 -0
- package/dist/core/semantic/comparable-types.d.ts.map +1 -0
- package/dist/core/semantic/comparable-types.js +108 -0
- package/dist/core/semantic/comparable-types.js.map +1 -0
- package/dist/core/semantic/comparable-types.test.d.ts +2 -0
- package/dist/core/semantic/comparable-types.test.d.ts.map +1 -0
- package/dist/core/semantic/comparable-types.test.js +199 -0
- package/dist/core/semantic/comparable-types.test.js.map +1 -0
- package/dist/core/semantic/condition-branch-narrowing.d.ts +6 -0
- package/dist/core/semantic/condition-branch-narrowing.d.ts.map +1 -0
- package/dist/core/semantic/condition-branch-narrowing.js +50 -0
- package/dist/core/semantic/condition-branch-narrowing.js.map +1 -0
- package/dist/core/semantic/defaults.d.ts +7 -0
- package/dist/core/semantic/defaults.d.ts.map +1 -0
- package/dist/core/semantic/defaults.js +61 -0
- package/dist/core/semantic/defaults.js.map +1 -0
- package/dist/core/semantic/defaults.test.d.ts +2 -0
- package/dist/core/semantic/defaults.test.d.ts.map +1 -0
- package/dist/core/semantic/defaults.test.js +88 -0
- package/dist/core/semantic/defaults.test.js.map +1 -0
- package/dist/core/semantic/deterministic-type-keys.d.ts +8 -0
- package/dist/core/semantic/deterministic-type-keys.d.ts.map +1 -0
- package/dist/core/semantic/deterministic-type-keys.js +277 -0
- package/dist/core/semantic/deterministic-type-keys.js.map +1 -0
- package/dist/core/semantic/direct-storage-ir-types.d.ts +12 -0
- package/dist/core/semantic/direct-storage-ir-types.d.ts.map +1 -0
- package/dist/core/semantic/direct-storage-ir-types.js +189 -0
- package/dist/core/semantic/direct-storage-ir-types.js.map +1 -0
- package/dist/core/semantic/direct-value-surfaces.d.ts +9 -0
- package/dist/core/semantic/direct-value-surfaces.d.ts.map +1 -0
- package/dist/core/semantic/direct-value-surfaces.js +181 -0
- package/dist/core/semantic/direct-value-surfaces.js.map +1 -0
- package/dist/core/semantic/direct-value-surfaces.test.d.ts +2 -0
- package/dist/core/semantic/direct-value-surfaces.test.d.ts.map +1 -0
- package/dist/core/semantic/direct-value-surfaces.test.js +116 -0
- package/dist/core/semantic/direct-value-surfaces.test.js.map +1 -0
- package/dist/core/semantic/expected-type-matching.d.ts +7 -0
- package/dist/core/semantic/expected-type-matching.d.ts.map +1 -0
- package/dist/core/semantic/expected-type-matching.js +101 -0
- package/dist/core/semantic/expected-type-matching.js.map +1 -0
- package/dist/core/semantic/guard-primitives.d.ts +29 -0
- package/dist/core/semantic/guard-primitives.d.ts.map +1 -0
- package/dist/core/semantic/guard-primitives.js +80 -0
- package/dist/core/semantic/guard-primitives.js.map +1 -0
- package/dist/core/semantic/implicit-interfaces.d.ts +34 -0
- package/dist/core/semantic/implicit-interfaces.d.ts.map +1 -0
- package/dist/core/semantic/implicit-interfaces.js +276 -0
- package/dist/core/semantic/implicit-interfaces.js.map +1 -0
- package/dist/core/semantic/implicit-interfaces.test.d.ts +2 -0
- package/dist/core/semantic/implicit-interfaces.test.d.ts.map +1 -0
- package/dist/core/semantic/implicit-interfaces.test.js +280 -0
- package/dist/core/semantic/implicit-interfaces.test.js.map +1 -0
- package/dist/core/semantic/imports-cases/basic-and-local.test.d.ts +6 -0
- package/dist/core/semantic/imports-cases/basic-and-local.test.d.ts.map +1 -0
- package/dist/core/semantic/imports-cases/basic-and-local.test.js +504 -0
- package/dist/core/semantic/imports-cases/basic-and-local.test.js.map +1 -0
- package/dist/core/semantic/imports-cases/bindings-and-namespaces.test.d.ts +6 -0
- package/dist/core/semantic/imports-cases/bindings-and-namespaces.test.d.ts.map +1 -0
- package/dist/core/semantic/imports-cases/bindings-and-namespaces.test.js +932 -0
- package/dist/core/semantic/imports-cases/bindings-and-namespaces.test.js.map +1 -0
- package/dist/core/semantic/imports.d.ts.map +1 -1
- package/dist/core/semantic/imports.js +174 -37
- package/dist/core/semantic/imports.js.map +1 -1
- package/dist/core/semantic/imports.test.d.ts +2 -5
- package/dist/core/semantic/imports.test.d.ts.map +1 -1
- package/dist/core/semantic/imports.test.js +2 -551
- package/dist/core/semantic/imports.test.js.map +1 -1
- package/dist/core/semantic/instanceof-predicate-refinements.d.ts +10 -0
- package/dist/core/semantic/instanceof-predicate-refinements.d.ts.map +1 -0
- package/dist/core/semantic/instanceof-predicate-refinements.js +189 -0
- package/dist/core/semantic/instanceof-predicate-refinements.js.map +1 -0
- package/dist/core/semantic/instanceof-targets.d.ts +10 -0
- package/dist/core/semantic/instanceof-targets.d.ts.map +1 -0
- package/dist/core/semantic/instanceof-targets.js +20 -0
- package/dist/core/semantic/instanceof-targets.js.map +1 -0
- package/dist/core/semantic/iteration-types.d.ts +11 -0
- package/dist/core/semantic/iteration-types.d.ts.map +1 -0
- package/dist/core/semantic/iteration-types.js +116 -0
- package/dist/core/semantic/iteration-types.js.map +1 -0
- package/dist/core/semantic/js-value-types.d.ts +5 -0
- package/dist/core/semantic/js-value-types.d.ts.map +1 -0
- package/dist/core/semantic/js-value-types.js +42 -0
- package/dist/core/semantic/js-value-types.js.map +1 -0
- package/dist/core/semantic/local-type-lookup.d.ts +8 -0
- package/dist/core/semantic/local-type-lookup.d.ts.map +1 -0
- package/dist/core/semantic/local-type-lookup.js +36 -0
- package/dist/core/semantic/local-type-lookup.js.map +1 -0
- package/dist/core/semantic/local-types.d.ts +1 -0
- package/dist/core/semantic/local-types.d.ts.map +1 -1
- package/dist/core/semantic/local-types.js +269 -0
- package/dist/core/semantic/local-types.js.map +1 -1
- package/dist/core/semantic/materialized-narrowing.d.ts +5 -0
- package/dist/core/semantic/materialized-narrowing.d.ts.map +1 -0
- package/dist/core/semantic/materialized-narrowing.js +361 -0
- package/dist/core/semantic/materialized-narrowing.js.map +1 -0
- package/dist/core/semantic/materialized-narrowing.test.d.ts +2 -0
- package/dist/core/semantic/materialized-narrowing.test.d.ts.map +1 -0
- package/dist/core/semantic/materialized-narrowing.test.js +321 -0
- package/dist/core/semantic/materialized-narrowing.test.js.map +1 -0
- package/dist/core/semantic/member-surfaces.d.ts +10 -0
- package/dist/core/semantic/member-surfaces.d.ts.map +1 -0
- package/dist/core/semantic/member-surfaces.js +108 -0
- package/dist/core/semantic/member-surfaces.js.map +1 -0
- package/dist/core/semantic/member-surfaces.test.d.ts +2 -0
- package/dist/core/semantic/member-surfaces.test.d.ts.map +1 -0
- package/dist/core/semantic/member-surfaces.test.js +105 -0
- package/dist/core/semantic/member-surfaces.test.js.map +1 -0
- package/dist/core/semantic/module-map.d.ts.map +1 -1
- package/dist/core/semantic/module-map.js +92 -2
- package/dist/core/semantic/module-map.js.map +1 -1
- package/dist/core/semantic/module-map.test.js +264 -0
- package/dist/core/semantic/module-map.test.js.map +1 -1
- package/dist/core/semantic/mutable-storage-detection.d.ts +10 -0
- package/dist/core/semantic/mutable-storage-detection.d.ts.map +1 -0
- package/dist/core/semantic/mutable-storage-detection.js +10 -0
- package/dist/core/semantic/mutable-storage-detection.js.map +1 -0
- package/dist/core/semantic/mutable-storage-expression-visitor.d.ts +12 -0
- package/dist/core/semantic/mutable-storage-expression-visitor.d.ts.map +1 -0
- package/dist/core/semantic/mutable-storage-expression-visitor.js +126 -0
- package/dist/core/semantic/mutable-storage-expression-visitor.js.map +1 -0
- package/dist/core/semantic/mutable-storage-helpers.d.ts +26 -0
- package/dist/core/semantic/mutable-storage-helpers.d.ts.map +1 -0
- package/dist/core/semantic/mutable-storage-helpers.js +203 -0
- package/dist/core/semantic/mutable-storage-helpers.js.map +1 -0
- package/dist/core/semantic/mutable-storage-statement-visitor.d.ts +5 -0
- package/dist/core/semantic/mutable-storage-statement-visitor.d.ts.map +1 -0
- package/dist/core/semantic/mutable-storage-statement-visitor.js +158 -0
- package/dist/core/semantic/mutable-storage-statement-visitor.js.map +1 -0
- package/dist/core/semantic/mutable-storage-visitors.d.ts +5 -0
- package/dist/core/semantic/mutable-storage-visitors.d.ts.map +1 -0
- package/dist/core/semantic/mutable-storage-visitors.js +17 -0
- package/dist/core/semantic/mutable-storage-visitors.js.map +1 -0
- package/dist/core/semantic/mutable-storage.d.ts +2 -9
- package/dist/core/semantic/mutable-storage.d.ts.map +1 -1
- package/dist/core/semantic/mutable-storage.js +2 -478
- package/dist/core/semantic/mutable-storage.js.map +1 -1
- package/dist/core/semantic/narrowed-expression-types.d.ts +7 -0
- package/dist/core/semantic/narrowed-expression-types.d.ts.map +1 -0
- package/dist/core/semantic/narrowed-expression-types.js +287 -0
- package/dist/core/semantic/narrowed-expression-types.js.map +1 -0
- package/dist/core/semantic/narrowed-expression-types.test.d.ts +2 -0
- package/dist/core/semantic/narrowed-expression-types.test.d.ts.map +1 -0
- package/dist/core/semantic/narrowed-expression-types.test.js +296 -0
- package/dist/core/semantic/narrowed-expression-types.test.js.map +1 -0
- package/dist/core/semantic/narrowed-union-resolution.d.ts +42 -0
- package/dist/core/semantic/narrowed-union-resolution.d.ts.map +1 -0
- package/dist/core/semantic/narrowed-union-resolution.js +162 -0
- package/dist/core/semantic/narrowed-union-resolution.js.map +1 -0
- package/dist/core/semantic/narrowing-builder-core.d.ts +46 -0
- package/dist/core/semantic/narrowing-builder-core.d.ts.map +1 -0
- package/dist/core/semantic/narrowing-builder-core.js +332 -0
- package/dist/core/semantic/narrowing-builder-core.js.map +1 -0
- package/dist/core/semantic/narrowing-builder-core.test.d.ts +2 -0
- package/dist/core/semantic/narrowing-builder-core.test.d.ts.map +1 -0
- package/dist/core/semantic/narrowing-builder-core.test.js +49 -0
- package/dist/core/semantic/narrowing-builder-core.test.js.map +1 -0
- package/dist/core/semantic/narrowing-builder-unions.d.ts +18 -0
- package/dist/core/semantic/narrowing-builder-unions.d.ts.map +1 -0
- package/dist/core/semantic/narrowing-builder-unions.js +336 -0
- package/dist/core/semantic/narrowing-builder-unions.js.map +1 -0
- package/dist/core/semantic/narrowing-builders.d.ts +10 -0
- package/dist/core/semantic/narrowing-builders.d.ts.map +1 -0
- package/dist/core/semantic/narrowing-builders.js +10 -0
- package/dist/core/semantic/narrowing-builders.js.map +1 -0
- package/dist/core/semantic/narrowing-keys.d.ts +6 -0
- package/dist/core/semantic/narrowing-keys.d.ts.map +1 -0
- package/dist/core/semantic/narrowing-keys.js +27 -0
- package/dist/core/semantic/narrowing-keys.js.map +1 -0
- package/dist/core/semantic/narrowing-refinements.d.ts +10 -0
- package/dist/core/semantic/narrowing-refinements.d.ts.map +1 -0
- package/dist/core/semantic/narrowing-refinements.js +10 -0
- package/dist/core/semantic/narrowing-refinements.js.map +1 -0
- package/dist/core/semantic/nullable-typeof-refinements.d.ts +13 -0
- package/dist/core/semantic/nullable-typeof-refinements.d.ts.map +1 -0
- package/dist/core/semantic/nullable-typeof-refinements.js +408 -0
- package/dist/core/semantic/nullable-typeof-refinements.js.map +1 -0
- package/dist/core/semantic/nullish-value-helpers.d.ts +64 -0
- package/dist/core/semantic/nullish-value-helpers.d.ts.map +1 -0
- package/dist/core/semantic/nullish-value-helpers.js +346 -0
- package/dist/core/semantic/nullish-value-helpers.js.map +1 -0
- package/dist/core/semantic/parameter-modifier-types.d.ts +3 -0
- package/dist/core/semantic/parameter-modifier-types.d.ts.map +1 -0
- package/dist/core/semantic/parameter-modifier-types.js +17 -0
- package/dist/core/semantic/parameter-modifier-types.js.map +1 -0
- package/dist/core/semantic/pattern-types.d.ts +59 -0
- package/dist/core/semantic/pattern-types.d.ts.map +1 -0
- package/dist/core/semantic/pattern-types.js +92 -0
- package/dist/core/semantic/pattern-types.js.map +1 -0
- package/dist/core/semantic/property-lookup-membership.d.ts +30 -0
- package/dist/core/semantic/property-lookup-membership.d.ts.map +1 -0
- package/dist/core/semantic/property-lookup-membership.js +176 -0
- package/dist/core/semantic/property-lookup-membership.js.map +1 -0
- package/dist/core/semantic/property-lookup-resolution.d.ts +52 -0
- package/dist/core/semantic/property-lookup-resolution.d.ts.map +1 -0
- package/dist/core/semantic/property-lookup-resolution.js +275 -0
- package/dist/core/semantic/property-lookup-resolution.js.map +1 -0
- package/dist/core/semantic/property-member-lookup.d.ts +10 -0
- package/dist/core/semantic/property-member-lookup.d.ts.map +1 -0
- package/dist/core/semantic/property-member-lookup.js +10 -0
- package/dist/core/semantic/property-member-lookup.js.map +1 -0
- package/dist/core/semantic/reference-type-identity.d.ts +10 -0
- package/dist/core/semantic/reference-type-identity.d.ts.map +1 -0
- package/dist/core/semantic/reference-type-identity.js +28 -0
- package/dist/core/semantic/reference-type-identity.js.map +1 -0
- package/dist/core/semantic/runtime-call-arities.d.ts +4 -0
- package/dist/core/semantic/runtime-call-arities.d.ts.map +1 -0
- package/dist/core/semantic/runtime-call-arities.js +104 -0
- package/dist/core/semantic/runtime-call-arities.js.map +1 -0
- package/dist/core/semantic/runtime-materialization-targets.d.ts +4 -0
- package/dist/core/semantic/runtime-materialization-targets.d.ts.map +1 -0
- package/dist/core/semantic/runtime-materialization-targets.js +69 -0
- package/dist/core/semantic/runtime-materialization-targets.js.map +1 -0
- package/dist/core/semantic/runtime-reification-helpers.d.ts +9 -0
- package/dist/core/semantic/runtime-reification-helpers.d.ts.map +1 -0
- package/dist/core/semantic/runtime-reification-helpers.js +99 -0
- package/dist/core/semantic/runtime-reification-helpers.js.map +1 -0
- package/dist/core/semantic/runtime-reification.d.ts +16 -0
- package/dist/core/semantic/runtime-reification.d.ts.map +1 -0
- package/dist/core/semantic/runtime-reification.js +609 -0
- package/dist/core/semantic/runtime-reification.js.map +1 -0
- package/dist/core/semantic/runtime-union-alias-identity.d.ts +5 -0
- package/dist/core/semantic/runtime-union-alias-identity.d.ts.map +1 -0
- package/dist/core/semantic/runtime-union-alias-identity.js +27 -0
- package/dist/core/semantic/runtime-union-alias-identity.js.map +1 -0
- package/dist/core/semantic/runtime-union-expansion.d.ts +5 -0
- package/dist/core/semantic/runtime-union-expansion.d.ts.map +1 -0
- package/dist/core/semantic/runtime-union-expansion.js +190 -0
- package/dist/core/semantic/runtime-union-expansion.js.map +1 -0
- package/dist/core/semantic/runtime-union-family-preservation.d.ts +5 -0
- package/dist/core/semantic/runtime-union-family-preservation.d.ts.map +1 -0
- package/dist/core/semantic/runtime-union-family-preservation.js +34 -0
- package/dist/core/semantic/runtime-union-family-preservation.js.map +1 -0
- package/dist/core/semantic/runtime-union-matching.d.ts +9 -0
- package/dist/core/semantic/runtime-union-matching.d.ts.map +1 -0
- package/dist/core/semantic/runtime-union-matching.js +121 -0
- package/dist/core/semantic/runtime-union-matching.js.map +1 -0
- package/dist/core/semantic/runtime-union-member-mapping.d.ts +12 -0
- package/dist/core/semantic/runtime-union-member-mapping.d.ts.map +1 -0
- package/dist/core/semantic/runtime-union-member-mapping.js +25 -0
- package/dist/core/semantic/runtime-union-member-mapping.js.map +1 -0
- package/dist/core/semantic/runtime-union-member-mapping.test.d.ts +2 -0
- package/dist/core/semantic/runtime-union-member-mapping.test.d.ts.map +1 -0
- package/dist/core/semantic/runtime-union-member-mapping.test.js +54 -0
- package/dist/core/semantic/runtime-union-member-mapping.test.js.map +1 -0
- package/dist/core/semantic/runtime-union-ordering.d.ts +4 -0
- package/dist/core/semantic/runtime-union-ordering.d.ts.map +1 -0
- package/dist/core/semantic/runtime-union-ordering.js +114 -0
- package/dist/core/semantic/runtime-union-ordering.js.map +1 -0
- package/dist/core/semantic/runtime-union-projection.d.ts +40 -0
- package/dist/core/semantic/runtime-union-projection.d.ts.map +1 -0
- package/dist/core/semantic/runtime-union-projection.js +150 -0
- package/dist/core/semantic/runtime-union-projection.js.map +1 -0
- package/dist/core/semantic/runtime-union-projection.test.d.ts +2 -0
- package/dist/core/semantic/runtime-union-projection.test.d.ts.map +1 -0
- package/dist/core/semantic/runtime-union-projection.test.js +211 -0
- package/dist/core/semantic/runtime-union-projection.test.js.map +1 -0
- package/dist/core/semantic/runtime-union-registry.d.ts +28 -0
- package/dist/core/semantic/runtime-union-registry.d.ts.map +1 -0
- package/dist/core/semantic/runtime-union-registry.js +301 -0
- package/dist/core/semantic/runtime-union-registry.js.map +1 -0
- package/dist/core/semantic/runtime-union-shared.d.ts +23 -0
- package/dist/core/semantic/runtime-union-shared.d.ts.map +1 -0
- package/dist/core/semantic/runtime-union-shared.js +29 -0
- package/dist/core/semantic/runtime-union-shared.js.map +1 -0
- package/dist/core/semantic/runtime-unions.d.ts +14 -0
- package/dist/core/semantic/runtime-unions.d.ts.map +1 -0
- package/dist/core/semantic/runtime-unions.js +330 -0
- package/dist/core/semantic/runtime-unions.js.map +1 -0
- package/dist/core/semantic/runtime-unions.test.d.ts +2 -0
- package/dist/core/semantic/runtime-unions.test.d.ts.map +1 -0
- package/dist/core/semantic/runtime-unions.test.js +922 -0
- package/dist/core/semantic/runtime-unions.test.js.map +1 -0
- package/dist/core/semantic/semantic-union-members.d.ts +46 -0
- package/dist/core/semantic/semantic-union-members.d.ts.map +1 -0
- package/dist/core/semantic/semantic-union-members.js +144 -0
- package/dist/core/semantic/semantic-union-members.js.map +1 -0
- package/dist/core/semantic/storage-erased-adaptation.d.ts +14 -0
- package/dist/core/semantic/storage-erased-adaptation.d.ts.map +1 -0
- package/dist/core/semantic/storage-erased-adaptation.js +191 -0
- package/dist/core/semantic/storage-erased-adaptation.js.map +1 -0
- package/dist/core/semantic/storage-erased-adaptation.test.d.ts +2 -0
- package/dist/core/semantic/storage-erased-adaptation.test.d.ts.map +1 -0
- package/dist/core/semantic/storage-erased-adaptation.test.js +271 -0
- package/dist/core/semantic/storage-erased-adaptation.test.js.map +1 -0
- package/dist/core/semantic/storage-types.d.ts +8 -0
- package/dist/core/semantic/storage-types.d.ts.map +1 -0
- package/dist/core/semantic/storage-types.js +344 -0
- package/dist/core/semantic/storage-types.js.map +1 -0
- package/dist/core/semantic/storage-types.test.d.ts +2 -0
- package/dist/core/semantic/storage-types.test.d.ts.map +1 -0
- package/dist/core/semantic/storage-types.test.js +438 -0
- package/dist/core/semantic/storage-types.test.js.map +1 -0
- package/dist/core/semantic/structural-resolution.d.ts +11 -0
- package/dist/core/semantic/structural-resolution.d.ts.map +1 -0
- package/dist/core/semantic/structural-resolution.js +11 -0
- package/dist/core/semantic/structural-resolution.js.map +1 -0
- package/dist/core/semantic/structural-shape-matching.d.ts +22 -0
- package/dist/core/semantic/structural-shape-matching.d.ts.map +1 -0
- package/dist/core/semantic/structural-shape-matching.js +255 -0
- package/dist/core/semantic/structural-shape-matching.js.map +1 -0
- package/dist/core/semantic/structural-view-types.d.ts +10 -0
- package/dist/core/semantic/structural-view-types.d.ts.map +1 -0
- package/dist/core/semantic/structural-view-types.js +46 -0
- package/dist/core/semantic/structural-view-types.js.map +1 -0
- package/dist/core/semantic/symbol-types.d.ts +80 -0
- package/dist/core/semantic/symbol-types.d.ts.map +1 -0
- package/dist/core/semantic/symbol-types.js +102 -0
- package/dist/core/semantic/symbol-types.js.map +1 -0
- package/dist/core/semantic/ternary-guards.d.ts +43 -0
- package/dist/core/semantic/ternary-guards.d.ts.map +1 -0
- package/dist/core/semantic/ternary-guards.js +232 -0
- package/dist/core/semantic/ternary-guards.js.map +1 -0
- package/dist/core/semantic/transparent-expressions.d.ts +6 -0
- package/dist/core/semantic/transparent-expressions.d.ts.map +1 -0
- package/dist/core/semantic/transparent-expressions.js +18 -0
- package/dist/core/semantic/transparent-expressions.js.map +1 -0
- package/dist/core/semantic/truthiness-evaluation.d.ts +58 -0
- package/dist/core/semantic/truthiness-evaluation.d.ts.map +1 -0
- package/dist/core/semantic/truthiness-evaluation.js +295 -0
- package/dist/core/semantic/truthiness-evaluation.js.map +1 -0
- package/dist/core/semantic/type-alias-index.d.ts.map +1 -1
- package/dist/core/semantic/type-alias-index.js +1 -11
- package/dist/core/semantic/type-alias-index.js.map +1 -1
- package/dist/core/semantic/type-compatibility.d.ts +1 -1
- package/dist/core/semantic/type-compatibility.d.ts.map +1 -1
- package/dist/core/semantic/type-compatibility.js +75 -15
- package/dist/core/semantic/type-compatibility.js.map +1 -1
- package/dist/core/semantic/type-equivalence.d.ts +4 -0
- package/dist/core/semantic/type-equivalence.d.ts.map +1 -0
- package/dist/core/semantic/type-equivalence.js +255 -0
- package/dist/core/semantic/type-equivalence.js.map +1 -0
- package/dist/core/semantic/type-equivalence.test.d.ts +2 -0
- package/dist/core/semantic/type-equivalence.test.d.ts.map +1 -0
- package/dist/core/semantic/type-equivalence.test.js +380 -0
- package/dist/core/semantic/type-equivalence.test.js.map +1 -0
- package/dist/core/semantic/type-param-substitution.d.ts +19 -0
- package/dist/core/semantic/type-param-substitution.d.ts.map +1 -0
- package/dist/core/semantic/type-param-substitution.js +219 -0
- package/dist/core/semantic/type-param-substitution.js.map +1 -0
- package/dist/core/semantic/type-resolution-cases/array-like-element.test.d.ts +2 -0
- package/dist/core/semantic/type-resolution-cases/array-like-element.test.d.ts.map +1 -0
- package/dist/core/semantic/type-resolution-cases/array-like-element.test.js +82 -0
- package/dist/core/semantic/type-resolution-cases/array-like-element.test.js.map +1 -0
- package/dist/core/semantic/type-resolution-cases/contains-type-parameter.test.d.ts +2 -0
- package/dist/core/semantic/type-resolution-cases/contains-type-parameter.test.d.ts.map +1 -0
- package/dist/core/semantic/type-resolution-cases/contains-type-parameter.test.js +101 -0
- package/dist/core/semantic/type-resolution-cases/contains-type-parameter.test.js.map +1 -0
- package/dist/core/semantic/type-resolution-cases/helpers.d.ts +8 -0
- package/dist/core/semantic/type-resolution-cases/helpers.d.ts.map +1 -0
- package/dist/core/semantic/type-resolution-cases/helpers.js +5 -0
- package/dist/core/semantic/type-resolution-cases/helpers.js.map +1 -0
- package/dist/core/semantic/type-resolution-cases/narrow-typeof.test.d.ts +2 -0
- package/dist/core/semantic/type-resolution-cases/narrow-typeof.test.d.ts.map +1 -0
- package/dist/core/semantic/type-resolution-cases/narrow-typeof.test.js +98 -0
- package/dist/core/semantic/type-resolution-cases/narrow-typeof.test.js.map +1 -0
- package/dist/core/semantic/type-resolution-cases/nullish-and-value-type.test.d.ts +2 -0
- package/dist/core/semantic/type-resolution-cases/nullish-and-value-type.test.d.ts.map +1 -0
- package/dist/core/semantic/type-resolution-cases/nullish-and-value-type.test.js +378 -0
- package/dist/core/semantic/type-resolution-cases/nullish-and-value-type.test.js.map +1 -0
- package/dist/core/semantic/type-resolution-cases/object-literal-member-selection.test.d.ts +2 -0
- package/dist/core/semantic/type-resolution-cases/object-literal-member-selection.test.d.ts.map +1 -0
- package/dist/core/semantic/type-resolution-cases/object-literal-member-selection.test.js +137 -0
- package/dist/core/semantic/type-resolution-cases/object-literal-member-selection.test.js.map +1 -0
- package/dist/core/semantic/type-resolution-cases/property-type.test.d.ts +2 -0
- package/dist/core/semantic/type-resolution-cases/property-type.test.d.ts.map +1 -0
- package/dist/core/semantic/type-resolution-cases/property-type.test.js +298 -0
- package/dist/core/semantic/type-resolution-cases/property-type.test.js.map +1 -0
- package/dist/core/semantic/type-resolution-cases/structural-resolution.test.d.ts +2 -0
- package/dist/core/semantic/type-resolution-cases/structural-resolution.test.d.ts.map +1 -0
- package/dist/core/semantic/type-resolution-cases/structural-resolution.test.js +511 -0
- package/dist/core/semantic/type-resolution-cases/structural-resolution.test.js.map +1 -0
- package/dist/core/semantic/type-resolution-cases/structural-target.test.d.ts +2 -0
- package/dist/core/semantic/type-resolution-cases/structural-target.test.d.ts.map +1 -0
- package/dist/core/semantic/type-resolution-cases/structural-target.test.js +80 -0
- package/dist/core/semantic/type-resolution-cases/structural-target.test.js.map +1 -0
- package/dist/core/semantic/type-resolution-cases/substitute-type-args.test.d.ts +2 -0
- package/dist/core/semantic/type-resolution-cases/substitute-type-args.test.d.ts.map +1 -0
- package/dist/core/semantic/type-resolution-cases/substitute-type-args.test.js +80 -0
- package/dist/core/semantic/type-resolution-cases/substitute-type-args.test.js.map +1 -0
- package/dist/core/semantic/type-resolution-cases/union-member-index.test.d.ts +2 -0
- package/dist/core/semantic/type-resolution-cases/union-member-index.test.d.ts.map +1 -0
- package/dist/core/semantic/type-resolution-cases/union-member-index.test.js +142 -0
- package/dist/core/semantic/type-resolution-cases/union-member-index.test.js.map +1 -0
- package/dist/core/semantic/type-resolution.d.ts +19 -132
- package/dist/core/semantic/type-resolution.d.ts.map +1 -1
- package/dist/core/semantic/type-resolution.js +19 -786
- package/dist/core/semantic/type-resolution.js.map +1 -1
- package/dist/core/semantic/type-resolution.test.d.ts +10 -4
- package/dist/core/semantic/type-resolution.test.d.ts.map +1 -1
- package/dist/core/semantic/type-resolution.test.js +10 -552
- package/dist/core/semantic/type-resolution.test.js.map +1 -1
- package/dist/core/semantic/type-substitution.d.ts +10 -0
- package/dist/core/semantic/type-substitution.d.ts.map +1 -0
- package/dist/core/semantic/type-substitution.js +167 -0
- package/dist/core/semantic/type-substitution.js.map +1 -0
- package/dist/core/semantic/union-member-matching.d.ts +10 -0
- package/dist/core/semantic/union-member-matching.d.ts.map +1 -0
- package/dist/core/semantic/union-member-matching.js +10 -0
- package/dist/core/semantic/union-member-matching.js.map +1 -0
- package/dist/core/semantic/union-predicate-matching.d.ts +40 -0
- package/dist/core/semantic/union-predicate-matching.d.ts.map +1 -0
- package/dist/core/semantic/union-predicate-matching.js +313 -0
- package/dist/core/semantic/union-predicate-matching.js.map +1 -0
- package/dist/core/semantic/union-semantics.d.ts +39 -0
- package/dist/core/semantic/union-semantics.d.ts.map +1 -0
- package/dist/core/semantic/union-semantics.js +48 -0
- package/dist/core/semantic/union-semantics.js.map +1 -0
- package/dist/core/semantic/union-semantics.test.d.ts +2 -0
- package/dist/core/semantic/union-semantics.test.d.ts.map +1 -0
- package/dist/core/semantic/union-semantics.test.js +109 -0
- package/dist/core/semantic/union-semantics.test.js.map +1 -0
- package/dist/core/semantic/union-typeof-matching.d.ts +13 -0
- package/dist/core/semantic/union-typeof-matching.d.ts.map +1 -0
- package/dist/core/semantic/union-typeof-matching.js +124 -0
- package/dist/core/semantic/union-typeof-matching.js.map +1 -0
- package/dist/core/semantic/unsafe.d.ts.map +1 -1
- package/dist/core/semantic/unsafe.js +23 -15
- package/dist/core/semantic/unsafe.js.map +1 -1
- package/dist/core/semantic/value-slot-types.d.ts +3 -0
- package/dist/core/semantic/value-slot-types.d.ts.map +1 -0
- package/dist/core/semantic/value-slot-types.js +8 -0
- package/dist/core/semantic/value-slot-types.js.map +1 -0
- package/dist/core/semantic/variable-type-resolution.d.ts +68 -0
- package/dist/core/semantic/variable-type-resolution.d.ts.map +1 -0
- package/dist/core/semantic/variable-type-resolution.js +250 -0
- package/dist/core/semantic/variable-type-resolution.js.map +1 -0
- package/dist/duplicate-type-suppression.d.ts +18 -0
- package/dist/duplicate-type-suppression.d.ts.map +1 -0
- package/dist/duplicate-type-suppression.js +249 -0
- package/dist/duplicate-type-suppression.js.map +1 -0
- package/dist/duplicate-type-suppression.test.d.ts +2 -0
- package/dist/duplicate-type-suppression.test.d.ts.map +1 -0
- package/dist/duplicate-type-suppression.test.js +44 -0
- package/dist/duplicate-type-suppression.test.js.map +1 -0
- package/dist/emitter-types/context.d.ts +3 -2
- package/dist/emitter-types/context.d.ts.map +1 -1
- package/dist/emitter-types/context.js +8 -2
- package/dist/emitter-types/context.js.map +1 -1
- package/dist/emitter-types/core.d.ts +141 -17
- package/dist/emitter-types/core.d.ts.map +1 -1
- package/dist/emitter.d.ts +4 -0
- package/dist/emitter.d.ts.map +1 -1
- package/dist/emitter.js +31 -225
- package/dist/emitter.js.map +1 -1
- package/dist/expression-emitter.d.ts.map +1 -1
- package/dist/expression-emitter.js +55 -1430
- package/dist/expression-emitter.js.map +1 -1
- package/dist/expressions/access-binding.d.ts +19 -0
- package/dist/expressions/access-binding.d.ts.map +1 -0
- package/dist/expressions/access-binding.js +286 -0
- package/dist/expressions/access-binding.js.map +1 -0
- package/dist/expressions/access-computed.d.ts +22 -0
- package/dist/expressions/access-computed.d.ts.map +1 -0
- package/dist/expressions/access-computed.js +339 -0
- package/dist/expressions/access-computed.js.map +1 -0
- package/dist/expressions/access-length.d.ts +20 -0
- package/dist/expressions/access-length.d.ts.map +1 -0
- package/dist/expressions/access-length.js +419 -0
- package/dist/expressions/access-length.js.map +1 -0
- package/dist/expressions/access-length.test.d.ts +2 -0
- package/dist/expressions/access-length.test.d.ts.map +1 -0
- package/dist/expressions/access-length.test.js +39 -0
- package/dist/expressions/access-length.test.js.map +1 -0
- package/dist/expressions/access-property.d.ts +23 -0
- package/dist/expressions/access-property.d.ts.map +1 -0
- package/dist/expressions/access-property.js +267 -0
- package/dist/expressions/access-property.js.map +1 -0
- package/dist/expressions/access-resolution-receivers.d.ts +27 -0
- package/dist/expressions/access-resolution-receivers.d.ts.map +1 -0
- package/dist/expressions/access-resolution-receivers.js +358 -0
- package/dist/expressions/access-resolution-receivers.js.map +1 -0
- package/dist/expressions/access-resolution-types.d.ts +29 -0
- package/dist/expressions/access-resolution-types.d.ts.map +1 -0
- package/dist/expressions/access-resolution-types.js +192 -0
- package/dist/expressions/access-resolution-types.js.map +1 -0
- package/dist/expressions/access-resolution.d.ts +10 -0
- package/dist/expressions/access-resolution.d.ts.map +1 -0
- package/dist/expressions/access-resolution.js +10 -0
- package/dist/expressions/access-resolution.js.map +1 -0
- package/dist/expressions/access.d.ts +8 -3
- package/dist/expressions/access.d.ts.map +1 -1
- package/dist/expressions/access.js +170 -621
- package/dist/expressions/access.js.map +1 -1
- package/dist/expressions/architecture-invariants.test.d.ts +2 -0
- package/dist/expressions/architecture-invariants.test.d.ts.map +1 -0
- package/dist/expressions/architecture-invariants.test.js +73 -0
- package/dist/expressions/architecture-invariants.test.js.map +1 -0
- package/dist/expressions/array-interop.d.ts +3 -0
- package/dist/expressions/array-interop.d.ts.map +1 -0
- package/dist/expressions/array-interop.js +14 -0
- package/dist/expressions/array-interop.js.map +1 -0
- package/dist/expressions/array-literal.d.ts +13 -0
- package/dist/expressions/array-literal.d.ts.map +1 -0
- package/dist/expressions/array-literal.js +373 -0
- package/dist/expressions/array-literal.js.map +1 -0
- package/dist/expressions/await-normalization.d.ts +6 -0
- package/dist/expressions/await-normalization.d.ts.map +1 -0
- package/dist/expressions/await-normalization.js +358 -0
- package/dist/expressions/await-normalization.js.map +1 -0
- package/dist/expressions/calls/call-analysis.d.ts +8 -16
- package/dist/expressions/calls/call-analysis.d.ts.map +1 -1
- package/dist/expressions/calls/call-analysis.js +123 -93
- package/dist/expressions/calls/call-analysis.js.map +1 -1
- package/dist/expressions/calls/call-analysis.test.js +2 -2
- package/dist/expressions/calls/call-analysis.test.js.map +1 -1
- package/dist/expressions/calls/call-arguments-emit.d.ts +16 -0
- package/dist/expressions/calls/call-arguments-emit.d.ts.map +1 -0
- package/dist/expressions/calls/call-arguments-emit.js +1818 -0
- package/dist/expressions/calls/call-arguments-emit.js.map +1 -0
- package/dist/expressions/calls/call-arguments-helpers.d.ts +22 -0
- package/dist/expressions/calls/call-arguments-helpers.d.ts.map +1 -0
- package/dist/expressions/calls/call-arguments-helpers.js +333 -0
- package/dist/expressions/calls/call-arguments-helpers.js.map +1 -0
- package/dist/expressions/calls/call-arguments.d.ts +10 -0
- package/dist/expressions/calls/call-arguments.d.ts.map +1 -0
- package/dist/expressions/calls/call-arguments.js +10 -0
- package/dist/expressions/calls/call-arguments.js.map +1 -0
- package/dist/expressions/calls/call-array-interop.d.ts +10 -0
- package/dist/expressions/calls/call-array-interop.d.ts.map +1 -0
- package/dist/expressions/calls/call-array-interop.js +10 -0
- package/dist/expressions/calls/call-array-interop.js.map +1 -0
- package/dist/expressions/calls/call-array-mutation.d.ts +20 -0
- package/dist/expressions/calls/call-array-mutation.d.ts.map +1 -0
- package/dist/expressions/calls/call-array-mutation.js +260 -0
- package/dist/expressions/calls/call-array-mutation.js.map +1 -0
- package/dist/expressions/calls/call-array-wrapper.d.ts +14 -0
- package/dist/expressions/calls/call-array-wrapper.d.ts.map +1 -0
- package/dist/expressions/calls/call-array-wrapper.js +118 -0
- package/dist/expressions/calls/call-array-wrapper.js.map +1 -0
- package/dist/expressions/calls/call-binding-resolution.d.ts +8 -0
- package/dist/expressions/calls/call-binding-resolution.d.ts.map +1 -0
- package/dist/expressions/calls/call-binding-resolution.js +12 -0
- package/dist/expressions/calls/call-binding-resolution.js.map +1 -0
- package/dist/expressions/calls/call-dynamic-import.d.ts +11 -0
- package/dist/expressions/calls/call-dynamic-import.d.ts.map +1 -0
- package/dist/expressions/calls/call-dynamic-import.js +148 -0
- package/dist/expressions/calls/call-dynamic-import.js.map +1 -0
- package/dist/expressions/calls/call-emitter.d.ts +9 -3
- package/dist/expressions/calls/call-emitter.d.ts.map +1 -1
- package/dist/expressions/calls/call-emitter.js +227 -1976
- package/dist/expressions/calls/call-emitter.js.map +1 -1
- package/dist/expressions/calls/call-emitter.test.d.ts +2 -0
- package/dist/expressions/calls/call-emitter.test.d.ts.map +1 -0
- package/dist/expressions/calls/call-emitter.test.js +407 -0
- package/dist/expressions/calls/call-emitter.test.js.map +1 -0
- package/dist/expressions/calls/call-extension-methods.d.ts +17 -0
- package/dist/expressions/calls/call-extension-methods.d.ts.map +1 -0
- package/dist/expressions/calls/call-extension-methods.js +191 -0
- package/dist/expressions/calls/call-extension-methods.js.map +1 -0
- package/dist/expressions/calls/call-json.d.ts +15 -0
- package/dist/expressions/calls/call-json.d.ts.map +1 -0
- package/dist/expressions/calls/call-json.js +212 -0
- package/dist/expressions/calls/call-json.js.map +1 -0
- package/dist/expressions/calls/call-promise-chains.d.ts +7 -0
- package/dist/expressions/calls/call-promise-chains.d.ts.map +1 -0
- package/dist/expressions/calls/call-promise-chains.js +411 -0
- package/dist/expressions/calls/call-promise-chains.js.map +1 -0
- package/dist/expressions/calls/call-promise-ir-types.d.ts +11 -0
- package/dist/expressions/calls/call-promise-ir-types.d.ts.map +1 -0
- package/dist/expressions/calls/call-promise-ir-types.js +219 -0
- package/dist/expressions/calls/call-promise-ir-types.js.map +1 -0
- package/dist/expressions/calls/call-promise-normalization.d.ts +11 -0
- package/dist/expressions/calls/call-promise-normalization.d.ts.map +1 -0
- package/dist/expressions/calls/call-promise-normalization.js +179 -0
- package/dist/expressions/calls/call-promise-normalization.js.map +1 -0
- package/dist/expressions/calls/call-promise-static.d.ts +7 -0
- package/dist/expressions/calls/call-promise-static.d.ts.map +1 -0
- package/dist/expressions/calls/call-promise-static.js +188 -0
- package/dist/expressions/calls/call-promise-static.js.map +1 -0
- package/dist/expressions/calls/call-promise-task-types.d.ts +9 -0
- package/dist/expressions/calls/call-promise-task-types.d.ts.map +1 -0
- package/dist/expressions/calls/call-promise-task-types.js +88 -0
- package/dist/expressions/calls/call-promise-task-types.js.map +1 -0
- package/dist/expressions/calls/call-promise.d.ts +11 -0
- package/dist/expressions/calls/call-promise.d.ts.map +1 -0
- package/dist/expressions/calls/call-promise.js +11 -0
- package/dist/expressions/calls/call-promise.js.map +1 -0
- package/dist/expressions/calls/call-runtime-union-guards.d.ts +7 -0
- package/dist/expressions/calls/call-runtime-union-guards.d.ts.map +1 -0
- package/dist/expressions/calls/call-runtime-union-guards.js +131 -0
- package/dist/expressions/calls/call-runtime-union-guards.js.map +1 -0
- package/dist/expressions/calls/call-symbol.d.ts +7 -0
- package/dist/expressions/calls/call-symbol.d.ts.map +1 -0
- package/dist/expressions/calls/call-symbol.js +26 -0
- package/dist/expressions/calls/call-symbol.js.map +1 -0
- package/dist/expressions/calls/new-emitter-collections.d.ts +31 -0
- package/dist/expressions/calls/new-emitter-collections.d.ts.map +1 -0
- package/dist/expressions/calls/new-emitter-collections.js +310 -0
- package/dist/expressions/calls/new-emitter-collections.js.map +1 -0
- package/dist/expressions/calls/new-emitter-promise.d.ts +10 -0
- package/dist/expressions/calls/new-emitter-promise.d.ts.map +1 -0
- package/dist/expressions/calls/new-emitter-promise.js +437 -0
- package/dist/expressions/calls/new-emitter-promise.js.map +1 -0
- package/dist/expressions/calls/new-emitter.d.ts.map +1 -1
- package/dist/expressions/calls/new-emitter.js +34 -596
- package/dist/expressions/calls/new-emitter.js.map +1 -1
- package/dist/expressions/calls/runtime-expected-type-preference.d.ts +4 -0
- package/dist/expressions/calls/runtime-expected-type-preference.d.ts.map +1 -0
- package/dist/expressions/calls/runtime-expected-type-preference.js +61 -0
- package/dist/expressions/calls/runtime-expected-type-preference.js.map +1 -0
- package/dist/expressions/collections.d.ts +4 -18
- package/dist/expressions/collections.d.ts.map +1 -1
- package/dist/expressions/collections.js +3 -986
- package/dist/expressions/collections.js.map +1 -1
- package/dist/expressions/dictionary-literal.d.ts +20 -0
- package/dist/expressions/dictionary-literal.d.ts.map +1 -0
- package/dist/expressions/dictionary-literal.js +214 -0
- package/dist/expressions/dictionary-literal.js.map +1 -0
- package/dist/expressions/dictionary-safe-access.d.ts +4 -0
- package/dist/expressions/dictionary-safe-access.d.ts.map +1 -0
- package/dist/expressions/dictionary-safe-access.js +86 -0
- package/dist/expressions/dictionary-safe-access.js.map +1 -0
- package/dist/expressions/direct-storage-types.d.ts +10 -0
- package/dist/expressions/direct-storage-types.d.ts.map +1 -0
- package/dist/expressions/direct-storage-types.js +441 -0
- package/dist/expressions/direct-storage-types.js.map +1 -0
- package/dist/expressions/exact-comparison.d.ts +17 -0
- package/dist/expressions/exact-comparison.d.ts.map +1 -0
- package/dist/expressions/exact-comparison.js +240 -0
- package/dist/expressions/exact-comparison.js.map +1 -0
- package/dist/expressions/exact-global-bindings.d.ts +6 -0
- package/dist/expressions/exact-global-bindings.d.ts.map +1 -0
- package/dist/expressions/exact-global-bindings.js +15 -0
- package/dist/expressions/exact-global-bindings.js.map +1 -0
- package/dist/expressions/expected-type-adaptation.d.ts +55 -0
- package/dist/expressions/expected-type-adaptation.d.ts.map +1 -0
- package/dist/expressions/expected-type-adaptation.js +918 -0
- package/dist/expressions/expected-type-adaptation.js.map +1 -0
- package/dist/expressions/expected-type-adaptation.test.d.ts +2 -0
- package/dist/expressions/expected-type-adaptation.test.d.ts.map +1 -0
- package/dist/expressions/expected-type-adaptation.test.js +1363 -0
- package/dist/expressions/expected-type-adaptation.test.js.map +1 -0
- package/dist/expressions/functions.d.ts +6 -15
- package/dist/expressions/functions.d.ts.map +1 -1
- package/dist/expressions/functions.js +6 -219
- package/dist/expressions/functions.js.map +1 -1
- package/dist/expressions/identifier-storage.d.ts +43 -0
- package/dist/expressions/identifier-storage.d.ts.map +1 -0
- package/dist/expressions/identifier-storage.js +478 -0
- package/dist/expressions/identifier-storage.js.map +1 -0
- package/dist/expressions/identifiers.d.ts.map +1 -1
- package/dist/expressions/identifiers.js +145 -51
- package/dist/expressions/identifiers.js.map +1 -1
- package/dist/expressions/index-cases/alias-carrier-widening.test.d.ts +2 -0
- package/dist/expressions/index-cases/alias-carrier-widening.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/alias-carrier-widening.test.js +347 -0
- package/dist/expressions/index-cases/alias-carrier-widening.test.js.map +1 -0
- package/dist/expressions/index-cases/array-wrapper-recursion-b.test.d.ts +2 -0
- package/dist/expressions/index-cases/array-wrapper-recursion-b.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/array-wrapper-recursion-b.test.js +356 -0
- package/dist/expressions/index-cases/array-wrapper-recursion-b.test.js.map +1 -0
- package/dist/expressions/index-cases/array-wrapper-recursion-c.test.d.ts +2 -0
- package/dist/expressions/index-cases/array-wrapper-recursion-c.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/array-wrapper-recursion-c.test.js +233 -0
- package/dist/expressions/index-cases/array-wrapper-recursion-c.test.js.map +1 -0
- package/dist/expressions/index-cases/basic-literals-and-calls.test.d.ts +2 -0
- package/dist/expressions/index-cases/basic-literals-and-calls.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/basic-literals-and-calls.test.js +550 -0
- package/dist/expressions/index-cases/basic-literals-and-calls.test.js.map +1 -0
- package/dist/expressions/index-cases/defaults-and-char-context.test.d.ts +2 -0
- package/dist/expressions/index-cases/defaults-and-char-context.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/defaults-and-char-context.test.js +951 -0
- package/dist/expressions/index-cases/defaults-and-char-context.test.js.map +1 -0
- package/dist/expressions/index-cases/dictionary-and-object-initializers-a.test.d.ts +2 -0
- package/dist/expressions/index-cases/dictionary-and-object-initializers-a.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/dictionary-and-object-initializers-a.test.js +533 -0
- package/dist/expressions/index-cases/dictionary-and-object-initializers-a.test.js.map +1 -0
- package/dist/expressions/index-cases/dictionary-and-object-initializers-b.test.d.ts +2 -0
- package/dist/expressions/index-cases/dictionary-and-object-initializers-b.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/dictionary-and-object-initializers-b.test.js +336 -0
- package/dist/expressions/index-cases/dictionary-and-object-initializers-b.test.js.map +1 -0
- package/dist/expressions/index-cases/fluent-and-ef-operators.test.d.ts +2 -0
- package/dist/expressions/index-cases/fluent-and-ef-operators.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/fluent-and-ef-operators.test.js +352 -0
- package/dist/expressions/index-cases/fluent-and-ef-operators.test.js.map +1 -0
- package/dist/expressions/index-cases/helpers.d.ts +13 -0
- package/dist/expressions/index-cases/helpers.d.ts.map +1 -0
- package/dist/expressions/index-cases/helpers.js +27 -0
- package/dist/expressions/index-cases/helpers.js.map +1 -0
- package/dist/expressions/index-cases/member-access-and-array-wrappers-a.test.d.ts +2 -0
- package/dist/expressions/index-cases/member-access-and-array-wrappers-a.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/member-access-and-array-wrappers-a.test.js +429 -0
- package/dist/expressions/index-cases/member-access-and-array-wrappers-a.test.js.map +1 -0
- package/dist/expressions/index-cases/nullable-and-comparisons.test.d.ts +2 -0
- package/dist/expressions/index-cases/nullable-and-comparisons.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/nullable-and-comparisons.test.js +423 -0
- package/dist/expressions/index-cases/nullable-and-comparisons.test.js.map +1 -0
- package/dist/expressions/index-cases/runtime-subset-and-assertions.test.d.ts +2 -0
- package/dist/expressions/index-cases/runtime-subset-and-assertions.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/runtime-subset-and-assertions.test.js +482 -0
- package/dist/expressions/index-cases/runtime-subset-and-assertions.test.js.map +1 -0
- package/dist/expressions/index-cases/runtime-union-reification-a.test.d.ts +2 -0
- package/dist/expressions/index-cases/runtime-union-reification-a.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/runtime-union-reification-a.test.js +454 -0
- package/dist/expressions/index-cases/runtime-union-reification-a.test.js.map +1 -0
- package/dist/expressions/index-cases/runtime-union-reification-b.test.d.ts +2 -0
- package/dist/expressions/index-cases/runtime-union-reification-b.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/runtime-union-reification-b.test.js +852 -0
- package/dist/expressions/index-cases/runtime-union-reification-b.test.js.map +1 -0
- package/dist/expressions/index-cases/spreads-and-member-bindings.test.d.ts +2 -0
- package/dist/expressions/index-cases/spreads-and-member-bindings.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/spreads-and-member-bindings.test.js +616 -0
- package/dist/expressions/index-cases/spreads-and-member-bindings.test.js.map +1 -0
- package/dist/expressions/index-cases/string-and-array-fallbacks-a.test.d.ts +2 -0
- package/dist/expressions/index-cases/string-and-array-fallbacks-a.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/string-and-array-fallbacks-a.test.js +304 -0
- package/dist/expressions/index-cases/string-and-array-fallbacks-a.test.js.map +1 -0
- package/dist/expressions/index-cases/string-and-array-fallbacks-b.test.d.ts +2 -0
- package/dist/expressions/index-cases/string-and-array-fallbacks-b.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/string-and-array-fallbacks-b.test.js +369 -0
- package/dist/expressions/index-cases/string-and-array-fallbacks-b.test.js.map +1 -0
- package/dist/expressions/index-cases/tuple-rest-and-unions.test.d.ts +2 -0
- package/dist/expressions/index-cases/tuple-rest-and-unions.test.d.ts.map +1 -0
- package/dist/expressions/index-cases/tuple-rest-and-unions.test.js +392 -0
- package/dist/expressions/index-cases/tuple-rest-and-unions.test.js.map +1 -0
- package/dist/expressions/index.test.d.ts +17 -5
- package/dist/expressions/index.test.d.ts.map +1 -1
- package/dist/expressions/index.test.js +17 -2707
- package/dist/expressions/index.test.js.map +1 -1
- package/dist/expressions/invoked-lambda.d.ts +12 -0
- package/dist/expressions/invoked-lambda.d.ts.map +1 -0
- package/dist/expressions/invoked-lambda.js +69 -0
- package/dist/expressions/invoked-lambda.js.map +1 -0
- package/dist/expressions/lambda-body.d.ts +23 -0
- package/dist/expressions/lambda-body.d.ts.map +1 -0
- package/dist/expressions/lambda-body.js +421 -0
- package/dist/expressions/lambda-body.js.map +1 -0
- package/dist/expressions/lambda-parameters.d.ts +32 -0
- package/dist/expressions/lambda-parameters.d.ts.map +1 -0
- package/dist/expressions/lambda-parameters.js +279 -0
- package/dist/expressions/lambda-parameters.js.map +1 -0
- package/dist/expressions/literals.d.ts.map +1 -1
- package/dist/expressions/literals.js +25 -42
- package/dist/expressions/literals.js.map +1 -1
- package/dist/expressions/literals.test.js +48 -0
- package/dist/expressions/literals.test.js.map +1 -1
- package/dist/expressions/object-helpers.d.ts +22 -0
- package/dist/expressions/object-helpers.d.ts.map +1 -0
- package/dist/expressions/object-helpers.js +98 -0
- package/dist/expressions/object-helpers.js.map +1 -0
- package/dist/expressions/object-literal-spreads.d.ts +20 -0
- package/dist/expressions/object-literal-spreads.d.ts.map +1 -0
- package/dist/expressions/object-literal-spreads.js +188 -0
- package/dist/expressions/object-literal-spreads.js.map +1 -0
- package/dist/expressions/object-literal.d.ts +18 -0
- package/dist/expressions/object-literal.d.ts.map +1 -0
- package/dist/expressions/object-literal.js +178 -0
- package/dist/expressions/object-literal.js.map +1 -0
- package/dist/expressions/operators/assignment-emitter.d.ts.map +1 -1
- package/dist/expressions/operators/assignment-emitter.js +80 -33
- package/dist/expressions/operators/assignment-emitter.js.map +1 -1
- package/dist/expressions/operators/binary-dispatch.d.ts +37 -0
- package/dist/expressions/operators/binary-dispatch.d.ts.map +1 -0
- package/dist/expressions/operators/binary-dispatch.js +449 -0
- package/dist/expressions/operators/binary-dispatch.js.map +1 -0
- package/dist/expressions/operators/binary-emitter.d.ts +6 -29
- package/dist/expressions/operators/binary-emitter.d.ts.map +1 -1
- package/dist/expressions/operators/binary-emitter.js +6 -435
- package/dist/expressions/operators/binary-emitter.js.map +1 -1
- package/dist/expressions/operators/binary-helpers.d.ts +17 -0
- package/dist/expressions/operators/binary-helpers.d.ts.map +1 -0
- package/dist/expressions/operators/binary-helpers.js +119 -0
- package/dist/expressions/operators/binary-helpers.js.map +1 -0
- package/dist/expressions/operators/binary-runtime-union-comparison.d.ts +7 -0
- package/dist/expressions/operators/binary-runtime-union-comparison.d.ts.map +1 -0
- package/dist/expressions/operators/binary-runtime-union-comparison.js +150 -0
- package/dist/expressions/operators/binary-runtime-union-comparison.js.map +1 -0
- package/dist/expressions/operators/binary-special-ops.d.ts +29 -0
- package/dist/expressions/operators/binary-special-ops.d.ts.map +1 -0
- package/dist/expressions/operators/binary-special-ops.js +468 -0
- package/dist/expressions/operators/binary-special-ops.js.map +1 -0
- package/dist/expressions/operators/conditional-emitter.d.ts.map +1 -1
- package/dist/expressions/operators/conditional-emitter.js +221 -216
- package/dist/expressions/operators/conditional-emitter.js.map +1 -1
- package/dist/expressions/operators/helpers.d.ts +10 -0
- package/dist/expressions/operators/helpers.d.ts.map +1 -1
- package/dist/expressions/operators/helpers.js +30 -0
- package/dist/expressions/operators/helpers.js.map +1 -1
- package/dist/expressions/operators/logical-emitter.d.ts +2 -2
- package/dist/expressions/operators/logical-emitter.d.ts.map +1 -1
- package/dist/expressions/operators/logical-emitter.js +293 -12
- package/dist/expressions/operators/logical-emitter.js.map +1 -1
- package/dist/expressions/operators/unary-emitter.d.ts.map +1 -1
- package/dist/expressions/operators/unary-emitter.js +14 -40
- package/dist/expressions/operators/unary-emitter.js.map +1 -1
- package/dist/expressions/operators/write-targets.d.ts +5 -0
- package/dist/expressions/operators/write-targets.d.ts.map +1 -0
- package/dist/expressions/operators/write-targets.js +65 -0
- package/dist/expressions/operators/write-targets.js.map +1 -0
- package/dist/expressions/other.d.ts.map +1 -1
- package/dist/expressions/other.js +20 -58
- package/dist/expressions/other.js.map +1 -1
- package/dist/expressions/post-emission-adaptation.d.ts +19 -0
- package/dist/expressions/post-emission-adaptation.d.ts.map +1 -0
- package/dist/expressions/post-emission-adaptation.js +939 -0
- package/dist/expressions/post-emission-adaptation.js.map +1 -0
- package/dist/expressions/runtime-union-adaptation-projection.d.ts +12 -0
- package/dist/expressions/runtime-union-adaptation-projection.d.ts.map +1 -0
- package/dist/expressions/runtime-union-adaptation-projection.js +182 -0
- package/dist/expressions/runtime-union-adaptation-projection.js.map +1 -0
- package/dist/expressions/runtime-union-adaptation-upcast.d.ts +11 -0
- package/dist/expressions/runtime-union-adaptation-upcast.d.ts.map +1 -0
- package/dist/expressions/runtime-union-adaptation-upcast.js +722 -0
- package/dist/expressions/runtime-union-adaptation-upcast.js.map +1 -0
- package/dist/expressions/runtime-union-adaptation.d.ts +10 -0
- package/dist/expressions/runtime-union-adaptation.d.ts.map +1 -0
- package/dist/expressions/runtime-union-adaptation.js +10 -0
- package/dist/expressions/runtime-union-adaptation.js.map +1 -0
- package/dist/expressions/structural-adaptation-types.d.ts +12 -0
- package/dist/expressions/structural-adaptation-types.d.ts.map +1 -0
- package/dist/expressions/structural-adaptation-types.js +3 -0
- package/dist/expressions/structural-adaptation-types.js.map +1 -0
- package/dist/expressions/structural-adaptation.d.ts +16 -0
- package/dist/expressions/structural-adaptation.d.ts.map +1 -0
- package/dist/expressions/structural-adaptation.js +14 -0
- package/dist/expressions/structural-adaptation.js.map +1 -0
- package/dist/expressions/structural-anonymous-targets.d.ts +4 -0
- package/dist/expressions/structural-anonymous-targets.d.ts.map +1 -0
- package/dist/expressions/structural-anonymous-targets.js +156 -0
- package/dist/expressions/structural-anonymous-targets.js.map +1 -0
- package/dist/expressions/structural-collection-adaptation.d.ts +7 -0
- package/dist/expressions/structural-collection-adaptation.d.ts.map +1 -0
- package/dist/expressions/structural-collection-adaptation.js +682 -0
- package/dist/expressions/structural-collection-adaptation.js.map +1 -0
- package/dist/expressions/structural-object-adaptation.d.ts +6 -0
- package/dist/expressions/structural-object-adaptation.d.ts.map +1 -0
- package/dist/expressions/structural-object-adaptation.js +213 -0
- package/dist/expressions/structural-object-adaptation.js.map +1 -0
- package/dist/expressions/structural-property-model.d.ts +6 -0
- package/dist/expressions/structural-property-model.d.ts.map +1 -0
- package/dist/expressions/structural-property-model.js +304 -0
- package/dist/expressions/structural-property-model.js.map +1 -0
- package/dist/expressions/structural-type-shapes.d.ts +19 -0
- package/dist/expressions/structural-type-shapes.d.ts.map +1 -0
- package/dist/expressions/structural-type-shapes.js +318 -0
- package/dist/expressions/structural-type-shapes.js.map +1 -0
- package/dist/expressions/structural-type-shapes.test.d.ts +2 -0
- package/dist/expressions/structural-type-shapes.test.d.ts.map +1 -0
- package/dist/expressions/structural-type-shapes.test.js +60 -0
- package/dist/expressions/structural-type-shapes.test.js.map +1 -0
- package/dist/expressions/type-assertion-emitters.d.ts +50 -0
- package/dist/expressions/type-assertion-emitters.d.ts.map +1 -0
- package/dist/expressions/type-assertion-emitters.js +675 -0
- package/dist/expressions/type-assertion-emitters.js.map +1 -0
- package/dist/fixture-regression-mirrors.test.d.ts +2 -0
- package/dist/fixture-regression-mirrors.test.d.ts.map +1 -0
- package/dist/fixture-regression-mirrors.test.js +580 -0
- package/dist/fixture-regression-mirrors.test.js.map +1 -0
- package/dist/generated-files.d.ts +19 -0
- package/dist/generated-files.d.ts.map +1 -0
- package/dist/generated-files.js +519 -0
- package/dist/generated-files.js.map +1 -0
- package/dist/generated-files.test.d.ts +2 -0
- package/dist/generated-files.test.d.ts.map +1 -0
- package/dist/generated-files.test.js +103 -0
- package/dist/generated-files.test.js.map +1 -0
- package/dist/generator-cases/bidirectional-core.test.d.ts +6 -0
- package/dist/generator-cases/bidirectional-core.test.d.ts.map +1 -0
- package/dist/generator-cases/bidirectional-core.test.js +272 -0
- package/dist/generator-cases/bidirectional-core.test.js.map +1 -0
- package/dist/generator-cases/bidirectional-features.test.d.ts +6 -0
- package/dist/generator-cases/bidirectional-features.test.d.ts.map +1 -0
- package/dist/generator-cases/bidirectional-features.test.js +360 -0
- package/dist/generator-cases/bidirectional-features.test.js.map +1 -0
- package/dist/generator-cases/simple-generators.test.d.ts +6 -0
- package/dist/generator-cases/simple-generators.test.d.ts.map +1 -0
- package/dist/generator-cases/simple-generators.test.js +227 -0
- package/dist/generator-cases/simple-generators.test.js.map +1 -0
- package/dist/generator-exchange.d.ts +3 -2
- package/dist/generator-exchange.d.ts.map +1 -1
- package/dist/generator-exchange.js +49 -17
- package/dist/generator-exchange.js.map +1 -1
- package/dist/generator-wrapper-builders.d.ts +10 -0
- package/dist/generator-wrapper-builders.d.ts.map +1 -0
- package/dist/generator-wrapper-builders.js +288 -0
- package/dist/generator-wrapper-builders.js.map +1 -0
- package/dist/generator-wrapper.d.ts +16 -5
- package/dist/generator-wrapper.d.ts.map +1 -1
- package/dist/generator-wrapper.js +55 -325
- package/dist/generator-wrapper.js.map +1 -1
- package/dist/generator.test.d.ts +3 -5
- package/dist/generator.test.d.ts.map +1 -1
- package/dist/generator.test.js +3 -766
- package/dist/generator.test.js.map +1 -1
- package/dist/golden-tests/config-parser.d.ts.map +1 -1
- package/dist/golden-tests/config-parser.js +7 -0
- package/dist/golden-tests/config-parser.js.map +1 -1
- package/dist/golden-tests/discovery.js +1 -0
- package/dist/golden-tests/discovery.js.map +1 -1
- package/dist/golden-tests/runner.d.ts.map +1 -1
- package/dist/golden-tests/runner.js +12 -40
- package/dist/golden-tests/runner.js.map +1 -1
- package/dist/golden-tests/types.d.ts +2 -0
- package/dist/golden-tests/types.d.ts.map +1 -1
- package/dist/hierarchical-bindings.test.js +6 -9
- package/dist/hierarchical-bindings.test.js.map +1 -1
- package/dist/integration-cases/arrow-and-generics-a.test.d.ts +2 -0
- package/dist/integration-cases/arrow-and-generics-a.test.d.ts.map +1 -0
- package/dist/integration-cases/arrow-and-generics-a.test.js +695 -0
- package/dist/integration-cases/arrow-and-generics-a.test.js.map +1 -0
- package/dist/integration-cases/arrow-and-generics-b.test.d.ts +2 -0
- package/dist/integration-cases/arrow-and-generics-b.test.d.ts.map +1 -0
- package/dist/integration-cases/arrow-and-generics-b.test.js +218 -0
- package/dist/integration-cases/arrow-and-generics-b.test.js.map +1 -0
- package/dist/integration-cases/await-and-intrinsics.test.d.ts +2 -0
- package/dist/integration-cases/await-and-intrinsics.test.d.ts.map +1 -0
- package/dist/integration-cases/await-and-intrinsics.test.js +237 -0
- package/dist/integration-cases/await-and-intrinsics.test.js.map +1 -0
- package/dist/integration-cases/clr-iterable-overloads.test.d.ts +2 -0
- package/dist/integration-cases/clr-iterable-overloads.test.d.ts.map +1 -0
- package/dist/integration-cases/clr-iterable-overloads.test.js +446 -0
- package/dist/integration-cases/clr-iterable-overloads.test.js.map +1 -0
- package/dist/integration-cases/full-module-and-promises.test.d.ts +2 -0
- package/dist/integration-cases/full-module-and-promises.test.d.ts.map +1 -0
- package/dist/integration-cases/full-module-and-promises.test.js +472 -0
- package/dist/integration-cases/full-module-and-promises.test.js.map +1 -0
- package/dist/integration-cases/helpers.d.ts +7 -0
- package/dist/integration-cases/helpers.d.ts.map +1 -0
- package/dist/integration-cases/helpers.js +348 -0
- package/dist/integration-cases/helpers.js.map +1 -0
- package/dist/integration-cases/object-literals-and-channels.test.d.ts +2 -0
- package/dist/integration-cases/object-literals-and-channels.test.d.ts.map +1 -0
- package/dist/integration-cases/object-literals-and-channels.test.js +72 -0
- package/dist/integration-cases/object-literals-and-channels.test.js.map +1 -0
- package/dist/integration-cases/regression-coverage-a.test.d.ts +2 -0
- package/dist/integration-cases/regression-coverage-a.test.d.ts.map +1 -0
- package/dist/integration-cases/regression-coverage-a.test.js +533 -0
- package/dist/integration-cases/regression-coverage-a.test.js.map +1 -0
- package/dist/integration-cases/regression-coverage-b.test.d.ts +2 -0
- package/dist/integration-cases/regression-coverage-b.test.d.ts.map +1 -0
- package/dist/integration-cases/regression-coverage-b.test.js +806 -0
- package/dist/integration-cases/regression-coverage-b.test.js.map +1 -0
- package/dist/integration-cases/regression-coverage-c.test.d.ts +2 -0
- package/dist/integration-cases/regression-coverage-c.test.d.ts.map +1 -0
- package/dist/integration-cases/regression-coverage-c.test.js +4139 -0
- package/dist/integration-cases/regression-coverage-c.test.js.map +1 -0
- package/dist/integration.test.d.ts +9 -5
- package/dist/integration.test.d.ts.map +1 -1
- package/dist/integration.test.js +9 -1223
- package/dist/integration.test.js.map +1 -1
- package/dist/invariants/numeric-proof-contract-cases/emitter-and-annotations.test.d.ts +5 -0
- package/dist/invariants/numeric-proof-contract-cases/emitter-and-annotations.test.d.ts.map +1 -0
- package/dist/invariants/numeric-proof-contract-cases/emitter-and-annotations.test.js +93 -0
- package/dist/invariants/numeric-proof-contract-cases/emitter-and-annotations.test.js.map +1 -0
- package/dist/invariants/numeric-proof-contract-cases/helpers.d.ts +14 -0
- package/dist/invariants/numeric-proof-contract-cases/helpers.d.ts.map +1 -0
- package/dist/invariants/numeric-proof-contract-cases/helpers.js +158 -0
- package/dist/invariants/numeric-proof-contract-cases/helpers.js.map +1 -0
- package/dist/invariants/numeric-proof-contract-cases/proof-and-diagnostics.test.d.ts +5 -0
- package/dist/invariants/numeric-proof-contract-cases/proof-and-diagnostics.test.d.ts.map +1 -0
- package/dist/invariants/numeric-proof-contract-cases/proof-and-diagnostics.test.js +242 -0
- package/dist/invariants/numeric-proof-contract-cases/proof-and-diagnostics.test.js.map +1 -0
- package/dist/invariants/numeric-proof-contract.test.d.ts +2 -18
- package/dist/invariants/numeric-proof-contract.test.d.ts.map +1 -1
- package/dist/invariants/numeric-proof-contract.test.js +2 -510
- package/dist/invariants/numeric-proof-contract.test.js.map +1 -1
- package/dist/json-aot-generic.test.js +323 -5
- package/dist/json-aot-generic.test.js.map +1 -1
- package/dist/naming-policy.d.ts.map +1 -1
- package/dist/naming-policy.js +19 -0
- package/dist/naming-policy.js.map +1 -1
- package/dist/patterns/local-lowering.d.ts +27 -0
- package/dist/patterns/local-lowering.d.ts.map +1 -0
- package/dist/patterns/local-lowering.js +296 -0
- package/dist/patterns/local-lowering.js.map +1 -0
- package/dist/patterns/static-assignment-lowering.d.ts +11 -0
- package/dist/patterns/static-assignment-lowering.d.ts.map +1 -0
- package/dist/patterns/static-assignment-lowering.js +11 -0
- package/dist/patterns/static-assignment-lowering.js.map +1 -0
- package/dist/patterns/static-lowering-assignments.d.ts +16 -0
- package/dist/patterns/static-lowering-assignments.d.ts.map +1 -0
- package/dist/patterns/static-lowering-assignments.js +269 -0
- package/dist/patterns/static-lowering-assignments.js.map +1 -0
- package/dist/patterns/static-lowering-members.d.ts +15 -0
- package/dist/patterns/static-lowering-members.d.ts.map +1 -0
- package/dist/patterns/static-lowering-members.js +231 -0
- package/dist/patterns/static-lowering-members.js.map +1 -0
- package/dist/patterns-cases/array-and-object.test.d.ts +2 -0
- package/dist/patterns-cases/array-and-object.test.d.ts.map +1 -0
- package/dist/patterns-cases/array-and-object.test.js +370 -0
- package/dist/patterns-cases/array-and-object.test.js.map +1 -0
- package/dist/patterns-cases/assignments-and-complex.test.d.ts +2 -0
- package/dist/patterns-cases/assignments-and-complex.test.d.ts.map +1 -0
- package/dist/patterns-cases/assignments-and-complex.test.js +361 -0
- package/dist/patterns-cases/assignments-and-complex.test.js.map +1 -0
- package/dist/patterns-cases/edge-cases.test.d.ts +2 -0
- package/dist/patterns-cases/edge-cases.test.d.ts.map +1 -0
- package/dist/patterns-cases/edge-cases.test.js +133 -0
- package/dist/patterns-cases/edge-cases.test.js.map +1 -0
- package/dist/patterns-cases/helpers.d.ts +6 -0
- package/dist/patterns-cases/helpers.d.ts.map +1 -0
- package/dist/patterns-cases/helpers.js +33 -0
- package/dist/patterns-cases/helpers.js.map +1 -0
- package/dist/patterns-cases/loops-and-parameters.test.d.ts +2 -0
- package/dist/patterns-cases/loops-and-parameters.test.d.ts.map +1 -0
- package/dist/patterns-cases/loops-and-parameters.test.js +275 -0
- package/dist/patterns-cases/loops-and-parameters.test.js.map +1 -0
- package/dist/patterns-cases/methods-and-semantic-infra.test.d.ts +2 -0
- package/dist/patterns-cases/methods-and-semantic-infra.test.d.ts.map +1 -0
- package/dist/patterns-cases/methods-and-semantic-infra.test.js +438 -0
- package/dist/patterns-cases/methods-and-semantic-infra.test.js.map +1 -0
- package/dist/patterns.d.ts +5 -20
- package/dist/patterns.d.ts.map +1 -1
- package/dist/patterns.js +3 -830
- package/dist/patterns.js.map +1 -1
- package/dist/patterns.test.d.ts +5 -14
- package/dist/patterns.test.d.ts.map +1 -1
- package/dist/patterns.test.js +5 -1341
- package/dist/patterns.test.js.map +1 -1
- package/dist/runtime-union-cases/helpers.d.ts +7 -0
- package/dist/runtime-union-cases/helpers.d.ts.map +1 -0
- package/dist/runtime-union-cases/helpers.js +17 -0
- package/dist/runtime-union-cases/helpers.js.map +1 -0
- package/dist/specialization/generic-functions-cases/basics-and-structural.test.d.ts +6 -0
- package/dist/specialization/generic-functions-cases/basics-and-structural.test.d.ts.map +1 -0
- package/dist/specialization/generic-functions-cases/basics-and-structural.test.js +357 -0
- package/dist/specialization/generic-functions-cases/basics-and-structural.test.js.map +1 -0
- package/dist/specialization/generic-functions-cases/class-and-interface-constraints.test.d.ts +6 -0
- package/dist/specialization/generic-functions-cases/class-and-interface-constraints.test.d.ts.map +1 -0
- package/dist/specialization/generic-functions-cases/class-and-interface-constraints.test.js +304 -0
- package/dist/specialization/generic-functions-cases/class-and-interface-constraints.test.js.map +1 -0
- package/dist/specialization/generic-functions.test.d.ts +2 -5
- package/dist/specialization/generic-functions.test.d.ts.map +1 -1
- package/dist/specialization/generic-functions.test.js +2 -650
- package/dist/specialization/generic-functions.test.js.map +1 -1
- package/dist/specialization/helpers.d.ts.map +1 -1
- package/dist/specialization/helpers.js +2 -16
- package/dist/specialization/helpers.js.map +1 -1
- package/dist/specialization/interfaces.test.js +58 -0
- package/dist/specialization/interfaces.test.js.map +1 -1
- package/dist/specialization/naming.d.ts.map +1 -1
- package/dist/specialization/naming.js +9 -2
- package/dist/specialization/naming.js.map +1 -1
- package/dist/statements/block-emitters/block-and-return.d.ts +10 -0
- package/dist/statements/block-emitters/block-and-return.d.ts.map +1 -0
- package/dist/statements/block-emitters/block-and-return.js +132 -0
- package/dist/statements/block-emitters/block-and-return.js.map +1 -0
- package/dist/statements/block-emitters/expression-statements.d.ts +7 -0
- package/dist/statements/block-emitters/expression-statements.d.ts.map +1 -0
- package/dist/statements/block-emitters/expression-statements.js +72 -0
- package/dist/statements/block-emitters/expression-statements.js.map +1 -0
- package/dist/statements/block-emitters/yield-statements.d.ts +13 -0
- package/dist/statements/block-emitters/yield-statements.d.ts.map +1 -0
- package/dist/statements/block-emitters/yield-statements.js +217 -0
- package/dist/statements/block-emitters/yield-statements.js.map +1 -0
- package/dist/statements/blocks.d.ts +3 -86
- package/dist/statements/blocks.d.ts.map +1 -1
- package/dist/statements/blocks.js +3 -443
- package/dist/statements/blocks.js.map +1 -1
- package/dist/statements/classes/members/constructors.d.ts.map +1 -1
- package/dist/statements/classes/members/constructors.js +105 -13
- package/dist/statements/classes/members/constructors.js.map +1 -1
- package/dist/statements/classes/members/methods.d.ts +1 -1
- package/dist/statements/classes/members/methods.d.ts.map +1 -1
- package/dist/statements/classes/members/methods.js +330 -83
- package/dist/statements/classes/members/methods.js.map +1 -1
- package/dist/statements/classes/members/orchestrator.d.ts +3 -3
- package/dist/statements/classes/members/orchestrator.d.ts.map +1 -1
- package/dist/statements/classes/members/orchestrator.js +10 -4
- package/dist/statements/classes/members/orchestrator.js.map +1 -1
- package/dist/statements/classes/members/properties.d.ts.map +1 -1
- package/dist/statements/classes/members/properties.js +29 -5
- package/dist/statements/classes/members/properties.js.map +1 -1
- package/dist/statements/classes/members/shadowing.test.js +3 -2
- package/dist/statements/classes/members/shadowing.test.js.map +1 -1
- package/dist/statements/classes/parameters.d.ts +9 -1
- package/dist/statements/classes/parameters.d.ts.map +1 -1
- package/dist/statements/classes/parameters.js +88 -7
- package/dist/statements/classes/parameters.js.map +1 -1
- package/dist/statements/classes/properties.d.ts.map +1 -1
- package/dist/statements/classes/properties.js +7 -17
- package/dist/statements/classes/properties.js.map +1 -1
- package/dist/statements/control/conditionals/branch-context.d.ts +58 -0
- package/dist/statements/control/conditionals/branch-context.d.ts.map +1 -0
- package/dist/statements/control/conditionals/branch-context.js +530 -0
- package/dist/statements/control/conditionals/branch-context.js.map +1 -0
- package/dist/statements/control/conditionals/branch-context.test.d.ts +2 -0
- package/dist/statements/control/conditionals/branch-context.test.d.ts.map +1 -0
- package/dist/statements/control/conditionals/branch-context.test.js +34 -0
- package/dist/statements/control/conditionals/branch-context.test.js.map +1 -0
- package/dist/statements/control/conditionals/guard-analysis.d.ts +8 -207
- package/dist/statements/control/conditionals/guard-analysis.d.ts.map +1 -1
- package/dist/statements/control/conditionals/guard-analysis.js +8 -750
- package/dist/statements/control/conditionals/guard-analysis.js.map +1 -1
- package/dist/statements/control/conditionals/guard-detectors-discriminant.d.ts +20 -0
- package/dist/statements/control/conditionals/guard-detectors-discriminant.d.ts.map +1 -0
- package/dist/statements/control/conditionals/guard-detectors-discriminant.js +214 -0
- package/dist/statements/control/conditionals/guard-detectors-discriminant.js.map +1 -0
- package/dist/statements/control/conditionals/guard-detectors-structural.d.ts +32 -0
- package/dist/statements/control/conditionals/guard-detectors-structural.d.ts.map +1 -0
- package/dist/statements/control/conditionals/guard-detectors-structural.js +302 -0
- package/dist/statements/control/conditionals/guard-detectors-structural.js.map +1 -0
- package/dist/statements/control/conditionals/guard-detectors.d.ts +11 -0
- package/dist/statements/control/conditionals/guard-detectors.d.ts.map +1 -0
- package/dist/statements/control/conditionals/guard-detectors.js +11 -0
- package/dist/statements/control/conditionals/guard-detectors.js.map +1 -0
- package/dist/statements/control/conditionals/guard-extraction.d.ts +30 -0
- package/dist/statements/control/conditionals/guard-extraction.d.ts.map +1 -0
- package/dist/statements/control/conditionals/guard-extraction.js +304 -0
- package/dist/statements/control/conditionals/guard-extraction.js.map +1 -0
- package/dist/statements/control/conditionals/guard-types.d.ts +214 -0
- package/dist/statements/control/conditionals/guard-types.d.ts.map +1 -0
- package/dist/statements/control/conditionals/guard-types.js +242 -0
- package/dist/statements/control/conditionals/guard-types.js.map +1 -0
- package/dist/statements/control/conditionals/if-emit-instanceof-guards.d.ts +28 -0
- package/dist/statements/control/conditionals/if-emit-instanceof-guards.d.ts.map +1 -0
- package/dist/statements/control/conditionals/if-emit-instanceof-guards.js +261 -0
- package/dist/statements/control/conditionals/if-emit-instanceof-guards.js.map +1 -0
- package/dist/statements/control/conditionals/if-emit-predicate-guards.d.ts +24 -0
- package/dist/statements/control/conditionals/if-emit-predicate-guards.d.ts.map +1 -0
- package/dist/statements/control/conditionals/if-emit-predicate-guards.js +165 -0
- package/dist/statements/control/conditionals/if-emit-predicate-guards.js.map +1 -0
- package/dist/statements/control/conditionals/if-emit-property-discriminant-guards.d.ts +24 -0
- package/dist/statements/control/conditionals/if-emit-property-discriminant-guards.d.ts.map +1 -0
- package/dist/statements/control/conditionals/if-emit-property-discriminant-guards.js +391 -0
- package/dist/statements/control/conditionals/if-emit-property-discriminant-guards.js.map +1 -0
- package/dist/statements/control/conditionals/if-emit-type-guards.d.ts +10 -0
- package/dist/statements/control/conditionals/if-emit-type-guards.d.ts.map +1 -0
- package/dist/statements/control/conditionals/if-emit-type-guards.js +10 -0
- package/dist/statements/control/conditionals/if-emit-type-guards.js.map +1 -0
- package/dist/statements/control/conditionals/if-emit-typeof-array-guards.d.ts +23 -0
- package/dist/statements/control/conditionals/if-emit-typeof-array-guards.d.ts.map +1 -0
- package/dist/statements/control/conditionals/if-emit-typeof-array-guards.js +264 -0
- package/dist/statements/control/conditionals/if-emit-typeof-array-guards.js.map +1 -0
- package/dist/statements/control/conditionals/if-emit-union-guards.d.ts +10 -0
- package/dist/statements/control/conditionals/if-emit-union-guards.d.ts.map +1 -0
- package/dist/statements/control/conditionals/if-emit-union-guards.js +10 -0
- package/dist/statements/control/conditionals/if-emit-union-guards.js.map +1 -0
- package/dist/statements/control/conditionals/if-emitter.d.ts +6 -3
- package/dist/statements/control/conditionals/if-emitter.d.ts.map +1 -1
- package/dist/statements/control/conditionals/if-emitter.js +99 -911
- package/dist/statements/control/conditionals/if-emitter.js.map +1 -1
- package/dist/statements/control/exceptions.d.ts.map +1 -1
- package/dist/statements/control/exceptions.js +21 -6
- package/dist/statements/control/exceptions.js.map +1 -1
- package/dist/statements/control/loop-helpers.d.ts +13 -0
- package/dist/statements/control/loop-helpers.d.ts.map +1 -0
- package/dist/statements/control/loop-helpers.js +75 -0
- package/dist/statements/control/loop-helpers.js.map +1 -0
- package/dist/statements/control/loops.d.ts.map +1 -1
- package/dist/statements/control/loops.js +88 -174
- package/dist/statements/control/loops.js.map +1 -1
- package/dist/statements/declarations/class-emitter-helpers.d.ts +17 -0
- package/dist/statements/declarations/class-emitter-helpers.d.ts.map +1 -0
- package/dist/statements/declarations/class-emitter-helpers.js +126 -0
- package/dist/statements/declarations/class-emitter-helpers.js.map +1 -0
- package/dist/statements/declarations/classes.d.ts.map +1 -1
- package/dist/statements/declarations/classes.js +104 -31
- package/dist/statements/declarations/classes.js.map +1 -1
- package/dist/statements/declarations/function-local-emitter.d.ts +7 -0
- package/dist/statements/declarations/function-local-emitter.d.ts.map +1 -0
- package/dist/statements/declarations/function-local-emitter.js +363 -0
- package/dist/statements/declarations/function-local-emitter.js.map +1 -0
- package/dist/statements/declarations/function-module-emitter.d.ts +7 -0
- package/dist/statements/declarations/function-module-emitter.d.ts.map +1 -0
- package/dist/statements/declarations/function-module-emitter.js +372 -0
- package/dist/statements/declarations/function-module-emitter.js.map +1 -0
- package/dist/statements/declarations/function-shared.d.ts +43 -0
- package/dist/statements/declarations/function-shared.d.ts.map +1 -0
- package/dist/statements/declarations/function-shared.js +246 -0
- package/dist/statements/declarations/function-shared.js.map +1 -0
- package/dist/statements/declarations/functions.d.ts +2 -27
- package/dist/statements/declarations/functions.d.ts.map +1 -1
- package/dist/statements/declarations/functions.js +2 -739
- package/dist/statements/declarations/functions.js.map +1 -1
- package/dist/statements/declarations/interfaces-mutable-storage.test.js +10 -2
- package/dist/statements/declarations/interfaces-mutable-storage.test.js.map +1 -1
- package/dist/statements/declarations/interfaces.d.ts.map +1 -1
- package/dist/statements/declarations/interfaces.js +29 -21
- package/dist/statements/declarations/interfaces.js.map +1 -1
- package/dist/statements/declarations/type-aliases.d.ts.map +1 -1
- package/dist/statements/declarations/type-aliases.js +6 -12
- package/dist/statements/declarations/type-aliases.js.map +1 -1
- package/dist/statements/declarations/variable-local-type.d.ts +36 -0
- package/dist/statements/declarations/variable-local-type.d.ts.map +1 -0
- package/dist/statements/declarations/variable-local-type.js +122 -0
- package/dist/statements/declarations/variable-local-type.js.map +1 -0
- package/dist/statements/declarations/variable-static-arrow.d.ts +47 -0
- package/dist/statements/declarations/variable-static-arrow.d.ts.map +1 -0
- package/dist/statements/declarations/variable-static-arrow.js +363 -0
- package/dist/statements/declarations/variable-static-arrow.js.map +1 -0
- package/dist/statements/declarations/variable-type-helpers.d.ts +86 -0
- package/dist/statements/declarations/variable-type-helpers.d.ts.map +1 -0
- package/dist/statements/declarations/variable-type-helpers.js +242 -0
- package/dist/statements/declarations/variable-type-helpers.js.map +1 -0
- package/dist/statements/declarations/variable-type-resolution.d.ts +11 -0
- package/dist/statements/declarations/variable-type-resolution.d.ts.map +1 -0
- package/dist/statements/declarations/variable-type-resolution.js +11 -0
- package/dist/statements/declarations/variable-type-resolution.js.map +1 -0
- package/dist/statements/declarations/variables.d.ts +5 -1
- package/dist/statements/declarations/variables.d.ts.map +1 -1
- package/dist/statements/declarations/variables.js +116 -594
- package/dist/statements/declarations/variables.js.map +1 -1
- package/dist/statements/index.test.d.ts +10 -5
- package/dist/statements/index.test.d.ts.map +1 -1
- package/dist/statements/index.test.js +10 -1883
- package/dist/statements/index.test.js.map +1 -1
- package/dist/statements/parameter-defaults.d.ts +17 -0
- package/dist/statements/parameter-defaults.d.ts.map +1 -0
- package/dist/statements/parameter-defaults.js +122 -0
- package/dist/statements/parameter-defaults.js.map +1 -0
- package/dist/statements/statement-cases/async-returns.test.d.ts +2 -0
- package/dist/statements/statement-cases/async-returns.test.d.ts.map +1 -0
- package/dist/statements/statement-cases/async-returns.test.js +311 -0
- package/dist/statements/statement-cases/async-returns.test.js.map +1 -0
- package/dist/statements/statement-cases/flow-and-void.test.d.ts +2 -0
- package/dist/statements/statement-cases/flow-and-void.test.d.ts.map +1 -0
- package/dist/statements/statement-cases/flow-and-void.test.js +405 -0
- package/dist/statements/statement-cases/flow-and-void.test.js.map +1 -0
- package/dist/statements/statement-cases/helpers.d.ts +6 -0
- package/dist/statements/statement-cases/helpers.d.ts.map +1 -0
- package/dist/statements/statement-cases/helpers.js +4 -0
- package/dist/statements/statement-cases/helpers.js.map +1 -0
- package/dist/statements/statement-cases/if-and-instanceof-guards.test.d.ts +2 -0
- package/dist/statements/statement-cases/if-and-instanceof-guards.test.d.ts.map +1 -0
- package/dist/statements/statement-cases/if-and-instanceof-guards.test.js +826 -0
- package/dist/statements/statement-cases/if-and-instanceof-guards.test.js.map +1 -0
- package/dist/statements/statement-cases/loops.test.d.ts +2 -0
- package/dist/statements/statement-cases/loops.test.d.ts.map +1 -0
- package/dist/statements/statement-cases/loops.test.js +433 -0
- package/dist/statements/statement-cases/loops.test.js.map +1 -0
- package/dist/statements/statement-cases/scopes-and-storage.test.d.ts +2 -0
- package/dist/statements/statement-cases/scopes-and-storage.test.d.ts.map +1 -0
- package/dist/statements/statement-cases/scopes-and-storage.test.js +216 -0
- package/dist/statements/statement-cases/scopes-and-storage.test.js.map +1 -0
- package/dist/statements/statement-cases/union-guards-basic.test.d.ts +2 -0
- package/dist/statements/statement-cases/union-guards-basic.test.d.ts.map +1 -0
- package/dist/statements/statement-cases/union-guards-basic.test.js +235 -0
- package/dist/statements/statement-cases/union-guards-basic.test.js.map +1 -0
- package/dist/statements/statement-cases/union-guards-nullish-and-object.test.d.ts +2 -0
- package/dist/statements/statement-cases/union-guards-nullish-and-object.test.d.ts.map +1 -0
- package/dist/statements/statement-cases/union-guards-nullish-and-object.test.js +265 -0
- package/dist/statements/statement-cases/union-guards-nullish-and-object.test.js.map +1 -0
- package/dist/statements/statement-cases/union-guards-predicate-and-truthy.test.d.ts +2 -0
- package/dist/statements/statement-cases/union-guards-predicate-and-truthy.test.d.ts.map +1 -0
- package/dist/statements/statement-cases/union-guards-predicate-and-truthy.test.js +630 -0
- package/dist/statements/statement-cases/union-guards-predicate-and-truthy.test.js.map +1 -0
- package/dist/statements/statement-cases/union-guards-remapped-a.test.d.ts +2 -0
- package/dist/statements/statement-cases/union-guards-remapped-a.test.d.ts.map +1 -0
- package/dist/statements/statement-cases/union-guards-remapped-a.test.js +382 -0
- package/dist/statements/statement-cases/union-guards-remapped-a.test.js.map +1 -0
- package/dist/statements/statement-cases/union-guards-remapped-b.test.d.ts +2 -0
- package/dist/statements/statement-cases/union-guards-remapped-b.test.d.ts.map +1 -0
- package/dist/statements/statement-cases/union-guards-remapped-b.test.js +397 -0
- package/dist/statements/statement-cases/union-guards-remapped-b.test.js.map +1 -0
- package/dist/type-assertion.test.js +258 -10
- package/dist/type-assertion.test.js.map +1 -1
- package/dist/types/arrays.d.ts.map +1 -1
- package/dist/types/arrays.js +10 -1
- package/dist/types/arrays.js.map +1 -1
- package/dist/types/dictionaries.d.ts.map +1 -1
- package/dist/types/dictionaries.js +5 -5
- package/dist/types/dictionaries.js.map +1 -1
- package/dist/types/emitter.d.ts.map +1 -1
- package/dist/types/emitter.js +129 -24
- package/dist/types/emitter.js.map +1 -1
- package/dist/types/functions.d.ts.map +1 -1
- package/dist/types/functions.js +5 -25
- package/dist/types/functions.js.map +1 -1
- package/dist/types/index.test.js +205 -1
- package/dist/types/index.test.js.map +1 -1
- package/dist/types/objects.d.ts +2 -2
- package/dist/types/objects.d.ts.map +1 -1
- package/dist/types/objects.js +2 -2
- package/dist/types/objects.js.map +1 -1
- package/dist/types/parameters.d.ts.map +1 -1
- package/dist/types/parameters.js +88 -18
- package/dist/types/parameters.js.map +1 -1
- package/dist/types/primitives.d.ts.map +1 -1
- package/dist/types/primitives.js.map +1 -1
- package/dist/types/reference-lookup.d.ts +16 -0
- package/dist/types/reference-lookup.d.ts.map +1 -0
- package/dist/types/reference-lookup.js +133 -0
- package/dist/types/reference-lookup.js.map +1 -0
- package/dist/types/reference-structural-signatures.d.ts +10 -0
- package/dist/types/reference-structural-signatures.d.ts.map +1 -0
- package/dist/types/reference-structural-signatures.js +310 -0
- package/dist/types/reference-structural-signatures.js.map +1 -0
- package/dist/types/references-cases/array-and-cross-module.test.d.ts +2 -0
- package/dist/types/references-cases/array-and-cross-module.test.d.ts.map +1 -0
- package/dist/types/references-cases/array-and-cross-module.test.js +150 -0
- package/dist/types/references-cases/array-and-cross-module.test.js.map +1 -0
- package/dist/types/references-cases/bindings-and-local.test.d.ts +2 -0
- package/dist/types/references-cases/bindings-and-local.test.d.ts.map +1 -0
- package/dist/types/references-cases/bindings-and-local.test.js +368 -0
- package/dist/types/references-cases/bindings-and-local.test.js.map +1 -0
- package/dist/types/references-cases/helpers.d.ts +14 -0
- package/dist/types/references-cases/helpers.d.ts.map +1 -0
- package/dist/types/references-cases/helpers.js +39 -0
- package/dist/types/references-cases/helpers.js.map +1 -0
- package/dist/types/references-cases/polymorphic-and-recursive.test.d.ts +2 -0
- package/dist/types/references-cases/polymorphic-and-recursive.test.d.ts.map +1 -0
- package/dist/types/references-cases/polymorphic-and-recursive.test.js +387 -0
- package/dist/types/references-cases/polymorphic-and-recursive.test.js.map +1 -0
- package/dist/types/references-cases/primitive-and-builtins.test.d.ts +2 -0
- package/dist/types/references-cases/primitive-and-builtins.test.d.ts.map +1 -0
- package/dist/types/references-cases/primitive-and-builtins.test.js +116 -0
- package/dist/types/references-cases/primitive-and-builtins.test.js.map +1 -0
- package/dist/types/references-cases/resolved-and-imported.test.d.ts +2 -0
- package/dist/types/references-cases/resolved-and-imported.test.d.ts.map +1 -0
- package/dist/types/references-cases/resolved-and-imported.test.js +669 -0
- package/dist/types/references-cases/resolved-and-imported.test.js.map +1 -0
- package/dist/types/references.d.ts.map +1 -1
- package/dist/types/references.js +279 -250
- package/dist/types/references.js.map +1 -1
- package/dist/types/references.test.d.ts +5 -10
- package/dist/types/references.test.d.ts.map +1 -1
- package/dist/types/references.test.js +5 -718
- package/dist/types/references.test.js.map +1 -1
- package/dist/types/tuples.d.ts.map +1 -1
- package/dist/types/tuples.js +7 -17
- package/dist/types/tuples.js.map +1 -1
- package/dist/types/unions-cases/basic-and-ordering.test.d.ts +6 -0
- package/dist/types/unions-cases/basic-and-ordering.test.d.ts.map +1 -0
- package/dist/types/unions-cases/basic-and-ordering.test.js +322 -0
- package/dist/types/unions-cases/basic-and-ordering.test.js.map +1 -0
- package/dist/types/unions-cases/large-and-fallback.test.d.ts +6 -0
- package/dist/types/unions-cases/large-and-fallback.test.d.ts.map +1 -0
- package/dist/types/unions-cases/large-and-fallback.test.js +246 -0
- package/dist/types/unions-cases/large-and-fallback.test.js.map +1 -0
- package/dist/types/unions-cases/multi-surface.test.d.ts +6 -0
- package/dist/types/unions-cases/multi-surface.test.d.ts.map +1 -0
- package/dist/types/unions-cases/multi-surface.test.js +268 -0
- package/dist/types/unions-cases/multi-surface.test.js.map +1 -0
- package/dist/types/unions.d.ts +1 -1
- package/dist/types/unions.d.ts.map +1 -1
- package/dist/types/unions.js +60 -68
- package/dist/types/unions.js.map +1 -1
- package/dist/types/unions.test.d.ts +3 -5
- package/dist/types/unions.test.d.ts.map +1 -1
- package/dist/types/unions.test.js +3 -413
- package/dist/types/unions.test.js.map +1 -1
- package/package.json +4 -4
- package/dist/expressions/parentheses.d.ts +0 -4
- package/dist/expressions/parentheses.d.ts.map +0 -1
- package/dist/expressions/parentheses.js +0 -91
- package/dist/expressions/parentheses.js.map +0 -1
|
@@ -1,1941 +1,239 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Call expression emitter
|
|
2
|
+
* Call expression emitter — main dispatch and orchestration.
|
|
3
|
+
*
|
|
4
|
+
* Routes call expressions to specialized emitters (promise, array interop,
|
|
5
|
+
* dynamic import, JSON, extension methods) and handles the default regular-call path.
|
|
6
|
+
*
|
|
7
|
+
* Extension method lowering lives in:
|
|
8
|
+
* - call-extension-methods.ts
|
|
3
9
|
*/
|
|
4
|
-
import { getAwaitedIrType, isAwaitableIrType, } from "@tsonic/frontend";
|
|
5
10
|
import { emitExpressionAst } from "../../expression-emitter.js";
|
|
6
11
|
import { emitTypeArgumentsAst, generateSpecializedName, } from "../identifiers.js";
|
|
7
12
|
import { emitTypeAst } from "../../type-emitter.js";
|
|
8
13
|
import { emitMemberAccess } from "../access.js";
|
|
9
|
-
import {
|
|
14
|
+
import { isJsonSerializerCall, isGlobalJsonCall, isInstanceMemberAccess, needsIntCast, } from "./call-analysis.js";
|
|
10
15
|
import { extractCalleeNameFromAst } from "../../core/format/backend-ast/utils.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
: expr;
|
|
30
|
-
const stripClrGenericArity = (typeName) => typeName.replace(/`\d+$/, "");
|
|
31
|
-
const nativeArrayMutationMembers = new Set([
|
|
32
|
-
"push",
|
|
33
|
-
"pop",
|
|
34
|
-
"shift",
|
|
35
|
-
"unshift",
|
|
36
|
-
"splice",
|
|
37
|
-
"sort",
|
|
38
|
-
"reverse",
|
|
39
|
-
"fill",
|
|
40
|
-
"copyWithin",
|
|
41
|
-
]);
|
|
42
|
-
const returnsMutatedArrayMember = (memberName) => memberName === "sort" ||
|
|
43
|
-
memberName === "reverse" ||
|
|
44
|
-
memberName === "fill" ||
|
|
45
|
-
memberName === "copyWithin";
|
|
46
|
-
const createVarLocal = (name, initializer) => ({
|
|
47
|
-
kind: "localDeclarationStatement",
|
|
48
|
-
modifiers: [],
|
|
49
|
-
type: { kind: "varType" },
|
|
50
|
-
declarators: [{ name, initializer }],
|
|
51
|
-
});
|
|
52
|
-
const captureAssignableArrayTarget = (expr, context) => {
|
|
53
|
-
const [receiverAst, receiverContext] = emitExpressionAst(expr, context);
|
|
54
|
-
if (receiverAst.kind === "identifierExpression") {
|
|
55
|
-
return {
|
|
56
|
-
readExpression: receiverAst,
|
|
57
|
-
writeExpression: receiverAst,
|
|
58
|
-
setupStatements: [],
|
|
59
|
-
context: receiverContext,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
if (receiverAst.kind === "memberAccessExpression") {
|
|
63
|
-
const objectTemp = allocateLocalName("__tsonic_arrayTarget", receiverContext);
|
|
64
|
-
const objectIdentifier = {
|
|
65
|
-
kind: "identifierExpression",
|
|
66
|
-
identifier: objectTemp.emittedName,
|
|
67
|
-
};
|
|
68
|
-
return {
|
|
69
|
-
readExpression: {
|
|
70
|
-
kind: "memberAccessExpression",
|
|
71
|
-
expression: objectIdentifier,
|
|
72
|
-
memberName: receiverAst.memberName,
|
|
73
|
-
},
|
|
74
|
-
writeExpression: {
|
|
75
|
-
kind: "memberAccessExpression",
|
|
76
|
-
expression: objectIdentifier,
|
|
77
|
-
memberName: receiverAst.memberName,
|
|
78
|
-
},
|
|
79
|
-
setupStatements: [
|
|
80
|
-
createVarLocal(objectTemp.emittedName, receiverAst.expression),
|
|
81
|
-
],
|
|
82
|
-
context: objectTemp.context,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
if (receiverAst.kind === "elementAccessExpression" &&
|
|
86
|
-
receiverAst.arguments.length === 1) {
|
|
87
|
-
const objectTemp = allocateLocalName("__tsonic_arrayTarget", receiverContext);
|
|
88
|
-
const indexTemp = allocateLocalName("__tsonic_arrayIndex", objectTemp.context);
|
|
89
|
-
const objectIdentifier = {
|
|
90
|
-
kind: "identifierExpression",
|
|
91
|
-
identifier: objectTemp.emittedName,
|
|
92
|
-
};
|
|
93
|
-
const indexIdentifier = {
|
|
94
|
-
kind: "identifierExpression",
|
|
95
|
-
identifier: indexTemp.emittedName,
|
|
96
|
-
};
|
|
97
|
-
return {
|
|
98
|
-
readExpression: {
|
|
99
|
-
kind: "elementAccessExpression",
|
|
100
|
-
expression: objectIdentifier,
|
|
101
|
-
arguments: [indexIdentifier],
|
|
102
|
-
},
|
|
103
|
-
writeExpression: {
|
|
104
|
-
kind: "elementAccessExpression",
|
|
105
|
-
expression: objectIdentifier,
|
|
106
|
-
arguments: [indexIdentifier],
|
|
107
|
-
},
|
|
108
|
-
setupStatements: [
|
|
109
|
-
createVarLocal(objectTemp.emittedName, receiverAst.expression),
|
|
110
|
-
createVarLocal(indexTemp.emittedName, receiverAst.arguments[0]),
|
|
111
|
-
],
|
|
112
|
-
context: indexTemp.context,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
return undefined;
|
|
116
|
-
};
|
|
117
|
-
const emitArrayMutationInteropCall = (expr, context) => {
|
|
118
|
-
if (expr.isOptional)
|
|
119
|
-
return undefined;
|
|
120
|
-
if (expr.callee.kind !== "memberAccess")
|
|
121
|
-
return undefined;
|
|
122
|
-
if (expr.callee.isComputed)
|
|
123
|
-
return undefined;
|
|
124
|
-
if (typeof expr.callee.property !== "string")
|
|
125
|
-
return undefined;
|
|
126
|
-
if (!nativeArrayMutationMembers.has(expr.callee.property))
|
|
127
|
-
return undefined;
|
|
128
|
-
if (!isLValue(expr.callee.object))
|
|
129
|
-
return undefined;
|
|
130
|
-
const binding = expr.callee.memberBinding;
|
|
131
|
-
if (!binding || binding.isExtensionMethod)
|
|
132
|
-
return undefined;
|
|
133
|
-
const receiverType = expr.callee.object.inferredType;
|
|
134
|
-
if (!receiverType || receiverType.kind !== "arrayType")
|
|
135
|
-
return undefined;
|
|
136
|
-
const captured = captureAssignableArrayTarget(expr.callee.object, context);
|
|
137
|
-
if (!captured)
|
|
138
|
-
return undefined;
|
|
139
|
-
let currentContext = captured.context;
|
|
140
|
-
const [elementTypeAst, elementTypeContext] = emitTypeAst(receiverType.elementType, currentContext);
|
|
141
|
-
currentContext = elementTypeContext;
|
|
142
|
-
const wrapperTemp = allocateLocalName("__tsonic_arrayWrapper", currentContext);
|
|
143
|
-
currentContext = wrapperTemp.context;
|
|
144
|
-
const resultTemp = allocateLocalName("__tsonic_arrayResult", currentContext);
|
|
145
|
-
currentContext = resultTemp.context;
|
|
146
|
-
const wrapperIdentifier = {
|
|
147
|
-
kind: "identifierExpression",
|
|
148
|
-
identifier: wrapperTemp.emittedName,
|
|
149
|
-
};
|
|
150
|
-
const resultIdentifier = {
|
|
151
|
-
kind: "identifierExpression",
|
|
152
|
-
identifier: resultTemp.emittedName,
|
|
153
|
-
};
|
|
154
|
-
const [argAsts, argContext] = emitCallArguments(expr.arguments, expr, currentContext);
|
|
155
|
-
currentContext = argContext;
|
|
156
|
-
const mutationCall = {
|
|
157
|
-
kind: "invocationExpression",
|
|
158
|
-
expression: {
|
|
159
|
-
kind: "memberAccessExpression",
|
|
160
|
-
expression: wrapperIdentifier,
|
|
161
|
-
memberName: binding.member,
|
|
162
|
-
},
|
|
163
|
-
arguments: argAsts,
|
|
164
|
-
};
|
|
165
|
-
const mutatedArrayAst = {
|
|
166
|
-
kind: "invocationExpression",
|
|
167
|
-
expression: {
|
|
168
|
-
kind: "memberAccessExpression",
|
|
169
|
-
expression: wrapperIdentifier,
|
|
170
|
-
memberName: "toArray",
|
|
171
|
-
},
|
|
172
|
-
arguments: [],
|
|
173
|
-
};
|
|
174
|
-
let returnExpression = resultIdentifier;
|
|
175
|
-
if (expr.callee.property === "splice") {
|
|
176
|
-
returnExpression = {
|
|
177
|
-
kind: "invocationExpression",
|
|
178
|
-
expression: {
|
|
179
|
-
kind: "memberAccessExpression",
|
|
180
|
-
expression: resultIdentifier,
|
|
181
|
-
memberName: "toArray",
|
|
182
|
-
},
|
|
183
|
-
arguments: [],
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
else if (returnsMutatedArrayMember(expr.callee.property)) {
|
|
187
|
-
returnExpression = mutatedArrayAst;
|
|
188
|
-
}
|
|
189
|
-
const returnType = expr.inferredType ?? receiverType;
|
|
190
|
-
const [returnTypeAst, returnTypeContext] = emitTypeAst(returnType, currentContext);
|
|
191
|
-
currentContext = returnTypeContext;
|
|
192
|
-
const lambdaAst = {
|
|
193
|
-
kind: "lambdaExpression",
|
|
194
|
-
isAsync: false,
|
|
195
|
-
parameters: [],
|
|
196
|
-
body: {
|
|
197
|
-
kind: "blockStatement",
|
|
198
|
-
statements: [
|
|
199
|
-
...captured.setupStatements,
|
|
200
|
-
createVarLocal(wrapperTemp.emittedName, {
|
|
201
|
-
kind: "objectCreationExpression",
|
|
202
|
-
type: {
|
|
203
|
-
kind: "identifierType",
|
|
204
|
-
name: "global::Tsonic.JSRuntime.JSArray",
|
|
205
|
-
typeArguments: [elementTypeAst],
|
|
206
|
-
},
|
|
207
|
-
arguments: [captured.readExpression],
|
|
208
|
-
}),
|
|
209
|
-
createVarLocal(resultTemp.emittedName, mutationCall),
|
|
210
|
-
{
|
|
211
|
-
kind: "expressionStatement",
|
|
212
|
-
expression: {
|
|
213
|
-
kind: "assignmentExpression",
|
|
214
|
-
operatorToken: "=",
|
|
215
|
-
left: captured.writeExpression,
|
|
216
|
-
right: mutatedArrayAst,
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
kind: "returnStatement",
|
|
221
|
-
expression: returnExpression,
|
|
222
|
-
},
|
|
223
|
-
],
|
|
224
|
-
},
|
|
225
|
-
};
|
|
226
|
-
const delegateCastAst = {
|
|
227
|
-
kind: "castExpression",
|
|
228
|
-
type: buildDelegateType([], returnTypeAst),
|
|
229
|
-
expression: {
|
|
230
|
-
kind: "parenthesizedExpression",
|
|
231
|
-
expression: lambdaAst,
|
|
232
|
-
},
|
|
233
|
-
};
|
|
234
|
-
return [
|
|
235
|
-
wrapIntCast(needsIntCast(expr, expr.callee.property), {
|
|
236
|
-
kind: "invocationExpression",
|
|
237
|
-
expression: {
|
|
238
|
-
kind: "parenthesizedExpression",
|
|
239
|
-
expression: delegateCastAst,
|
|
240
|
-
},
|
|
241
|
-
arguments: [],
|
|
242
|
-
}),
|
|
243
|
-
currentContext,
|
|
244
|
-
];
|
|
245
|
-
};
|
|
246
|
-
const emitArrayWrapperInteropCall = (expr, context) => {
|
|
247
|
-
if (expr.isOptional)
|
|
248
|
-
return undefined;
|
|
249
|
-
if (expr.callee.kind !== "memberAccess")
|
|
250
|
-
return undefined;
|
|
251
|
-
if (expr.callee.isComputed)
|
|
252
|
-
return undefined;
|
|
253
|
-
if (typeof expr.callee.property !== "string")
|
|
254
|
-
return undefined;
|
|
255
|
-
const binding = expr.callee.memberBinding;
|
|
256
|
-
if (!binding || binding.isExtensionMethod)
|
|
257
|
-
return undefined;
|
|
258
|
-
const receiverType = expr.callee.object.inferredType;
|
|
259
|
-
if (!receiverType || receiverType.kind !== "arrayType")
|
|
260
|
-
return undefined;
|
|
261
|
-
const bindingType = binding.type;
|
|
262
|
-
if (bindingType === "System.Array" ||
|
|
263
|
-
bindingType === "global::System.Array" ||
|
|
264
|
-
bindingType.startsWith("System.Array`") ||
|
|
265
|
-
bindingType.startsWith("global::System.Array`")) {
|
|
266
|
-
return undefined;
|
|
16
|
+
import { identifierExpression, identifierType, } from "../../core/format/backend-ast/builders.js";
|
|
17
|
+
import { normalizeClrQualifiedName } from "../../core/format/backend-ast/utils.js";
|
|
18
|
+
import { resolveStructuralViewMethodSurface } from "../../core/semantic/structural-view-types.js";
|
|
19
|
+
// Import from split modules
|
|
20
|
+
import { emitDynamicImportCall } from "./call-dynamic-import.js";
|
|
21
|
+
import { emitJsonSerializerCall, emitGlobalJsonCall } from "./call-json.js";
|
|
22
|
+
import { emitGlobalSymbolCall } from "./call-symbol.js";
|
|
23
|
+
import { emitPromiseStaticCall, emitPromiseThenCatchFinally, buildDelegateType, } from "./call-promise.js";
|
|
24
|
+
import { emitArrayMutationInteropCall, emitArrayWrapperInteropCall, } from "./call-array-interop.js";
|
|
25
|
+
import { emitRuntimeUnionArrayIsArrayCall } from "./call-runtime-union-guards.js";
|
|
26
|
+
import { emitCallArguments, wrapIntCast } from "./call-arguments.js";
|
|
27
|
+
import { tryEmitExtensionMethodCall } from "./call-extension-methods.js";
|
|
28
|
+
import { stripClrGenericArity } from "../access-resolution.js";
|
|
29
|
+
const buildCallTargetExpectedType = (expr, preferParameterTypes = false) => {
|
|
30
|
+
const calleeType = expr.callee.inferredType;
|
|
31
|
+
if (!preferParameterTypes && calleeType?.kind === "functionType") {
|
|
32
|
+
return calleeType;
|
|
267
33
|
}
|
|
268
|
-
const
|
|
269
|
-
const
|
|
270
|
-
if (
|
|
34
|
+
const parameterTypes = expr.parameterTypes ?? expr.surfaceParameterTypes;
|
|
35
|
+
const restParameter = expr.restParameter ?? expr.surfaceRestParameter;
|
|
36
|
+
if (!parameterTypes || !expr.inferredType) {
|
|
271
37
|
return undefined;
|
|
272
|
-
let currentContext = context;
|
|
273
|
-
const [receiverAst, receiverContext] = emitExpressionAst(expr.callee.object, currentContext);
|
|
274
|
-
currentContext = receiverContext;
|
|
275
|
-
let typeArguments;
|
|
276
|
-
if (genericArity === 1) {
|
|
277
|
-
const [elementTypeAst, elementTypeContext] = emitTypeAst(receiverType.elementType, currentContext);
|
|
278
|
-
currentContext = elementTypeContext;
|
|
279
|
-
typeArguments = [elementTypeAst];
|
|
280
38
|
}
|
|
281
|
-
|
|
282
|
-
kind: "
|
|
283
|
-
|
|
284
|
-
kind: "
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
arguments: [receiverAst],
|
|
289
|
-
};
|
|
290
|
-
const [argAsts, argContext] = emitCallArguments(expr.arguments, expr, currentContext);
|
|
291
|
-
currentContext = argContext;
|
|
292
|
-
const invocation = {
|
|
293
|
-
kind: "invocationExpression",
|
|
294
|
-
expression: {
|
|
295
|
-
kind: "memberAccessExpression",
|
|
296
|
-
expression: wrapperAst,
|
|
297
|
-
memberName: binding.member,
|
|
298
|
-
},
|
|
299
|
-
arguments: argAsts,
|
|
300
|
-
};
|
|
301
|
-
const resultAst = expr.inferredType?.kind === "arrayType"
|
|
302
|
-
? {
|
|
303
|
-
kind: "invocationExpression",
|
|
304
|
-
expression: {
|
|
305
|
-
kind: "memberAccessExpression",
|
|
306
|
-
expression: invocation,
|
|
307
|
-
memberName: "toArray",
|
|
39
|
+
return {
|
|
40
|
+
kind: "functionType",
|
|
41
|
+
parameters: parameterTypes.map((parameterType, index) => ({
|
|
42
|
+
kind: "parameter",
|
|
43
|
+
pattern: {
|
|
44
|
+
kind: "identifierPattern",
|
|
45
|
+
name: `__tsonic_arg_${index}`,
|
|
308
46
|
},
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
if (typeAst.kind !== "identifierType")
|
|
319
|
-
return false;
|
|
320
|
-
const simple = typeAst.name.includes(".")
|
|
321
|
-
? typeAst.name.slice(typeAst.name.lastIndexOf(".") + 1)
|
|
322
|
-
: typeAst.name;
|
|
323
|
-
return simple === "Task";
|
|
324
|
-
};
|
|
325
|
-
const containsVoidTypeAst = (typeAst) => {
|
|
326
|
-
if (typeAst.kind === "predefinedType" && typeAst.keyword === "void") {
|
|
327
|
-
return true;
|
|
328
|
-
}
|
|
329
|
-
if (typeAst.kind === "identifierType") {
|
|
330
|
-
if (typeAst.name === "void" || typeAst.name.endsWith(".void")) {
|
|
331
|
-
return true;
|
|
332
|
-
}
|
|
333
|
-
return (typeAst.typeArguments ?? []).some((t) => containsVoidTypeAst(t));
|
|
334
|
-
}
|
|
335
|
-
if (typeAst.kind === "arrayType") {
|
|
336
|
-
return containsVoidTypeAst(typeAst.elementType);
|
|
337
|
-
}
|
|
338
|
-
if (typeAst.kind === "nullableType") {
|
|
339
|
-
return containsVoidTypeAst(typeAst.underlyingType);
|
|
340
|
-
}
|
|
341
|
-
if (typeAst.kind === "pointerType") {
|
|
342
|
-
return containsVoidTypeAst(typeAst.elementType);
|
|
343
|
-
}
|
|
344
|
-
if (typeAst.kind === "tupleType") {
|
|
345
|
-
return typeAst.elements.some((e) => containsVoidTypeAst(e.type));
|
|
346
|
-
}
|
|
347
|
-
return false;
|
|
348
|
-
};
|
|
349
|
-
const getTaskResultType = (typeAst) => isTaskTypeAst(typeAst) && typeAst.typeArguments?.length === 1
|
|
350
|
-
? typeAst.typeArguments[0]
|
|
351
|
-
: undefined;
|
|
352
|
-
const callbackParameterCount = (callbackExpr) => {
|
|
353
|
-
if (callbackExpr.kind === "arrowFunction" ||
|
|
354
|
-
callbackExpr.kind === "functionExpression") {
|
|
355
|
-
return callbackExpr.parameters.length;
|
|
356
|
-
}
|
|
357
|
-
const callbackType = callbackExpr.inferredType;
|
|
358
|
-
if (callbackType?.kind === "functionType") {
|
|
359
|
-
return callbackType.parameters.length;
|
|
360
|
-
}
|
|
361
|
-
return 1;
|
|
362
|
-
};
|
|
363
|
-
const collectBlockReturnTypes = (block) => {
|
|
364
|
-
const collectFromStatement = (statement) => {
|
|
365
|
-
switch (statement.kind) {
|
|
366
|
-
case "returnStatement":
|
|
367
|
-
return statement.expression?.inferredType
|
|
368
|
-
? [statement.expression.inferredType]
|
|
369
|
-
: [];
|
|
370
|
-
case "blockStatement":
|
|
371
|
-
return statement.statements.flatMap(collectFromStatement);
|
|
372
|
-
case "ifStatement":
|
|
373
|
-
return [
|
|
374
|
-
...collectFromStatement(statement.thenStatement),
|
|
375
|
-
...(statement.elseStatement
|
|
376
|
-
? collectFromStatement(statement.elseStatement)
|
|
377
|
-
: []),
|
|
378
|
-
];
|
|
379
|
-
case "whileStatement":
|
|
380
|
-
case "forStatement":
|
|
381
|
-
case "forOfStatement":
|
|
382
|
-
case "forInStatement":
|
|
383
|
-
return collectFromStatement(statement.body);
|
|
384
|
-
case "switchStatement":
|
|
385
|
-
return statement.cases.flatMap((switchCase) => switchCase.statements.flatMap(collectFromStatement));
|
|
386
|
-
case "tryStatement":
|
|
387
|
-
return [
|
|
388
|
-
...statement.tryBlock.statements.flatMap(collectFromStatement),
|
|
389
|
-
...(statement.catchClause
|
|
390
|
-
? statement.catchClause.body.statements.flatMap(collectFromStatement)
|
|
391
|
-
: []),
|
|
392
|
-
...(statement.finallyBlock
|
|
393
|
-
? statement.finallyBlock.statements.flatMap(collectFromStatement)
|
|
394
|
-
: []),
|
|
395
|
-
];
|
|
396
|
-
case "functionDeclaration":
|
|
397
|
-
case "classDeclaration":
|
|
398
|
-
case "interfaceDeclaration":
|
|
399
|
-
case "enumDeclaration":
|
|
400
|
-
case "typeAliasDeclaration":
|
|
401
|
-
return [];
|
|
402
|
-
default:
|
|
403
|
-
return [];
|
|
404
|
-
}
|
|
47
|
+
type: restParameter && restParameter.index === index
|
|
48
|
+
? (restParameter.arrayType ?? parameterType)
|
|
49
|
+
: parameterType,
|
|
50
|
+
initializer: undefined,
|
|
51
|
+
isOptional: false,
|
|
52
|
+
isRest: restParameter?.index === index,
|
|
53
|
+
passing: expr.argumentPassing?.[index] ?? "value",
|
|
54
|
+
})),
|
|
55
|
+
returnType: expr.inferredType,
|
|
405
56
|
};
|
|
406
|
-
return block.statements.flatMap(collectFromStatement);
|
|
407
57
|
};
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
if (concreteReturnTypes.length === 0) {
|
|
415
|
-
return undefined;
|
|
416
|
-
}
|
|
417
|
-
const deduped = concreteReturnTypes.filter((type, index, all) => all.findIndex((candidate) => stableIrTypeKey(candidate) === stableIrTypeKey(type)) === index);
|
|
418
|
-
if (deduped.length === 1) {
|
|
419
|
-
return deduped[0];
|
|
420
|
-
}
|
|
421
|
-
return {
|
|
422
|
-
kind: "unionType",
|
|
423
|
-
types: deduped,
|
|
424
|
-
};
|
|
58
|
+
const resolveStructuralViewCallParameterTypes = (callee, context) => resolveStructuralViewMethodSurface(callee, context)?.parameterTypes;
|
|
59
|
+
const extractTransparentIdentifier = (expr) => {
|
|
60
|
+
let current = expr;
|
|
61
|
+
while (current.kind === "typeAssertion" ||
|
|
62
|
+
current.kind === "numericNarrowing") {
|
|
63
|
+
current = current.expression;
|
|
425
64
|
}
|
|
426
|
-
return
|
|
65
|
+
return current.kind === "identifier" ? current : undefined;
|
|
427
66
|
};
|
|
428
|
-
const
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
const buildInvocation = (expression, args) => ({
|
|
433
|
-
kind: "invocationExpression",
|
|
434
|
-
expression,
|
|
435
|
-
arguments: args,
|
|
436
|
-
});
|
|
437
|
-
const buildAwait = (expression) => ({
|
|
438
|
-
kind: "awaitExpression",
|
|
439
|
-
expression,
|
|
440
|
-
});
|
|
441
|
-
const buildDelegateType = (parameterTypes, returnType) => {
|
|
442
|
-
const isVoidReturn = returnType?.kind === "predefinedType" && returnType.keyword === "void";
|
|
443
|
-
if (returnType === undefined) {
|
|
444
|
-
return parameterTypes.length === 0
|
|
445
|
-
? { kind: "identifierType", name: "global::System.Action" }
|
|
446
|
-
: {
|
|
447
|
-
kind: "identifierType",
|
|
448
|
-
name: "global::System.Action",
|
|
449
|
-
typeArguments: parameterTypes,
|
|
450
|
-
};
|
|
67
|
+
const normalizePromiseResolveCall = (expr, context) => {
|
|
68
|
+
const transparentCalleeIdentifier = extractTransparentIdentifier(expr.callee);
|
|
69
|
+
if (!transparentCalleeIdentifier) {
|
|
70
|
+
return expr;
|
|
451
71
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
return
|
|
455
|
-
? { kind: "identifierType", name: "global::System.Action" }
|
|
456
|
-
: {
|
|
457
|
-
kind: "identifierType",
|
|
458
|
-
name: "global::System.Action",
|
|
459
|
-
typeArguments: parameterTypes,
|
|
460
|
-
};
|
|
72
|
+
const promisedValueType = context.promiseResolveValueTypes?.get(transparentCalleeIdentifier.name);
|
|
73
|
+
if (!promisedValueType) {
|
|
74
|
+
return expr;
|
|
461
75
|
}
|
|
462
76
|
return {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
77
|
+
...expr,
|
|
78
|
+
callee: transparentCalleeIdentifier,
|
|
79
|
+
parameterTypes: [promisedValueType],
|
|
80
|
+
surfaceParameterTypes: [promisedValueType],
|
|
81
|
+
restParameter: undefined,
|
|
82
|
+
surfaceRestParameter: undefined,
|
|
466
83
|
};
|
|
467
84
|
};
|
|
468
|
-
const
|
|
469
|
-
|
|
470
|
-
type.kind === "unknownType" ||
|
|
471
|
-
(type.kind === "primitiveType" && type.name === "undefined");
|
|
472
|
-
const getCallbackReturnType = (callbackExpr) => {
|
|
473
|
-
if (callbackExpr.kind === "arrowFunction" &&
|
|
474
|
-
callbackExpr.body.kind !== "blockStatement" &&
|
|
475
|
-
!isVoidOrUnknownIrType(callbackExpr.body.inferredType)) {
|
|
476
|
-
return callbackExpr.body.inferredType;
|
|
477
|
-
}
|
|
478
|
-
const declared = callbackExpr.inferredType?.kind === "functionType"
|
|
479
|
-
? callbackExpr.inferredType.returnType
|
|
480
|
-
: undefined;
|
|
481
|
-
if (!isVoidOrUnknownIrType(declared)) {
|
|
482
|
-
return declared;
|
|
483
|
-
}
|
|
484
|
-
if (callbackExpr.kind === "arrowFunction" &&
|
|
485
|
-
callbackExpr.body.kind !== "blockStatement") {
|
|
486
|
-
return callbackExpr.body.inferredType;
|
|
487
|
-
}
|
|
488
|
-
return undefined;
|
|
489
|
-
};
|
|
490
|
-
const getFunctionValueSignature = (expr) => {
|
|
491
|
-
const calleeType = expr.callee.inferredType;
|
|
492
|
-
if (!calleeType || calleeType.kind !== "functionType")
|
|
493
|
-
return undefined;
|
|
494
|
-
if (expr.callee.kind === "identifier" && expr.callee.resolvedClrType) {
|
|
85
|
+
const tryGetCallableStaticAccessorCall = (expr) => {
|
|
86
|
+
if (expr.callee.kind !== "memberAccess") {
|
|
495
87
|
return undefined;
|
|
496
88
|
}
|
|
497
|
-
|
|
89
|
+
const memberBinding = expr.callee.memberBinding;
|
|
90
|
+
const kind = memberBinding?.emitSemantics?.callableStaticAccessorKind;
|
|
91
|
+
if (!memberBinding || !kind) {
|
|
498
92
|
return undefined;
|
|
499
93
|
}
|
|
500
|
-
return
|
|
501
|
-
};
|
|
502
|
-
const emitFunctionValueCallArguments = (args, signature, expr, context) => {
|
|
503
|
-
let currentContext = context;
|
|
504
|
-
const argAsts = [];
|
|
505
|
-
const parameters = signature.parameters;
|
|
506
|
-
const extractTupleRestCandidates = (type) => {
|
|
507
|
-
if (!type)
|
|
508
|
-
return undefined;
|
|
509
|
-
if (type.kind === "tupleType") {
|
|
510
|
-
return [type.elementTypes];
|
|
511
|
-
}
|
|
512
|
-
if (type.kind !== "unionType") {
|
|
513
|
-
return undefined;
|
|
514
|
-
}
|
|
515
|
-
const candidates = [];
|
|
516
|
-
for (const member of type.types) {
|
|
517
|
-
if (!member || member.kind !== "tupleType") {
|
|
518
|
-
return undefined;
|
|
519
|
-
}
|
|
520
|
-
candidates.push(member.elementTypes);
|
|
521
|
-
}
|
|
522
|
-
return candidates;
|
|
523
|
-
};
|
|
524
|
-
const tryEmitTupleRestArguments = (startIndex, parameterType) => {
|
|
525
|
-
const remainingArgs = args.slice(startIndex);
|
|
526
|
-
if (remainingArgs.some((arg) => arg?.kind === "spread")) {
|
|
527
|
-
return undefined;
|
|
528
|
-
}
|
|
529
|
-
const tupleCandidates = extractTupleRestCandidates(parameterType);
|
|
530
|
-
if (!tupleCandidates || tupleCandidates.length === 0) {
|
|
531
|
-
return undefined;
|
|
532
|
-
}
|
|
533
|
-
const matchingCandidates = tupleCandidates.filter((candidate) => candidate.length === remainingArgs.length);
|
|
534
|
-
if (matchingCandidates.length !== 1) {
|
|
535
|
-
return undefined;
|
|
536
|
-
}
|
|
537
|
-
const tupleElements = matchingCandidates[0] ?? [];
|
|
538
|
-
const emittedArgs = [];
|
|
539
|
-
let tupleContext = currentContext;
|
|
540
|
-
for (let index = 0; index < remainingArgs.length; index++) {
|
|
541
|
-
const arg = remainingArgs[index];
|
|
542
|
-
const expectedType = tupleElements[index];
|
|
543
|
-
if (!arg)
|
|
544
|
-
continue;
|
|
545
|
-
const [argAst, argContext] = emitExpressionAst(arg, tupleContext, expectedType);
|
|
546
|
-
emittedArgs.push(argAst);
|
|
547
|
-
tupleContext = argContext;
|
|
548
|
-
}
|
|
549
|
-
return [emittedArgs, tupleContext];
|
|
550
|
-
};
|
|
551
|
-
for (let i = 0; i < parameters.length; i++) {
|
|
552
|
-
const parameter = parameters[i];
|
|
553
|
-
if (!parameter)
|
|
554
|
-
continue;
|
|
555
|
-
if (parameter.isRest) {
|
|
556
|
-
const tupleRestResult = tryEmitTupleRestArguments(i, parameter.type);
|
|
557
|
-
if (tupleRestResult) {
|
|
558
|
-
const [tupleArgs, tupleContext] = tupleRestResult;
|
|
559
|
-
argAsts.push(...tupleArgs);
|
|
560
|
-
currentContext = tupleContext;
|
|
561
|
-
break;
|
|
562
|
-
}
|
|
563
|
-
const spreadArg = args[i];
|
|
564
|
-
if (args.length === i + 1 && spreadArg && spreadArg.kind === "spread") {
|
|
565
|
-
const [spreadAst, spreadCtx] = emitExpressionAst(spreadArg.expression, currentContext);
|
|
566
|
-
argAsts.push(spreadAst);
|
|
567
|
-
currentContext = spreadCtx;
|
|
568
|
-
break;
|
|
569
|
-
}
|
|
570
|
-
const restElementType = parameter.type?.kind === "arrayType"
|
|
571
|
-
? parameter.type.elementType
|
|
572
|
-
: undefined;
|
|
573
|
-
let elementTypeAst = {
|
|
574
|
-
kind: "identifierType",
|
|
575
|
-
name: "object",
|
|
576
|
-
};
|
|
577
|
-
if (restElementType) {
|
|
578
|
-
const [emittedType, typeCtx] = emitTypeAst(restElementType, currentContext);
|
|
579
|
-
elementTypeAst = emittedType;
|
|
580
|
-
currentContext = typeCtx;
|
|
581
|
-
}
|
|
582
|
-
const restItems = [];
|
|
583
|
-
for (let j = i; j < args.length; j++) {
|
|
584
|
-
const arg = args[j];
|
|
585
|
-
if (!arg)
|
|
586
|
-
continue;
|
|
587
|
-
if (arg.kind === "spread") {
|
|
588
|
-
const [spreadAst, spreadCtx] = emitExpressionAst(arg.expression, currentContext);
|
|
589
|
-
argAsts.push(spreadAst);
|
|
590
|
-
currentContext = spreadCtx;
|
|
591
|
-
return [argAsts, currentContext];
|
|
592
|
-
}
|
|
593
|
-
const [argAst, argCtx] = emitExpressionAst(arg, currentContext, restElementType);
|
|
594
|
-
restItems.push(argAst);
|
|
595
|
-
currentContext = argCtx;
|
|
596
|
-
}
|
|
597
|
-
argAsts.push({
|
|
598
|
-
kind: "arrayCreationExpression",
|
|
599
|
-
elementType: elementTypeAst,
|
|
600
|
-
initializer: restItems,
|
|
601
|
-
});
|
|
602
|
-
break;
|
|
603
|
-
}
|
|
604
|
-
const arg = args[i];
|
|
605
|
-
if (arg) {
|
|
606
|
-
const [argAst, argCtx] = emitExpressionAst(arg, currentContext, parameter.type);
|
|
607
|
-
const modifier = expr.argumentPassing?.[i] &&
|
|
608
|
-
expr.argumentPassing[i] !== "value" &&
|
|
609
|
-
isLValue(arg)
|
|
610
|
-
? expr.argumentPassing[i]
|
|
611
|
-
: undefined;
|
|
612
|
-
argAsts.push(wrapArgModifier(modifier, argAst));
|
|
613
|
-
currentContext = argCtx;
|
|
614
|
-
continue;
|
|
615
|
-
}
|
|
616
|
-
if (parameter.isOptional || parameter.initializer) {
|
|
617
|
-
let defaultType;
|
|
618
|
-
if (parameter.type) {
|
|
619
|
-
const [emittedType, typeCtx] = emitTypeAst(parameter.type, currentContext);
|
|
620
|
-
currentContext = typeCtx;
|
|
621
|
-
defaultType =
|
|
622
|
-
parameter.isOptional || parameter.initializer
|
|
623
|
-
? emittedType.kind === "nullableType"
|
|
624
|
-
? emittedType
|
|
625
|
-
: { kind: "nullableType", underlyingType: emittedType }
|
|
626
|
-
: emittedType;
|
|
627
|
-
}
|
|
628
|
-
argAsts.push({ kind: "defaultExpression", type: defaultType });
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
return [argAsts, currentContext];
|
|
94
|
+
return { kind, binding: memberBinding };
|
|
632
95
|
};
|
|
633
|
-
const
|
|
634
|
-
if (
|
|
635
|
-
return
|
|
636
|
-
if (type.kind === "arrayType" || type.kind === "tupleType") {
|
|
637
|
-
return true;
|
|
96
|
+
const getCallableStaticAccessorOwnerTypeArgs = (expr, expectedArity) => {
|
|
97
|
+
if (expectedArity === 0) {
|
|
98
|
+
return [];
|
|
638
99
|
}
|
|
639
|
-
if (
|
|
640
|
-
return
|
|
100
|
+
if (expr.typeArguments?.length === expectedArity) {
|
|
101
|
+
return expr.typeArguments;
|
|
641
102
|
}
|
|
642
|
-
|
|
643
|
-
|
|
103
|
+
const inferredResult = expr.inferredType;
|
|
104
|
+
if (inferredResult?.kind === "referenceType" &&
|
|
105
|
+
inferredResult.typeArguments?.length === expectedArity) {
|
|
106
|
+
return inferredResult.typeArguments;
|
|
644
107
|
}
|
|
645
|
-
|
|
646
|
-
return (simpleName === "Array" ||
|
|
647
|
-
simpleName === "ReadonlyArray" ||
|
|
648
|
-
simpleName === "JSArray" ||
|
|
649
|
-
simpleName === "Iterable" ||
|
|
650
|
-
simpleName === "IterableIterator" ||
|
|
651
|
-
simpleName === "IEnumerable" ||
|
|
652
|
-
simpleName === "IReadOnlyList" ||
|
|
653
|
-
simpleName === "List");
|
|
108
|
+
throw new Error(`Internal Compiler Error: callable static accessor call '${expectedArity}' generic arity could not be specialized from call-site type arguments.`);
|
|
654
109
|
};
|
|
655
|
-
const
|
|
656
|
-
if (
|
|
657
|
-
|
|
658
|
-
}
|
|
659
|
-
const index = parameterTypes.length - 1;
|
|
660
|
-
const lastParamType = parameterTypes[index];
|
|
661
|
-
if (!lastParamType || lastParamType.kind !== "arrayType") {
|
|
662
|
-
return undefined;
|
|
663
|
-
}
|
|
664
|
-
if (args.length > parameterTypes.length) {
|
|
665
|
-
return {
|
|
666
|
-
index,
|
|
667
|
-
arrayType: lastParamType,
|
|
668
|
-
elementType: lastParamType.elementType,
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
const restArgs = args.slice(index);
|
|
672
|
-
if (restArgs.some((arg) => arg?.kind === "spread")) {
|
|
673
|
-
return {
|
|
674
|
-
index,
|
|
675
|
-
arrayType: lastParamType,
|
|
676
|
-
elementType: lastParamType.elementType,
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
const lastArg = args[index];
|
|
680
|
-
if (!lastArg) {
|
|
681
|
-
return undefined;
|
|
110
|
+
const emitCallableStaticAccessorCall = (expr, binding, context) => {
|
|
111
|
+
if (expr.arguments.length !== 0) {
|
|
112
|
+
throw new Error(`Internal Compiler Error: callable static accessor '${binding.type}.${binding.member}' was invoked with arguments.`);
|
|
682
113
|
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
: lastArg.inferredType;
|
|
686
|
-
if (!isArrayLikeIrType(lastArgType)) {
|
|
687
|
-
return {
|
|
688
|
-
index,
|
|
689
|
-
arrayType: lastParamType,
|
|
690
|
-
elementType: lastParamType.elementType,
|
|
691
|
-
};
|
|
114
|
+
if (expr.isOptional) {
|
|
115
|
+
throw new Error(`Internal Compiler Error: callable static accessor '${binding.type}.${binding.member}' cannot be optional.`);
|
|
692
116
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
const
|
|
117
|
+
const arityText = binding.type.match(/`(\d+)$/)?.[1];
|
|
118
|
+
const genericArity = arityText ? Number.parseInt(arityText, 10) : 0;
|
|
119
|
+
const ownerTypeArgs = getCallableStaticAccessorOwnerTypeArgs(expr, genericArity);
|
|
696
120
|
let currentContext = context;
|
|
697
|
-
const
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
if (inlineElements.length === 0)
|
|
703
|
-
return;
|
|
704
|
-
segments.push({
|
|
705
|
-
kind: "arrayCreationExpression",
|
|
706
|
-
elementType: elementTypeAst,
|
|
707
|
-
initializer: inlineElements,
|
|
708
|
-
});
|
|
709
|
-
inlineElements = [];
|
|
710
|
-
};
|
|
711
|
-
for (const arg of restArgs) {
|
|
712
|
-
if (!arg)
|
|
713
|
-
continue;
|
|
714
|
-
if (arg.kind === "spread") {
|
|
715
|
-
flushInlineElements();
|
|
716
|
-
const [spreadAst, spreadContext] = emitExpressionAst(arg.expression, currentContext);
|
|
717
|
-
segments.push(spreadAst);
|
|
718
|
-
currentContext = spreadContext;
|
|
719
|
-
continue;
|
|
720
|
-
}
|
|
721
|
-
const [argAst, argContext] = emitExpressionAst(arg, currentContext, restElementType);
|
|
722
|
-
inlineElements.push(argAst);
|
|
723
|
-
currentContext = argContext;
|
|
724
|
-
}
|
|
725
|
-
flushInlineElements();
|
|
726
|
-
if (segments.length === 0) {
|
|
727
|
-
return [
|
|
728
|
-
[
|
|
729
|
-
{
|
|
730
|
-
kind: "invocationExpression",
|
|
731
|
-
expression: {
|
|
732
|
-
kind: "identifierExpression",
|
|
733
|
-
identifier: "global::System.Array.Empty",
|
|
734
|
-
},
|
|
735
|
-
typeArguments: [elementTypeAst],
|
|
736
|
-
arguments: [],
|
|
737
|
-
},
|
|
738
|
-
],
|
|
739
|
-
currentContext,
|
|
740
|
-
];
|
|
741
|
-
}
|
|
742
|
-
let concatAst = segments[0];
|
|
743
|
-
for (let index = 1; index < segments.length; index++) {
|
|
744
|
-
concatAst = {
|
|
745
|
-
kind: "invocationExpression",
|
|
746
|
-
expression: {
|
|
747
|
-
kind: "identifierExpression",
|
|
748
|
-
identifier: "global::System.Linq.Enumerable.Concat",
|
|
749
|
-
},
|
|
750
|
-
arguments: [concatAst, segments[index]],
|
|
751
|
-
};
|
|
121
|
+
const ownerTypeArgAsts = [];
|
|
122
|
+
for (const typeArgument of ownerTypeArgs) {
|
|
123
|
+
const [typeArgAst, typeArgContext] = emitTypeAst(typeArgument, currentContext);
|
|
124
|
+
ownerTypeArgAsts.push(typeArgAst);
|
|
125
|
+
currentContext = typeArgContext;
|
|
752
126
|
}
|
|
127
|
+
const ownerTypeAst = identifierType(normalizeClrQualifiedName(stripClrGenericArity(binding.type), true), ownerTypeArgAsts.length > 0 ? ownerTypeArgAsts : undefined);
|
|
753
128
|
return [
|
|
754
|
-
|
|
755
|
-
{
|
|
756
|
-
kind: "invocationExpression",
|
|
757
|
-
expression: {
|
|
758
|
-
kind: "identifierExpression",
|
|
759
|
-
identifier: "global::System.Linq.Enumerable.ToArray",
|
|
760
|
-
},
|
|
761
|
-
arguments: [concatAst],
|
|
762
|
-
},
|
|
763
|
-
],
|
|
764
|
-
currentContext,
|
|
765
|
-
];
|
|
766
|
-
};
|
|
767
|
-
const stableIrTypeKey = (type) => JSON.stringify(type);
|
|
768
|
-
const isAsyncWrapperIrTypeLike = (type) => {
|
|
769
|
-
return isAwaitableIrType(type);
|
|
770
|
-
};
|
|
771
|
-
const containsPromiseChainArtifact = (type) => {
|
|
772
|
-
if (!type)
|
|
773
|
-
return false;
|
|
774
|
-
if (isAsyncWrapperIrTypeLike(type)) {
|
|
775
|
-
return true;
|
|
776
|
-
}
|
|
777
|
-
if (type.kind === "unionType" || type.kind === "intersectionType") {
|
|
778
|
-
return type.types.some((member) => !!member && containsPromiseChainArtifact(member));
|
|
779
|
-
}
|
|
780
|
-
return false;
|
|
781
|
-
};
|
|
782
|
-
const normalizePromiseChainResultIrType = (type) => {
|
|
783
|
-
if (!type)
|
|
784
|
-
return undefined;
|
|
785
|
-
const awaited = getAwaitedIrType(type);
|
|
786
|
-
if (awaited) {
|
|
787
|
-
return awaited.kind === "voidType"
|
|
788
|
-
? awaited
|
|
789
|
-
: normalizePromiseChainResultIrType(awaited);
|
|
790
|
-
}
|
|
791
|
-
if (type.kind === "unionType") {
|
|
792
|
-
const normalizedTypes = [];
|
|
793
|
-
const seen = new Set();
|
|
794
|
-
for (const member of type.types) {
|
|
795
|
-
if (!member)
|
|
796
|
-
continue;
|
|
797
|
-
const normalized = normalizePromiseChainResultIrType(member);
|
|
798
|
-
if (!normalized)
|
|
799
|
-
continue;
|
|
800
|
-
const key = stableIrTypeKey(normalized);
|
|
801
|
-
if (seen.has(key))
|
|
802
|
-
continue;
|
|
803
|
-
seen.add(key);
|
|
804
|
-
normalizedTypes.push(normalized);
|
|
805
|
-
}
|
|
806
|
-
if (normalizedTypes.length === 0)
|
|
807
|
-
return undefined;
|
|
808
|
-
if (normalizedTypes.length === 1)
|
|
809
|
-
return normalizedTypes[0];
|
|
810
|
-
return {
|
|
811
|
-
kind: "unionType",
|
|
812
|
-
types: normalizedTypes,
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
return type;
|
|
816
|
-
};
|
|
817
|
-
const mergePromiseChainResultIrTypes = (...types) => {
|
|
818
|
-
const merged = [];
|
|
819
|
-
const seen = new Set();
|
|
820
|
-
for (const type of types) {
|
|
821
|
-
const normalized = normalizePromiseChainResultIrType(type);
|
|
822
|
-
if (!normalized)
|
|
823
|
-
continue;
|
|
824
|
-
if (normalized.kind === "unionType") {
|
|
825
|
-
for (const member of normalized.types) {
|
|
826
|
-
if (!member)
|
|
827
|
-
continue;
|
|
828
|
-
const key = stableIrTypeKey(member);
|
|
829
|
-
if (seen.has(key))
|
|
830
|
-
continue;
|
|
831
|
-
seen.add(key);
|
|
832
|
-
merged.push(member);
|
|
833
|
-
}
|
|
834
|
-
continue;
|
|
835
|
-
}
|
|
836
|
-
const key = stableIrTypeKey(normalized);
|
|
837
|
-
if (seen.has(key))
|
|
838
|
-
continue;
|
|
839
|
-
seen.add(key);
|
|
840
|
-
merged.push(normalized);
|
|
841
|
-
}
|
|
842
|
-
if (merged.length === 0)
|
|
843
|
-
return undefined;
|
|
844
|
-
if (merged.length === 1)
|
|
845
|
-
return merged[0];
|
|
846
|
-
return {
|
|
847
|
-
kind: "unionType",
|
|
848
|
-
types: merged,
|
|
849
|
-
};
|
|
850
|
-
};
|
|
851
|
-
const buildTaskTypeAst = (resultType) => resultType
|
|
852
|
-
? {
|
|
853
|
-
kind: "identifierType",
|
|
854
|
-
name: "global::System.Threading.Tasks.Task",
|
|
855
|
-
typeArguments: [resultType],
|
|
856
|
-
}
|
|
857
|
-
: {
|
|
858
|
-
kind: "identifierType",
|
|
859
|
-
name: "global::System.Threading.Tasks.Task",
|
|
860
|
-
};
|
|
861
|
-
const buildTaskRunInvocation = (outputTaskType, body, isAsync) => {
|
|
862
|
-
const resultType = getTaskResultType(outputTaskType);
|
|
863
|
-
return {
|
|
864
|
-
kind: "invocationExpression",
|
|
865
|
-
expression: {
|
|
129
|
+
{
|
|
866
130
|
kind: "memberAccessExpression",
|
|
867
131
|
expression: {
|
|
868
|
-
kind: "
|
|
869
|
-
|
|
870
|
-
},
|
|
871
|
-
memberName: "Run",
|
|
872
|
-
},
|
|
873
|
-
arguments: [
|
|
874
|
-
{
|
|
875
|
-
kind: "lambdaExpression",
|
|
876
|
-
isAsync,
|
|
877
|
-
parameters: [],
|
|
878
|
-
body,
|
|
879
|
-
},
|
|
880
|
-
],
|
|
881
|
-
typeArguments: resultType ? [resultType] : undefined,
|
|
882
|
-
};
|
|
883
|
-
};
|
|
884
|
-
const buildCompletedTaskAst = () => ({
|
|
885
|
-
kind: "memberAccessExpression",
|
|
886
|
-
expression: {
|
|
887
|
-
kind: "identifierExpression",
|
|
888
|
-
identifier: "global::System.Threading.Tasks.Task",
|
|
889
|
-
},
|
|
890
|
-
memberName: "CompletedTask",
|
|
891
|
-
});
|
|
892
|
-
const buildPromiseRejectedExceptionAst = (reasonAst) => {
|
|
893
|
-
const reasonExpr = reasonAst ??
|
|
894
|
-
{
|
|
895
|
-
kind: "literalExpression",
|
|
896
|
-
text: "null",
|
|
897
|
-
};
|
|
898
|
-
return {
|
|
899
|
-
kind: "binaryExpression",
|
|
900
|
-
operatorToken: "??",
|
|
901
|
-
left: {
|
|
902
|
-
kind: "asExpression",
|
|
903
|
-
expression: reasonExpr,
|
|
904
|
-
type: {
|
|
905
|
-
kind: "identifierType",
|
|
906
|
-
name: "global::System.Exception",
|
|
907
|
-
},
|
|
908
|
-
},
|
|
909
|
-
right: {
|
|
910
|
-
kind: "objectCreationExpression",
|
|
911
|
-
type: {
|
|
912
|
-
kind: "identifierType",
|
|
913
|
-
name: "global::System.Exception",
|
|
132
|
+
kind: "typeReferenceExpression",
|
|
133
|
+
type: ownerTypeAst,
|
|
914
134
|
},
|
|
915
|
-
|
|
916
|
-
{
|
|
917
|
-
kind: "binaryExpression",
|
|
918
|
-
operatorToken: "??",
|
|
919
|
-
left: {
|
|
920
|
-
kind: "invocationExpression",
|
|
921
|
-
expression: {
|
|
922
|
-
kind: "conditionalMemberAccessExpression",
|
|
923
|
-
expression: reasonExpr,
|
|
924
|
-
memberName: "ToString",
|
|
925
|
-
},
|
|
926
|
-
arguments: [],
|
|
927
|
-
},
|
|
928
|
-
right: {
|
|
929
|
-
kind: "literalExpression",
|
|
930
|
-
text: '"Promise rejected"',
|
|
931
|
-
},
|
|
932
|
-
},
|
|
933
|
-
],
|
|
135
|
+
memberName: binding.member,
|
|
934
136
|
},
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
const getPromiseStaticMethod = (expr) => {
|
|
938
|
-
if (expr.callee.kind !== "memberAccess")
|
|
939
|
-
return undefined;
|
|
940
|
-
if (expr.callee.isComputed)
|
|
941
|
-
return undefined;
|
|
942
|
-
if (typeof expr.callee.property !== "string")
|
|
943
|
-
return undefined;
|
|
944
|
-
if (expr.callee.object.kind !== "identifier")
|
|
945
|
-
return undefined;
|
|
946
|
-
const objectName = expr.callee.object.originalName ?? expr.callee.object.name;
|
|
947
|
-
const simpleObjectName = objectName.split(".").pop() ?? objectName;
|
|
948
|
-
if (simpleObjectName !== "Promise")
|
|
949
|
-
return undefined;
|
|
950
|
-
switch (expr.callee.property) {
|
|
951
|
-
case "resolve":
|
|
952
|
-
case "reject":
|
|
953
|
-
case "all":
|
|
954
|
-
case "race":
|
|
955
|
-
return expr.callee.property;
|
|
956
|
-
default:
|
|
957
|
-
return undefined;
|
|
958
|
-
}
|
|
137
|
+
currentContext,
|
|
138
|
+
];
|
|
959
139
|
};
|
|
960
|
-
const
|
|
961
|
-
if (
|
|
962
|
-
return
|
|
963
|
-
if (type.kind === "arrayType")
|
|
964
|
-
return type.elementType;
|
|
965
|
-
if (type.kind === "tupleType") {
|
|
966
|
-
if (type.elementTypes.length === 0)
|
|
967
|
-
return undefined;
|
|
968
|
-
if (type.elementTypes.length === 1)
|
|
969
|
-
return type.elementTypes[0];
|
|
970
|
-
return { kind: "unionType", types: type.elementTypes };
|
|
140
|
+
const castInvokedLambdaTarget = (calleeExpr, calleeType, context) => {
|
|
141
|
+
if (calleeExpr.kind !== "lambdaExpression") {
|
|
142
|
+
return [calleeExpr, context];
|
|
971
143
|
}
|
|
972
|
-
if (
|
|
973
|
-
type.
|
|
974
|
-
type.typeArguments.length > 0) {
|
|
975
|
-
const simpleName = type.name.split(".").pop() ?? type.name;
|
|
976
|
-
switch (simpleName) {
|
|
977
|
-
case "Array":
|
|
978
|
-
case "ReadonlyArray":
|
|
979
|
-
case "Iterable":
|
|
980
|
-
case "IterableIterator":
|
|
981
|
-
case "IEnumerable":
|
|
982
|
-
case "IReadOnlyList":
|
|
983
|
-
case "List":
|
|
984
|
-
case "Set":
|
|
985
|
-
case "ReadonlySet":
|
|
986
|
-
case "JSArray":
|
|
987
|
-
return type.typeArguments[0];
|
|
988
|
-
default:
|
|
989
|
-
return undefined;
|
|
990
|
-
}
|
|
144
|
+
if (!calleeType || calleeType.kind !== "functionType") {
|
|
145
|
+
throw new Error("Internal Compiler Error: Immediately-invoked function expression reached call emission without a concrete function type.");
|
|
991
146
|
}
|
|
992
|
-
return undefined;
|
|
993
|
-
};
|
|
994
|
-
const isValueTaskLikeIrType = (type) => {
|
|
995
|
-
if (!type || type.kind !== "referenceType")
|
|
996
|
-
return false;
|
|
997
|
-
const simpleName = type.name.split(".").pop() ?? type.name;
|
|
998
|
-
const clrName = type.resolvedClrType ?? type.name;
|
|
999
|
-
return (simpleName === "ValueTask" ||
|
|
1000
|
-
simpleName === "ValueTask_1" ||
|
|
1001
|
-
simpleName === "ValueTask`1" ||
|
|
1002
|
-
clrName === "System.Threading.Tasks.ValueTask" ||
|
|
1003
|
-
clrName.startsWith("System.Threading.Tasks.ValueTask`1"));
|
|
1004
|
-
};
|
|
1005
|
-
const emitPromiseNormalizedTaskAst = (valueAst, valueType, resultTypeAst, context) => {
|
|
1006
147
|
let currentContext = context;
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
kind: "invocationExpression",
|
|
1012
|
-
expression: {
|
|
1013
|
-
kind: "memberAccessExpression",
|
|
1014
|
-
expression: valueAst,
|
|
1015
|
-
memberName: "AsTask",
|
|
1016
|
-
},
|
|
1017
|
-
arguments: [],
|
|
1018
|
-
},
|
|
1019
|
-
currentContext,
|
|
1020
|
-
];
|
|
148
|
+
const parameterTypeAsts = [];
|
|
149
|
+
for (const parameter of calleeType.parameters) {
|
|
150
|
+
if (!parameter?.type) {
|
|
151
|
+
throw new Error("Internal Compiler Error: Function-expression invocation parameter is missing a concrete type.");
|
|
1021
152
|
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
const arms = [];
|
|
1026
|
-
for (let index = 0; index < valueType.types.length; index++) {
|
|
1027
|
-
const memberType = valueType.types[index];
|
|
1028
|
-
if (!memberType)
|
|
1029
|
-
continue;
|
|
1030
|
-
const [memberTypeAst, memberTypeContext] = emitTypeAst(memberType, currentContext);
|
|
1031
|
-
currentContext = memberTypeContext;
|
|
1032
|
-
const memberName = `__tsonic_promise_value_${index}`;
|
|
1033
|
-
const [normalizedArm, normalizedContext] = emitPromiseNormalizedTaskAst({
|
|
1034
|
-
kind: "identifierExpression",
|
|
1035
|
-
identifier: memberName,
|
|
1036
|
-
}, memberType, resultTypeAst, currentContext);
|
|
1037
|
-
currentContext = normalizedContext;
|
|
1038
|
-
arms.push({
|
|
1039
|
-
kind: "lambdaExpression",
|
|
1040
|
-
isAsync: false,
|
|
1041
|
-
parameters: [{ name: memberName, type: memberTypeAst }],
|
|
1042
|
-
body: normalizedArm,
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
return [
|
|
1046
|
-
{
|
|
1047
|
-
kind: "invocationExpression",
|
|
1048
|
-
expression: {
|
|
1049
|
-
kind: "memberAccessExpression",
|
|
1050
|
-
expression: valueAst,
|
|
1051
|
-
memberName: "Match",
|
|
1052
|
-
},
|
|
1053
|
-
arguments: arms,
|
|
1054
|
-
},
|
|
1055
|
-
currentContext,
|
|
1056
|
-
];
|
|
1057
|
-
}
|
|
1058
|
-
if (!resultTypeAst) {
|
|
1059
|
-
return [buildCompletedTaskAst(), currentContext];
|
|
153
|
+
const [parameterTypeAst, parameterTypeContext] = emitTypeAst(parameter.type, currentContext);
|
|
154
|
+
parameterTypeAsts.push(parameterTypeAst);
|
|
155
|
+
currentContext = parameterTypeContext;
|
|
1060
156
|
}
|
|
157
|
+
const [returnTypeAst, returnTypeContext] = emitTypeAst(calleeType.returnType, currentContext);
|
|
1061
158
|
return [
|
|
1062
159
|
{
|
|
1063
|
-
kind: "
|
|
1064
|
-
expression: {
|
|
1065
|
-
kind: "memberAccessExpression",
|
|
1066
|
-
expression: {
|
|
1067
|
-
kind: "identifierExpression",
|
|
1068
|
-
identifier: "global::System.Threading.Tasks.Task",
|
|
1069
|
-
},
|
|
1070
|
-
memberName: "FromResult",
|
|
1071
|
-
},
|
|
1072
|
-
typeArguments: [resultTypeAst],
|
|
1073
|
-
arguments: [valueAst],
|
|
1074
|
-
},
|
|
1075
|
-
currentContext,
|
|
1076
|
-
];
|
|
1077
|
-
};
|
|
1078
|
-
const emitPromiseStaticCall = (expr, context) => {
|
|
1079
|
-
const method = getPromiseStaticMethod(expr);
|
|
1080
|
-
if (!method)
|
|
1081
|
-
return null;
|
|
1082
|
-
let currentContext = context;
|
|
1083
|
-
const [outputTaskType, outputTaskContext] = emitTypeAst(expr.inferredType ?? {
|
|
1084
|
-
kind: "referenceType",
|
|
1085
|
-
name: "Promise",
|
|
1086
|
-
typeArguments: [{ kind: "referenceType", name: "object" }],
|
|
1087
|
-
}, currentContext);
|
|
1088
|
-
currentContext = outputTaskContext;
|
|
1089
|
-
const outputResultType = getTaskResultType(outputTaskType);
|
|
1090
|
-
if (method === "resolve") {
|
|
1091
|
-
const argument = expr.arguments[0];
|
|
1092
|
-
if (!argument) {
|
|
1093
|
-
return [buildCompletedTaskAst(), currentContext];
|
|
1094
|
-
}
|
|
1095
|
-
const [valueAst, valueContext] = emitExpressionAst(argument, currentContext, argument.inferredType);
|
|
1096
|
-
currentContext = valueContext;
|
|
1097
|
-
return emitPromiseNormalizedTaskAst(valueAst, argument.inferredType, outputResultType, currentContext);
|
|
1098
|
-
}
|
|
1099
|
-
if (method === "reject") {
|
|
1100
|
-
const reason = expr.arguments[0];
|
|
1101
|
-
let reasonAst;
|
|
1102
|
-
if (reason) {
|
|
1103
|
-
[reasonAst, currentContext] = emitExpressionAst(reason, currentContext, reason.inferredType);
|
|
1104
|
-
}
|
|
1105
|
-
const exceptionAst = buildPromiseRejectedExceptionAst(reasonAst);
|
|
1106
|
-
return [
|
|
1107
|
-
{
|
|
1108
|
-
kind: "invocationExpression",
|
|
1109
|
-
expression: {
|
|
1110
|
-
kind: "memberAccessExpression",
|
|
1111
|
-
expression: {
|
|
1112
|
-
kind: "identifierExpression",
|
|
1113
|
-
identifier: "global::System.Threading.Tasks.Task",
|
|
1114
|
-
},
|
|
1115
|
-
memberName: "FromException",
|
|
1116
|
-
},
|
|
1117
|
-
typeArguments: outputResultType ? [outputResultType] : undefined,
|
|
1118
|
-
arguments: [exceptionAst],
|
|
1119
|
-
},
|
|
1120
|
-
currentContext,
|
|
1121
|
-
];
|
|
1122
|
-
}
|
|
1123
|
-
const valuesArg = expr.arguments[0];
|
|
1124
|
-
if (!valuesArg)
|
|
1125
|
-
return null;
|
|
1126
|
-
const [valuesAst, valuesContext] = emitExpressionAst(valuesArg, currentContext, valuesArg.inferredType);
|
|
1127
|
-
currentContext = valuesContext;
|
|
1128
|
-
const inputElementType = getSequenceElementIrType(valuesArg.inferredType);
|
|
1129
|
-
const resultElementTypeAst = outputResultType?.kind === "arrayType"
|
|
1130
|
-
? outputResultType.elementType
|
|
1131
|
-
: outputResultType;
|
|
1132
|
-
let normalizedValuesAst = valuesAst;
|
|
1133
|
-
if (inputElementType) {
|
|
1134
|
-
const [inputElementTypeAst, inputElementContext] = emitTypeAst(inputElementType, currentContext);
|
|
1135
|
-
currentContext = inputElementContext;
|
|
1136
|
-
const [normalizedTaskAst, normalizedTaskContext] = emitPromiseNormalizedTaskAst({
|
|
1137
|
-
kind: "identifierExpression",
|
|
1138
|
-
identifier: "__tsonic_promise_item",
|
|
1139
|
-
}, inputElementType, resultElementTypeAst, currentContext);
|
|
1140
|
-
currentContext = normalizedTaskContext;
|
|
1141
|
-
normalizedValuesAst = {
|
|
1142
|
-
kind: "invocationExpression",
|
|
160
|
+
kind: "parenthesizedExpression",
|
|
1143
161
|
expression: {
|
|
1144
|
-
kind: "
|
|
1145
|
-
|
|
1146
|
-
},
|
|
1147
|
-
arguments: [
|
|
1148
|
-
valuesAst,
|
|
1149
|
-
{
|
|
1150
|
-
kind: "lambdaExpression",
|
|
1151
|
-
isAsync: false,
|
|
1152
|
-
parameters: [
|
|
1153
|
-
{
|
|
1154
|
-
name: "__tsonic_promise_item",
|
|
1155
|
-
type: inputElementTypeAst,
|
|
1156
|
-
},
|
|
1157
|
-
],
|
|
1158
|
-
body: normalizedTaskAst,
|
|
1159
|
-
},
|
|
1160
|
-
],
|
|
1161
|
-
};
|
|
1162
|
-
}
|
|
1163
|
-
if (method === "all") {
|
|
1164
|
-
return [
|
|
1165
|
-
{
|
|
1166
|
-
kind: "invocationExpression",
|
|
162
|
+
kind: "castExpression",
|
|
163
|
+
type: buildDelegateType(parameterTypeAsts, returnTypeAst),
|
|
1167
164
|
expression: {
|
|
1168
|
-
kind: "
|
|
1169
|
-
expression:
|
|
1170
|
-
kind: "identifierExpression",
|
|
1171
|
-
identifier: "global::System.Threading.Tasks.Task",
|
|
1172
|
-
},
|
|
1173
|
-
memberName: "WhenAll",
|
|
165
|
+
kind: "parenthesizedExpression",
|
|
166
|
+
expression: calleeExpr,
|
|
1174
167
|
},
|
|
1175
|
-
arguments: [normalizedValuesAst],
|
|
1176
|
-
},
|
|
1177
|
-
currentContext,
|
|
1178
|
-
];
|
|
1179
|
-
}
|
|
1180
|
-
const whenAnyAst = {
|
|
1181
|
-
kind: "invocationExpression",
|
|
1182
|
-
expression: {
|
|
1183
|
-
kind: "memberAccessExpression",
|
|
1184
|
-
expression: {
|
|
1185
|
-
kind: "identifierExpression",
|
|
1186
|
-
identifier: "global::System.Threading.Tasks.Task",
|
|
1187
168
|
},
|
|
1188
|
-
memberName: "WhenAny",
|
|
1189
169
|
},
|
|
1190
|
-
|
|
1191
|
-
};
|
|
1192
|
-
if (!outputResultType) {
|
|
1193
|
-
return [
|
|
1194
|
-
buildTaskRunInvocation(outputTaskType, {
|
|
1195
|
-
kind: "blockStatement",
|
|
1196
|
-
statements: [
|
|
1197
|
-
{
|
|
1198
|
-
kind: "expressionStatement",
|
|
1199
|
-
expression: {
|
|
1200
|
-
kind: "awaitExpression",
|
|
1201
|
-
expression: {
|
|
1202
|
-
kind: "awaitExpression",
|
|
1203
|
-
expression: whenAnyAst,
|
|
1204
|
-
},
|
|
1205
|
-
},
|
|
1206
|
-
},
|
|
1207
|
-
],
|
|
1208
|
-
}, true),
|
|
1209
|
-
currentContext,
|
|
1210
|
-
];
|
|
1211
|
-
}
|
|
1212
|
-
return [
|
|
1213
|
-
buildTaskRunInvocation(outputTaskType, {
|
|
1214
|
-
kind: "blockStatement",
|
|
1215
|
-
statements: [
|
|
1216
|
-
{
|
|
1217
|
-
kind: "returnStatement",
|
|
1218
|
-
expression: {
|
|
1219
|
-
kind: "awaitExpression",
|
|
1220
|
-
expression: {
|
|
1221
|
-
kind: "awaitExpression",
|
|
1222
|
-
expression: whenAnyAst,
|
|
1223
|
-
},
|
|
1224
|
-
},
|
|
1225
|
-
},
|
|
1226
|
-
],
|
|
1227
|
-
}, true),
|
|
1228
|
-
currentContext,
|
|
170
|
+
returnTypeContext,
|
|
1229
171
|
];
|
|
1230
172
|
};
|
|
1231
|
-
const
|
|
1232
|
-
|
|
1233
|
-
if (!arg || arg.kind === "spread")
|
|
173
|
+
const emitSyntheticArraySliceCall = (expr, context) => {
|
|
174
|
+
if (expr.callee.kind !== "memberAccess") {
|
|
1234
175
|
return undefined;
|
|
1235
|
-
return arg.kind === "literal" && typeof arg.value === "string"
|
|
1236
|
-
? arg.value
|
|
1237
|
-
: undefined;
|
|
1238
|
-
};
|
|
1239
|
-
const resolveDynamicImportTargetModule = (specifier, context) => {
|
|
1240
|
-
const currentFilePath = context.options.currentModuleFilePath;
|
|
1241
|
-
const moduleMap = context.options.moduleMap;
|
|
1242
|
-
if (!currentFilePath || !moduleMap) {
|
|
1243
|
-
return undefined;
|
|
1244
|
-
}
|
|
1245
|
-
const targetPath = resolveImportPath(currentFilePath, specifier);
|
|
1246
|
-
const direct = moduleMap.get(targetPath);
|
|
1247
|
-
if (direct) {
|
|
1248
|
-
return direct;
|
|
1249
|
-
}
|
|
1250
|
-
const normalizedTarget = targetPath.replace(/\\/g, "/");
|
|
1251
|
-
for (const [key, identity] of moduleMap.entries()) {
|
|
1252
|
-
const normalizedKey = key.replace(/\\/g, "/");
|
|
1253
|
-
if (normalizedKey === normalizedTarget ||
|
|
1254
|
-
normalizedKey.endsWith(`/${normalizedTarget}`) ||
|
|
1255
|
-
normalizedTarget.endsWith(`/${normalizedKey}`)) {
|
|
1256
|
-
return identity;
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
return undefined;
|
|
1260
|
-
};
|
|
1261
|
-
const buildDynamicImportContainerType = (targetModule) => {
|
|
1262
|
-
const containerName = targetModule.hasTypeCollision
|
|
1263
|
-
? `${targetModule.className}__Module`
|
|
1264
|
-
: targetModule.className;
|
|
1265
|
-
return {
|
|
1266
|
-
kind: "identifierType",
|
|
1267
|
-
name: `global::${targetModule.namespace}.${containerName}`,
|
|
1268
|
-
};
|
|
1269
|
-
};
|
|
1270
|
-
const buildRunClassConstructorExpression = (containerType) => ({
|
|
1271
|
-
kind: "invocationExpression",
|
|
1272
|
-
expression: {
|
|
1273
|
-
kind: "memberAccessExpression",
|
|
1274
|
-
expression: {
|
|
1275
|
-
kind: "identifierExpression",
|
|
1276
|
-
identifier: "global::System.Runtime.CompilerServices.RuntimeHelpers",
|
|
1277
|
-
},
|
|
1278
|
-
memberName: "RunClassConstructor",
|
|
1279
|
-
},
|
|
1280
|
-
arguments: [
|
|
1281
|
-
{
|
|
1282
|
-
kind: "memberAccessExpression",
|
|
1283
|
-
expression: {
|
|
1284
|
-
kind: "typeofExpression",
|
|
1285
|
-
type: containerType,
|
|
1286
|
-
},
|
|
1287
|
-
memberName: "TypeHandle",
|
|
1288
|
-
},
|
|
1289
|
-
],
|
|
1290
|
-
});
|
|
1291
|
-
const emitDynamicImportCall = (expr, context) => {
|
|
1292
|
-
if (expr.callee.kind !== "identifier" || expr.callee.name !== "import") {
|
|
1293
|
-
return null;
|
|
1294
|
-
}
|
|
1295
|
-
const specifier = getDynamicImportSpecifier(expr);
|
|
1296
|
-
if (!specifier)
|
|
1297
|
-
return null;
|
|
1298
|
-
const completedTaskExpr = {
|
|
1299
|
-
kind: "memberAccessExpression",
|
|
1300
|
-
expression: {
|
|
1301
|
-
kind: "identifierExpression",
|
|
1302
|
-
identifier: "global::System.Threading.Tasks.Task",
|
|
1303
|
-
},
|
|
1304
|
-
memberName: "CompletedTask",
|
|
1305
|
-
};
|
|
1306
|
-
const targetModule = resolveDynamicImportTargetModule(specifier, context);
|
|
1307
|
-
if (!expr.dynamicImportNamespace) {
|
|
1308
|
-
if (!targetModule || !targetModule.hasRuntimeContainer) {
|
|
1309
|
-
return [completedTaskExpr, context];
|
|
1310
|
-
}
|
|
1311
|
-
const containerType = buildDynamicImportContainerType(targetModule);
|
|
1312
|
-
const runClassConstructor = buildRunClassConstructorExpression(containerType);
|
|
1313
|
-
return [
|
|
1314
|
-
{
|
|
1315
|
-
kind: "invocationExpression",
|
|
1316
|
-
expression: {
|
|
1317
|
-
kind: "memberAccessExpression",
|
|
1318
|
-
expression: {
|
|
1319
|
-
kind: "identifierExpression",
|
|
1320
|
-
identifier: "global::System.Threading.Tasks.Task",
|
|
1321
|
-
},
|
|
1322
|
-
memberName: "Run",
|
|
1323
|
-
},
|
|
1324
|
-
arguments: [
|
|
1325
|
-
{
|
|
1326
|
-
kind: "lambdaExpression",
|
|
1327
|
-
isAsync: false,
|
|
1328
|
-
parameters: [],
|
|
1329
|
-
body: runClassConstructor,
|
|
1330
|
-
},
|
|
1331
|
-
],
|
|
1332
|
-
},
|
|
1333
|
-
context,
|
|
1334
|
-
];
|
|
1335
|
-
}
|
|
1336
|
-
if (!targetModule) {
|
|
1337
|
-
throw new Error(`ICE: Closed-world dynamic import '${specifier}' was validated as a namespace import but no module identity was available during emission.`);
|
|
1338
|
-
}
|
|
1339
|
-
let currentContext = context;
|
|
1340
|
-
const [outputTaskType, outputTaskContext] = emitTypeAst(expr.inferredType ?? {
|
|
1341
|
-
kind: "referenceType",
|
|
1342
|
-
name: "Promise",
|
|
1343
|
-
typeArguments: [{ kind: "referenceType", name: "object" }],
|
|
1344
|
-
}, currentContext);
|
|
1345
|
-
currentContext = outputTaskContext;
|
|
1346
|
-
const [namespaceAst, namespaceContext] = expr.dynamicImportNamespace.properties.length === 0
|
|
1347
|
-
? [
|
|
1348
|
-
{
|
|
1349
|
-
kind: "objectCreationExpression",
|
|
1350
|
-
type: { kind: "identifierType", name: "object" },
|
|
1351
|
-
arguments: [],
|
|
1352
|
-
},
|
|
1353
|
-
currentContext,
|
|
1354
|
-
]
|
|
1355
|
-
: emitExpressionAst(expr.dynamicImportNamespace, currentContext, expr.dynamicImportNamespace.inferredType);
|
|
1356
|
-
currentContext = namespaceContext;
|
|
1357
|
-
const setupStatements = [];
|
|
1358
|
-
if (targetModule.hasRuntimeContainer) {
|
|
1359
|
-
const containerType = buildDynamicImportContainerType(targetModule);
|
|
1360
|
-
setupStatements.push({
|
|
1361
|
-
kind: "expressionStatement",
|
|
1362
|
-
expression: buildRunClassConstructorExpression(containerType),
|
|
1363
|
-
});
|
|
1364
176
|
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
{
|
|
1371
|
-
kind: "returnStatement",
|
|
1372
|
-
expression: namespaceAst,
|
|
1373
|
-
},
|
|
1374
|
-
],
|
|
1375
|
-
}, false),
|
|
1376
|
-
currentContext,
|
|
1377
|
-
];
|
|
1378
|
-
};
|
|
1379
|
-
const emitPromiseThenCatchFinally = (expr, context) => {
|
|
1380
|
-
if (expr.callee.kind !== "memberAccess")
|
|
1381
|
-
return null;
|
|
1382
|
-
if (typeof expr.callee.property !== "string")
|
|
1383
|
-
return null;
|
|
1384
|
-
if (!isPromiseChainMethod(expr.callee.property))
|
|
1385
|
-
return null;
|
|
1386
|
-
if (expr.callee.isOptional || expr.isOptional)
|
|
1387
|
-
return null;
|
|
1388
|
-
if (!isAsyncWrapperType(expr.callee.object.inferredType))
|
|
1389
|
-
return null;
|
|
1390
|
-
let currentContext = context;
|
|
1391
|
-
const [receiverAst, receiverCtx] = emitExpressionAst(expr.callee.object, currentContext);
|
|
1392
|
-
currentContext = receiverCtx;
|
|
1393
|
-
const outputTypeHint = context.returnType && isAsyncWrapperType(context.returnType)
|
|
1394
|
-
? context.returnType
|
|
1395
|
-
: expr.inferredType;
|
|
1396
|
-
const [rawOutputTaskType, outputTaskCtx] = emitTypeAst(outputTypeHint ?? { kind: "referenceType", name: "Task" }, currentContext);
|
|
1397
|
-
currentContext = outputTaskCtx;
|
|
1398
|
-
const defaultOutputTaskType = isTaskTypeAst(rawOutputTaskType) &&
|
|
1399
|
-
rawOutputTaskType.typeArguments?.length === 1 &&
|
|
1400
|
-
containsVoidTypeAst(rawOutputTaskType.typeArguments[0])
|
|
1401
|
-
? { kind: "identifierType", name: "global::System.Threading.Tasks.Task" }
|
|
1402
|
-
: rawOutputTaskType;
|
|
1403
|
-
const [sourceTaskType, sourceTaskCtx] = emitTypeAst(expr.callee.object.inferredType ?? { kind: "referenceType", name: "Task" }, currentContext);
|
|
1404
|
-
currentContext = sourceTaskCtx;
|
|
1405
|
-
const sourceResultType = getTaskResultType(sourceTaskType);
|
|
1406
|
-
const sourceResultIr = normalizePromiseChainResultIrType(expr.callee.object.inferredType);
|
|
1407
|
-
const exIdent = "__tsonic_promise_ex";
|
|
1408
|
-
const valueIdent = "__tsonic_promise_value";
|
|
1409
|
-
const fulfilledArg = expr.arguments[0];
|
|
1410
|
-
const rejectedArg = expr.callee.property === "then" ? expr.arguments[1] : expr.arguments[0];
|
|
1411
|
-
const finallyArg = expr.callee.property === "finally" ? expr.arguments[0] : undefined;
|
|
1412
|
-
let fulfilledAst;
|
|
1413
|
-
let rejectedAst;
|
|
1414
|
-
let finallyAst;
|
|
1415
|
-
if (fulfilledArg && fulfilledArg.kind !== "spread") {
|
|
1416
|
-
const [fAst, fCtx] = emitExpressionAst(fulfilledArg, currentContext);
|
|
1417
|
-
fulfilledAst = fAst;
|
|
1418
|
-
currentContext = fCtx;
|
|
1419
|
-
}
|
|
1420
|
-
if (rejectedArg && rejectedArg.kind !== "spread") {
|
|
1421
|
-
const [rAst, rCtx] = emitExpressionAst(rejectedArg, currentContext);
|
|
1422
|
-
rejectedAst = rAst;
|
|
1423
|
-
currentContext = rCtx;
|
|
1424
|
-
}
|
|
1425
|
-
if (finallyArg && finallyArg.kind !== "spread") {
|
|
1426
|
-
const [fiAst, fiCtx] = emitExpressionAst(finallyArg, currentContext);
|
|
1427
|
-
finallyAst = fiAst;
|
|
1428
|
-
currentContext = fiCtx;
|
|
1429
|
-
}
|
|
1430
|
-
const fulfilledResultIr = fulfilledArg && fulfilledArg.kind !== "spread"
|
|
1431
|
-
? normalizePromiseChainResultIrType(getCallbackReturnType(fulfilledArg))
|
|
1432
|
-
: undefined;
|
|
1433
|
-
const rejectedResultIr = rejectedArg && rejectedArg.kind !== "spread"
|
|
1434
|
-
? normalizePromiseChainResultIrType(getCallbackReturnType(rejectedArg))
|
|
1435
|
-
: undefined;
|
|
1436
|
-
const normalizedPromiseChainResultIr = (() => {
|
|
1437
|
-
if (expr.callee.property === "then") {
|
|
1438
|
-
if (rejectedArg && rejectedArg.kind !== "spread") {
|
|
1439
|
-
return mergePromiseChainResultIrTypes(fulfilledResultIr ?? sourceResultIr, rejectedResultIr);
|
|
1440
|
-
}
|
|
1441
|
-
return fulfilledResultIr ?? sourceResultIr;
|
|
1442
|
-
}
|
|
1443
|
-
if (expr.callee.property === "catch") {
|
|
1444
|
-
return mergePromiseChainResultIrTypes(sourceResultIr, rejectedResultIr);
|
|
1445
|
-
}
|
|
1446
|
-
if (expr.callee.property === "finally") {
|
|
1447
|
-
return sourceResultIr;
|
|
1448
|
-
}
|
|
177
|
+
const binding = expr.callee.memberBinding;
|
|
178
|
+
if (binding?.assembly !== "__synthetic" ||
|
|
179
|
+
binding.type !== "Array" ||
|
|
180
|
+
binding.member !== "slice" ||
|
|
181
|
+
expr.arguments.length !== 1) {
|
|
1449
182
|
return undefined;
|
|
1450
|
-
})();
|
|
1451
|
-
const normalizedFrontendPromiseChainResultIr = normalizePromiseChainResultIrType(expr.inferredType);
|
|
1452
|
-
const preferredPromiseChainResultIr = normalizedFrontendPromiseChainResultIr &&
|
|
1453
|
-
!containsPromiseChainArtifact(normalizedFrontendPromiseChainResultIr)
|
|
1454
|
-
? normalizedFrontendPromiseChainResultIr
|
|
1455
|
-
: normalizedPromiseChainResultIr;
|
|
1456
|
-
let outputResultType = getTaskResultType(defaultOutputTaskType);
|
|
1457
|
-
let outputTaskType = defaultOutputTaskType;
|
|
1458
|
-
if (preferredPromiseChainResultIr) {
|
|
1459
|
-
const [normalizedResultAst, normalizedCtx] = emitTypeAst(preferredPromiseChainResultIr, currentContext);
|
|
1460
|
-
currentContext = normalizedCtx;
|
|
1461
|
-
outputResultType = containsVoidTypeAst(normalizedResultAst)
|
|
1462
|
-
? undefined
|
|
1463
|
-
: normalizedResultAst;
|
|
1464
|
-
outputTaskType = buildTaskTypeAst(outputResultType);
|
|
1465
|
-
}
|
|
1466
|
-
const awaitReceiverStatement = sourceResultType === undefined
|
|
1467
|
-
? {
|
|
1468
|
-
kind: "expressionStatement",
|
|
1469
|
-
expression: buildAwait(receiverAst),
|
|
1470
|
-
}
|
|
1471
|
-
: {
|
|
1472
|
-
kind: "localDeclarationStatement",
|
|
1473
|
-
modifiers: [],
|
|
1474
|
-
type: { kind: "identifierType", name: "var" },
|
|
1475
|
-
declarators: [
|
|
1476
|
-
{
|
|
1477
|
-
name: valueIdent,
|
|
1478
|
-
initializer: buildAwait(receiverAst),
|
|
1479
|
-
},
|
|
1480
|
-
],
|
|
1481
|
-
};
|
|
1482
|
-
const invokeFulfilled = () => {
|
|
1483
|
-
if (!fulfilledAst) {
|
|
1484
|
-
if (sourceResultType === undefined)
|
|
1485
|
-
return [];
|
|
1486
|
-
return [
|
|
1487
|
-
{
|
|
1488
|
-
kind: "returnStatement",
|
|
1489
|
-
expression: {
|
|
1490
|
-
kind: "identifierExpression",
|
|
1491
|
-
identifier: valueIdent,
|
|
1492
|
-
},
|
|
1493
|
-
},
|
|
1494
|
-
];
|
|
1495
|
-
}
|
|
1496
|
-
const fulfilledArgs = [];
|
|
1497
|
-
if (sourceResultType !== undefined &&
|
|
1498
|
-
callbackParameterCount(fulfilledArg) > 0) {
|
|
1499
|
-
fulfilledArgs.push({
|
|
1500
|
-
kind: "identifierExpression",
|
|
1501
|
-
identifier: valueIdent,
|
|
1502
|
-
});
|
|
1503
|
-
}
|
|
1504
|
-
const delegateParamTypes = sourceResultType !== undefined &&
|
|
1505
|
-
callbackParameterCount(fulfilledArg) > 0
|
|
1506
|
-
? [sourceResultType]
|
|
1507
|
-
: [];
|
|
1508
|
-
const callbackReturnIr = getCallbackDelegateReturnType(fulfilledArg);
|
|
1509
|
-
let callbackReturnTypeAst = outputResultType;
|
|
1510
|
-
if (callbackReturnIr !== undefined) {
|
|
1511
|
-
const [cbRetAst, cbRetCtx] = emitTypeAst(callbackReturnIr, currentContext);
|
|
1512
|
-
callbackReturnTypeAst =
|
|
1513
|
-
(cbRetAst.kind === "predefinedType" && cbRetAst.keyword === "void") ||
|
|
1514
|
-
(cbRetAst.kind === "identifierType" && cbRetAst.name === "void")
|
|
1515
|
-
? undefined
|
|
1516
|
-
: cbRetAst;
|
|
1517
|
-
currentContext = cbRetCtx;
|
|
1518
|
-
}
|
|
1519
|
-
if (outputResultType !== undefined && callbackReturnTypeAst === undefined) {
|
|
1520
|
-
callbackReturnTypeAst = outputResultType;
|
|
1521
|
-
}
|
|
1522
|
-
if (callbackReturnTypeAst === undefined &&
|
|
1523
|
-
fulfilledArg?.kind === "arrowFunction" &&
|
|
1524
|
-
fulfilledArg.body.kind !== "blockStatement") {
|
|
1525
|
-
callbackReturnTypeAst = { kind: "predefinedType", keyword: "object" };
|
|
1526
|
-
}
|
|
1527
|
-
const callbackCallee = fulfilledAst.kind === "lambdaExpression"
|
|
1528
|
-
? {
|
|
1529
|
-
kind: "castExpression",
|
|
1530
|
-
type: buildDelegateType(delegateParamTypes, callbackReturnTypeAst),
|
|
1531
|
-
expression: fulfilledAst,
|
|
1532
|
-
}
|
|
1533
|
-
: fulfilledAst;
|
|
1534
|
-
const callbackCall = callbackCallee.kind === "castExpression"
|
|
1535
|
-
? buildInvocation({
|
|
1536
|
-
kind: "memberAccessExpression",
|
|
1537
|
-
expression: callbackCallee,
|
|
1538
|
-
memberName: "Invoke",
|
|
1539
|
-
}, fulfilledArgs)
|
|
1540
|
-
: buildInvocation(callbackCallee, fulfilledArgs);
|
|
1541
|
-
const callbackExpr = callbackReturnsAsyncWrapper(fulfilledArg)
|
|
1542
|
-
? buildAwait(callbackCall)
|
|
1543
|
-
: callbackCall;
|
|
1544
|
-
if (outputResultType === undefined) {
|
|
1545
|
-
return [{ kind: "expressionStatement", expression: callbackExpr }];
|
|
1546
|
-
}
|
|
1547
|
-
return [{ kind: "returnStatement", expression: callbackExpr }];
|
|
1548
|
-
};
|
|
1549
|
-
const invokeRejected = () => {
|
|
1550
|
-
if (!rejectedAst) {
|
|
1551
|
-
return [{ kind: "throwStatement" }];
|
|
1552
|
-
}
|
|
1553
|
-
const rejectedArgs = [];
|
|
1554
|
-
if (callbackParameterCount(rejectedArg) > 0) {
|
|
1555
|
-
rejectedArgs.push({
|
|
1556
|
-
kind: "identifierExpression",
|
|
1557
|
-
identifier: exIdent,
|
|
1558
|
-
});
|
|
1559
|
-
}
|
|
1560
|
-
const callbackReturnIr = getCallbackDelegateReturnType(rejectedArg);
|
|
1561
|
-
let callbackReturnTypeAst = outputResultType;
|
|
1562
|
-
if (callbackReturnIr !== undefined) {
|
|
1563
|
-
const [cbRetAst, cbRetCtx] = emitTypeAst(callbackReturnIr, currentContext);
|
|
1564
|
-
callbackReturnTypeAst =
|
|
1565
|
-
(cbRetAst.kind === "predefinedType" && cbRetAst.keyword === "void") ||
|
|
1566
|
-
(cbRetAst.kind === "identifierType" && cbRetAst.name === "void")
|
|
1567
|
-
? undefined
|
|
1568
|
-
: cbRetAst;
|
|
1569
|
-
currentContext = cbRetCtx;
|
|
1570
|
-
}
|
|
1571
|
-
if (outputResultType !== undefined && callbackReturnTypeAst === undefined) {
|
|
1572
|
-
callbackReturnTypeAst = outputResultType;
|
|
1573
|
-
}
|
|
1574
|
-
if (callbackReturnTypeAst === undefined &&
|
|
1575
|
-
rejectedArg?.kind === "arrowFunction" &&
|
|
1576
|
-
rejectedArg.body.kind !== "blockStatement") {
|
|
1577
|
-
callbackReturnTypeAst = { kind: "predefinedType", keyword: "object" };
|
|
1578
|
-
}
|
|
1579
|
-
const callbackCallee = rejectedAst.kind === "lambdaExpression"
|
|
1580
|
-
? {
|
|
1581
|
-
kind: "castExpression",
|
|
1582
|
-
type: buildDelegateType([{ kind: "identifierType", name: "global::System.Exception" }], callbackReturnTypeAst),
|
|
1583
|
-
expression: rejectedAst,
|
|
1584
|
-
}
|
|
1585
|
-
: rejectedAst;
|
|
1586
|
-
const callbackCall = callbackCallee.kind === "castExpression"
|
|
1587
|
-
? buildInvocation({
|
|
1588
|
-
kind: "memberAccessExpression",
|
|
1589
|
-
expression: callbackCallee,
|
|
1590
|
-
memberName: "Invoke",
|
|
1591
|
-
}, rejectedArgs)
|
|
1592
|
-
: buildInvocation(callbackCallee, rejectedArgs);
|
|
1593
|
-
const callbackExpr = callbackReturnsAsyncWrapper(rejectedArg)
|
|
1594
|
-
? buildAwait(callbackCall)
|
|
1595
|
-
: callbackCall;
|
|
1596
|
-
if (outputResultType === undefined) {
|
|
1597
|
-
return [{ kind: "expressionStatement", expression: callbackExpr }];
|
|
1598
|
-
}
|
|
1599
|
-
return [{ kind: "returnStatement", expression: callbackExpr }];
|
|
1600
|
-
};
|
|
1601
|
-
const invokeFinally = () => {
|
|
1602
|
-
if (!finallyAst)
|
|
1603
|
-
return [];
|
|
1604
|
-
const callbackReturnIr = getCallbackDelegateReturnType(finallyArg);
|
|
1605
|
-
let callbackReturnTypeAst = undefined;
|
|
1606
|
-
if (callbackReturnIr !== undefined) {
|
|
1607
|
-
const [cbRetAst, cbRetCtx] = emitTypeAst(callbackReturnIr, currentContext);
|
|
1608
|
-
callbackReturnTypeAst = cbRetAst;
|
|
1609
|
-
currentContext = cbRetCtx;
|
|
1610
|
-
}
|
|
1611
|
-
if (callbackReturnTypeAst === undefined &&
|
|
1612
|
-
finallyArg?.kind === "arrowFunction" &&
|
|
1613
|
-
finallyArg.body.kind !== "blockStatement") {
|
|
1614
|
-
callbackReturnTypeAst = { kind: "predefinedType", keyword: "object" };
|
|
1615
|
-
}
|
|
1616
|
-
const callbackCallee = finallyAst.kind === "lambdaExpression"
|
|
1617
|
-
? {
|
|
1618
|
-
kind: "castExpression",
|
|
1619
|
-
type: buildDelegateType([], callbackReturnTypeAst),
|
|
1620
|
-
expression: finallyAst,
|
|
1621
|
-
}
|
|
1622
|
-
: finallyAst;
|
|
1623
|
-
const callbackCall = callbackCallee.kind === "castExpression"
|
|
1624
|
-
? buildInvocation({
|
|
1625
|
-
kind: "memberAccessExpression",
|
|
1626
|
-
expression: callbackCallee,
|
|
1627
|
-
memberName: "Invoke",
|
|
1628
|
-
}, [])
|
|
1629
|
-
: buildInvocation(callbackCallee, []);
|
|
1630
|
-
const callbackExpr = callbackReturnsAsyncWrapper(finallyArg)
|
|
1631
|
-
? buildAwait(callbackCall)
|
|
1632
|
-
: callbackCall;
|
|
1633
|
-
return [{ kind: "expressionStatement", expression: callbackExpr }];
|
|
1634
|
-
};
|
|
1635
|
-
if (expr.callee.property === "then") {
|
|
1636
|
-
const thenStatements = [
|
|
1637
|
-
awaitReceiverStatement,
|
|
1638
|
-
...invokeFulfilled(),
|
|
1639
|
-
];
|
|
1640
|
-
const bodyStatements = rejectedAst
|
|
1641
|
-
? [
|
|
1642
|
-
{
|
|
1643
|
-
kind: "tryStatement",
|
|
1644
|
-
body: { kind: "blockStatement", statements: thenStatements },
|
|
1645
|
-
catches: [
|
|
1646
|
-
{
|
|
1647
|
-
type: {
|
|
1648
|
-
kind: "identifierType",
|
|
1649
|
-
name: "global::System.Exception",
|
|
1650
|
-
},
|
|
1651
|
-
identifier: exIdent,
|
|
1652
|
-
body: {
|
|
1653
|
-
kind: "blockStatement",
|
|
1654
|
-
statements: invokeRejected(),
|
|
1655
|
-
},
|
|
1656
|
-
},
|
|
1657
|
-
],
|
|
1658
|
-
},
|
|
1659
|
-
]
|
|
1660
|
-
: thenStatements;
|
|
1661
|
-
return [
|
|
1662
|
-
buildTaskRunInvocation(outputTaskType, {
|
|
1663
|
-
kind: "blockStatement",
|
|
1664
|
-
statements: bodyStatements,
|
|
1665
|
-
}, true),
|
|
1666
|
-
currentContext,
|
|
1667
|
-
];
|
|
1668
|
-
}
|
|
1669
|
-
if (expr.callee.property === "catch") {
|
|
1670
|
-
const successPath = sourceResultType === undefined
|
|
1671
|
-
? [{ kind: "expressionStatement", expression: buildAwait(receiverAst) }]
|
|
1672
|
-
: [
|
|
1673
|
-
{
|
|
1674
|
-
kind: "returnStatement",
|
|
1675
|
-
expression: buildAwait(receiverAst),
|
|
1676
|
-
},
|
|
1677
|
-
];
|
|
1678
|
-
const catches = [
|
|
1679
|
-
{
|
|
1680
|
-
type: { kind: "identifierType", name: "global::System.Exception" },
|
|
1681
|
-
identifier: exIdent,
|
|
1682
|
-
body: {
|
|
1683
|
-
kind: "blockStatement",
|
|
1684
|
-
statements: invokeRejected(),
|
|
1685
|
-
},
|
|
1686
|
-
},
|
|
1687
|
-
];
|
|
1688
|
-
return [
|
|
1689
|
-
buildTaskRunInvocation(outputTaskType, {
|
|
1690
|
-
kind: "blockStatement",
|
|
1691
|
-
statements: [
|
|
1692
|
-
{
|
|
1693
|
-
kind: "tryStatement",
|
|
1694
|
-
body: { kind: "blockStatement", statements: successPath },
|
|
1695
|
-
catches,
|
|
1696
|
-
},
|
|
1697
|
-
],
|
|
1698
|
-
}, true),
|
|
1699
|
-
currentContext,
|
|
1700
|
-
];
|
|
1701
|
-
}
|
|
1702
|
-
if (expr.callee.property === "finally") {
|
|
1703
|
-
const tryStatements = sourceResultType === undefined
|
|
1704
|
-
? [{ kind: "expressionStatement", expression: buildAwait(receiverAst) }]
|
|
1705
|
-
: [{ kind: "returnStatement", expression: buildAwait(receiverAst) }];
|
|
1706
|
-
return [
|
|
1707
|
-
buildTaskRunInvocation(outputTaskType, {
|
|
1708
|
-
kind: "blockStatement",
|
|
1709
|
-
statements: [
|
|
1710
|
-
{
|
|
1711
|
-
kind: "tryStatement",
|
|
1712
|
-
body: { kind: "blockStatement", statements: tryStatements },
|
|
1713
|
-
catches: [],
|
|
1714
|
-
finallyBody: {
|
|
1715
|
-
kind: "blockStatement",
|
|
1716
|
-
statements: invokeFinally(),
|
|
1717
|
-
},
|
|
1718
|
-
},
|
|
1719
|
-
],
|
|
1720
|
-
}, true),
|
|
1721
|
-
currentContext,
|
|
1722
|
-
];
|
|
1723
|
-
}
|
|
1724
|
-
return null;
|
|
1725
|
-
};
|
|
1726
|
-
/**
|
|
1727
|
-
* Emit call arguments as typed AST array.
|
|
1728
|
-
* Handles spread arrays, castModifier (ref/out from cast), and argumentPassing modes.
|
|
1729
|
-
*/
|
|
1730
|
-
const emitCallArguments = (args, expr, context) => {
|
|
1731
|
-
const functionValueSignature = getFunctionValueSignature(expr);
|
|
1732
|
-
if (functionValueSignature &&
|
|
1733
|
-
functionValueSignature.parameters.some((parameter) => parameter?.isRest ||
|
|
1734
|
-
parameter?.isOptional ||
|
|
1735
|
-
parameter?.initializer !== undefined)) {
|
|
1736
|
-
return emitFunctionValueCallArguments(args, functionValueSignature, expr, context);
|
|
1737
|
-
}
|
|
1738
|
-
const parameterTypes = expr.parameterTypes ?? [];
|
|
1739
|
-
const restInfo = detectRestParameterInfo(args, parameterTypes);
|
|
1740
|
-
let currentContext = context;
|
|
1741
|
-
const argAsts = [];
|
|
1742
|
-
for (let i = 0; i < args.length; i++) {
|
|
1743
|
-
const arg = args[i];
|
|
1744
|
-
if (!arg)
|
|
1745
|
-
continue;
|
|
1746
|
-
if (restInfo &&
|
|
1747
|
-
i === restInfo.index &&
|
|
1748
|
-
args
|
|
1749
|
-
.slice(restInfo.index)
|
|
1750
|
-
.some((candidate) => candidate?.kind === "spread")) {
|
|
1751
|
-
const [flattenedRestArgs, flattenedContext] = emitFlattenedRestArguments(args.slice(restInfo.index), restInfo.elementType, currentContext);
|
|
1752
|
-
argAsts.push(...flattenedRestArgs);
|
|
1753
|
-
currentContext = flattenedContext;
|
|
1754
|
-
break;
|
|
1755
|
-
}
|
|
1756
|
-
const expectedType = restInfo && i >= restInfo.index
|
|
1757
|
-
? restInfo.elementType
|
|
1758
|
-
: parameterTypes[i];
|
|
1759
|
-
if (arg.kind === "spread") {
|
|
1760
|
-
const [spreadAst, ctx] = emitExpressionAst(arg.expression, currentContext);
|
|
1761
|
-
argAsts.push(spreadAst);
|
|
1762
|
-
currentContext = ctx;
|
|
1763
|
-
}
|
|
1764
|
-
else {
|
|
1765
|
-
const castModifier = getPassingModifierFromCast(arg);
|
|
1766
|
-
if (castModifier && isLValue(arg)) {
|
|
1767
|
-
const [argAst, ctx] = emitExpressionAst(arg, currentContext);
|
|
1768
|
-
argAsts.push(wrapArgModifier(castModifier, argAst));
|
|
1769
|
-
currentContext = ctx;
|
|
1770
|
-
}
|
|
1771
|
-
else {
|
|
1772
|
-
const [argAst, ctx] = emitExpressionAst(arg, currentContext, expectedType);
|
|
1773
|
-
const passingMode = expr.argumentPassing?.[i];
|
|
1774
|
-
const modifier = passingMode && passingMode !== "value" && isLValue(arg)
|
|
1775
|
-
? passingMode
|
|
1776
|
-
: undefined;
|
|
1777
|
-
argAsts.push(wrapArgModifier(modifier, argAst));
|
|
1778
|
-
currentContext = ctx;
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
return [argAsts, currentContext];
|
|
1783
|
-
};
|
|
1784
|
-
/**
|
|
1785
|
-
* Emit a JsonSerializer call with NativeAOT-compatible options.
|
|
1786
|
-
*/
|
|
1787
|
-
const isConcreteGlobalJsonParseTarget = (type) => {
|
|
1788
|
-
if (!type)
|
|
1789
|
-
return false;
|
|
1790
|
-
if (type.kind === "unknownType" ||
|
|
1791
|
-
type.kind === "anyType" ||
|
|
1792
|
-
type.kind === "voidType" ||
|
|
1793
|
-
type.kind === "neverType") {
|
|
1794
|
-
return false;
|
|
1795
|
-
}
|
|
1796
|
-
if (type.kind === "unionType" || type.kind === "intersectionType") {
|
|
1797
|
-
return false;
|
|
1798
183
|
}
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
let currentContext = context;
|
|
1803
|
-
const argAsts = [];
|
|
1804
|
-
for (const arg of expr.arguments) {
|
|
1805
|
-
if (arg.kind === "spread") {
|
|
1806
|
-
const [spreadAst, ctx] = emitExpressionAst(arg.expression, currentContext);
|
|
1807
|
-
argAsts.push(spreadAst);
|
|
1808
|
-
currentContext = ctx;
|
|
1809
|
-
continue;
|
|
1810
|
-
}
|
|
1811
|
-
const [argAst, ctx] = emitExpressionAst(arg, currentContext);
|
|
1812
|
-
argAsts.push(argAst);
|
|
1813
|
-
currentContext = ctx;
|
|
184
|
+
const startIndex = expr.arguments[0];
|
|
185
|
+
if (!startIndex || startIndex.kind === "spread") {
|
|
186
|
+
return undefined;
|
|
1814
187
|
}
|
|
188
|
+
const [receiverAst, receiverContext] = emitExpressionAst(expr.callee.object, context);
|
|
189
|
+
const [startAst, startContext] = emitExpressionAst(startIndex, receiverContext, { kind: "primitiveType", name: "int" });
|
|
1815
190
|
return [
|
|
1816
191
|
{
|
|
1817
192
|
kind: "invocationExpression",
|
|
1818
|
-
expression:
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
kind: "
|
|
1822
|
-
|
|
193
|
+
expression: identifierExpression("global::System.Linq.Enumerable.ToArray"),
|
|
194
|
+
arguments: [
|
|
195
|
+
{
|
|
196
|
+
kind: "invocationExpression",
|
|
197
|
+
expression: identifierExpression("global::System.Linq.Enumerable.Skip"),
|
|
198
|
+
arguments: [receiverAst, startAst],
|
|
1823
199
|
},
|
|
1824
|
-
|
|
1825
|
-
},
|
|
1826
|
-
arguments: argAsts,
|
|
1827
|
-
typeArguments: [typeArgument],
|
|
200
|
+
],
|
|
1828
201
|
},
|
|
1829
|
-
|
|
202
|
+
startContext,
|
|
1830
203
|
];
|
|
1831
204
|
};
|
|
1832
|
-
const emitJsonSerializerCall = (expr, context, method, deserializeTypeOverride) => {
|
|
1833
|
-
let currentContext = context;
|
|
1834
|
-
// Register the type with the JSON AOT registry
|
|
1835
|
-
if (method === "Serialize") {
|
|
1836
|
-
const firstArg = expr.arguments[0];
|
|
1837
|
-
if (firstArg && firstArg.kind !== "spread") {
|
|
1838
|
-
registerJsonAotExpressionTypes(firstArg, context);
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
else {
|
|
1842
|
-
const typeArg = deserializeTypeOverride ?? expr.typeArguments?.[0];
|
|
1843
|
-
if (typeArg) {
|
|
1844
|
-
registerJsonAotType(typeArg, context);
|
|
1845
|
-
}
|
|
1846
|
-
}
|
|
1847
|
-
// Emit type arguments for Deserialize<T>
|
|
1848
|
-
let typeArgAsts = [];
|
|
1849
|
-
const deserializeIrType = method === "Deserialize"
|
|
1850
|
-
? (deserializeTypeOverride ?? expr.typeArguments?.[0])
|
|
1851
|
-
: undefined;
|
|
1852
|
-
if (deserializeIrType) {
|
|
1853
|
-
const [typeArgs, typeContext] = emitTypeArgumentsAst([deserializeIrType], currentContext);
|
|
1854
|
-
typeArgAsts = typeArgs;
|
|
1855
|
-
currentContext = typeContext;
|
|
1856
|
-
}
|
|
1857
|
-
else if (expr.typeArguments && expr.typeArguments.length > 0) {
|
|
1858
|
-
const [typeArgs, typeContext] = emitTypeArgumentsAst(expr.typeArguments, currentContext);
|
|
1859
|
-
typeArgAsts = typeArgs;
|
|
1860
|
-
currentContext = typeContext;
|
|
1861
|
-
}
|
|
1862
|
-
// Emit arguments
|
|
1863
|
-
const argAsts = [];
|
|
1864
|
-
for (const arg of expr.arguments) {
|
|
1865
|
-
if (arg.kind === "spread") {
|
|
1866
|
-
const [spreadAst, ctx] = emitExpressionAst(arg.expression, currentContext);
|
|
1867
|
-
argAsts.push(spreadAst);
|
|
1868
|
-
currentContext = ctx;
|
|
1869
|
-
}
|
|
1870
|
-
else {
|
|
1871
|
-
const [argAst, ctx] = emitExpressionAst(arg, currentContext);
|
|
1872
|
-
argAsts.push(argAst);
|
|
1873
|
-
currentContext = ctx;
|
|
1874
|
-
}
|
|
1875
|
-
}
|
|
1876
|
-
// Only pass TsonicJson.Options when this call site actually participates in the
|
|
1877
|
-
// NativeAOT JSON rewrite. Non-generic JSON.parse(...) intentionally returns
|
|
1878
|
-
// unknown and should emit plain JsonSerializer calls without requiring the
|
|
1879
|
-
// generated TsonicJson helper.
|
|
1880
|
-
if (context.options.jsonAotRegistry?.needsJsonAot) {
|
|
1881
|
-
argAsts.push({
|
|
1882
|
-
kind: "identifierExpression",
|
|
1883
|
-
identifier: "TsonicJson.Options",
|
|
1884
|
-
});
|
|
1885
|
-
}
|
|
1886
|
-
const invocation = {
|
|
1887
|
-
kind: "invocationExpression",
|
|
1888
|
-
expression: {
|
|
1889
|
-
kind: "memberAccessExpression",
|
|
1890
|
-
expression: {
|
|
1891
|
-
kind: "identifierExpression",
|
|
1892
|
-
identifier: "global::System.Text.Json.JsonSerializer",
|
|
1893
|
-
},
|
|
1894
|
-
memberName: method,
|
|
1895
|
-
},
|
|
1896
|
-
arguments: argAsts,
|
|
1897
|
-
typeArguments: typeArgAsts.length > 0 ? typeArgAsts : undefined,
|
|
1898
|
-
};
|
|
1899
|
-
return [invocation, currentContext];
|
|
1900
|
-
};
|
|
1901
|
-
const emitGlobalJsonCall = (expr, context, method) => {
|
|
1902
|
-
if (method === "Serialize") {
|
|
1903
|
-
return emitJsonSerializerCall(expr, context, method);
|
|
1904
|
-
}
|
|
1905
|
-
const deserializeTarget = expr.typeArguments?.[0] ??
|
|
1906
|
-
(isConcreteGlobalJsonParseTarget(expr.inferredType)
|
|
1907
|
-
? expr.inferredType
|
|
1908
|
-
: undefined);
|
|
1909
|
-
if (deserializeTarget) {
|
|
1910
|
-
return emitJsonSerializerCall(expr, context, "Deserialize", deserializeTarget);
|
|
1911
|
-
}
|
|
1912
|
-
return emitJsRuntimeJsonParseCall(expr, context, {
|
|
1913
|
-
kind: "predefinedType",
|
|
1914
|
-
keyword: "object",
|
|
1915
|
-
});
|
|
1916
|
-
};
|
|
1917
205
|
/**
|
|
1918
206
|
* Emit a function call expression as CSharpExpressionAst
|
|
1919
207
|
*/
|
|
1920
|
-
export const emitCall = (expr, context) => {
|
|
1921
|
-
const
|
|
208
|
+
export const emitCall = (expr, context, expectedType) => {
|
|
209
|
+
const normalizedExpr = normalizePromiseResolveCall(expr, context);
|
|
210
|
+
const syntheticArraySlice = emitSyntheticArraySliceCall(normalizedExpr, context);
|
|
211
|
+
if (syntheticArraySlice) {
|
|
212
|
+
return syntheticArraySlice;
|
|
213
|
+
}
|
|
214
|
+
const dynamicImport = emitDynamicImportCall(normalizedExpr, context);
|
|
1922
215
|
if (dynamicImport)
|
|
1923
216
|
return dynamicImport;
|
|
1924
|
-
const promiseStaticCall = emitPromiseStaticCall(
|
|
217
|
+
const promiseStaticCall = emitPromiseStaticCall(normalizedExpr, context, expectedType);
|
|
1925
218
|
if (promiseStaticCall)
|
|
1926
219
|
return promiseStaticCall;
|
|
1927
|
-
const promiseChain = emitPromiseThenCatchFinally(
|
|
220
|
+
const promiseChain = emitPromiseThenCatchFinally(normalizedExpr, context);
|
|
1928
221
|
if (promiseChain)
|
|
1929
222
|
return promiseChain;
|
|
223
|
+
const runtimeUnionArrayIsArray = emitRuntimeUnionArrayIsArrayCall(normalizedExpr, context);
|
|
224
|
+
if (runtimeUnionArrayIsArray) {
|
|
225
|
+
return runtimeUnionArrayIsArray;
|
|
226
|
+
}
|
|
1930
227
|
// Void promise resolve: emit as zero-arg call when safe.
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
const
|
|
1935
|
-
|
|
1936
|
-
|
|
228
|
+
const transparentCalleeIdentifier = extractTransparentIdentifier(normalizedExpr.callee);
|
|
229
|
+
if (transparentCalleeIdentifier &&
|
|
230
|
+
context.voidResolveNames?.has(transparentCalleeIdentifier.name)) {
|
|
231
|
+
const isZeroArg = normalizedExpr.arguments.length === 0;
|
|
232
|
+
const isSingleUndefined = normalizedExpr.arguments.length === 1 &&
|
|
233
|
+
normalizedExpr.arguments[0]?.kind === "identifier" &&
|
|
234
|
+
normalizedExpr.arguments[0].name === "undefined";
|
|
1937
235
|
if (isZeroArg || isSingleUndefined) {
|
|
1938
|
-
const [calleeAst, calleeCtx] = emitExpressionAst(
|
|
236
|
+
const [calleeAst, calleeCtx] = emitExpressionAst(transparentCalleeIdentifier, context);
|
|
1939
237
|
return [
|
|
1940
238
|
{
|
|
1941
239
|
kind: "invocationExpression",
|
|
@@ -1947,21 +245,24 @@ export const emitCall = (expr, context) => {
|
|
|
1947
245
|
}
|
|
1948
246
|
}
|
|
1949
247
|
// Check for JsonSerializer calls (NativeAOT support)
|
|
1950
|
-
const jsonCall = isJsonSerializerCall(
|
|
248
|
+
const jsonCall = isJsonSerializerCall(normalizedExpr.callee);
|
|
1951
249
|
if (jsonCall) {
|
|
1952
|
-
return emitJsonSerializerCall(
|
|
250
|
+
return emitJsonSerializerCall(normalizedExpr, context, jsonCall.method);
|
|
251
|
+
}
|
|
252
|
+
if (normalizedExpr.intrinsicKind === "globalSymbol") {
|
|
253
|
+
return emitGlobalSymbolCall(normalizedExpr, context);
|
|
1953
254
|
}
|
|
1954
255
|
// Check for global JSON.stringify/parse calls
|
|
1955
|
-
const globalJsonCall = isGlobalJsonCall(
|
|
256
|
+
const globalJsonCall = isGlobalJsonCall(normalizedExpr.callee, context);
|
|
1956
257
|
if (globalJsonCall) {
|
|
1957
|
-
return emitGlobalJsonCall(
|
|
1958
|
-
}
|
|
1959
|
-
// EF Core query canonicalization: ToList().ToArray()
|
|
1960
|
-
if (
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
const innerCall =
|
|
258
|
+
return emitGlobalJsonCall(normalizedExpr, context, globalJsonCall.method, expectedType);
|
|
259
|
+
}
|
|
260
|
+
// EF Core query canonicalization: ToList().ToArray() -> ToArray()
|
|
261
|
+
if (normalizedExpr.callee.kind === "memberAccess" &&
|
|
262
|
+
normalizedExpr.callee.property === "ToArray" &&
|
|
263
|
+
normalizedExpr.arguments.length === 0 &&
|
|
264
|
+
normalizedExpr.callee.object.kind === "call") {
|
|
265
|
+
const innerCall = normalizedExpr.callee.object;
|
|
1965
266
|
if (innerCall.callee.kind === "memberAccess" &&
|
|
1966
267
|
innerCall.callee.memberBinding?.isExtensionMethod &&
|
|
1967
268
|
isInstanceMemberAccess(innerCall.callee, context) &&
|
|
@@ -1987,116 +288,48 @@ export const emitCall = (expr, context) => {
|
|
|
1987
288
|
];
|
|
1988
289
|
}
|
|
1989
290
|
}
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
expr.callee.memberBinding?.isExtensionMethod &&
|
|
1993
|
-
isInstanceMemberAccess(expr.callee, context)) {
|
|
1994
|
-
let currentContext = context;
|
|
1995
|
-
const binding = expr.callee.memberBinding;
|
|
1996
|
-
const receiverExpr = expr.callee.object;
|
|
1997
|
-
const [receiverAst, receiverContext] = emitExpressionAst(receiverExpr, currentContext);
|
|
1998
|
-
currentContext = receiverContext;
|
|
1999
|
-
// Fluent extension method path
|
|
2000
|
-
if (shouldEmitFluentExtensionCall(binding)) {
|
|
2001
|
-
const ns = getTypeNamespace(binding.type);
|
|
2002
|
-
if (ns) {
|
|
2003
|
-
currentContext.usings.add(ns);
|
|
2004
|
-
}
|
|
2005
|
-
let typeArgAsts = [];
|
|
2006
|
-
if (expr.typeArguments && expr.typeArguments.length > 0) {
|
|
2007
|
-
const [typeArgs, typeContext] = emitTypeArgumentsAst(expr.typeArguments, currentContext);
|
|
2008
|
-
typeArgAsts = typeArgs;
|
|
2009
|
-
currentContext = typeContext;
|
|
2010
|
-
}
|
|
2011
|
-
const [argAsts, argContext] = emitCallArguments(expr.arguments, expr, currentContext);
|
|
2012
|
-
currentContext = argContext;
|
|
2013
|
-
const memberAccess = expr.isOptional
|
|
2014
|
-
? {
|
|
2015
|
-
kind: "conditionalMemberAccessExpression",
|
|
2016
|
-
expression: receiverAst,
|
|
2017
|
-
memberName: binding.member,
|
|
2018
|
-
}
|
|
2019
|
-
: {
|
|
2020
|
-
kind: "memberAccessExpression",
|
|
2021
|
-
expression: receiverAst,
|
|
2022
|
-
memberName: binding.member,
|
|
2023
|
-
};
|
|
2024
|
-
const invocation = {
|
|
2025
|
-
kind: "invocationExpression",
|
|
2026
|
-
expression: memberAccess,
|
|
2027
|
-
arguments: argAsts,
|
|
2028
|
-
typeArguments: typeArgAsts.length > 0 ? typeArgAsts : undefined,
|
|
2029
|
-
};
|
|
2030
|
-
return [
|
|
2031
|
-
wrapIntCast(needsIntCast(expr, binding.member), invocation),
|
|
2032
|
-
currentContext,
|
|
2033
|
-
];
|
|
2034
|
-
}
|
|
2035
|
-
let finalCalleeName = `global::${binding.type}.${binding.member}`;
|
|
2036
|
-
let typeArgAsts = [];
|
|
2037
|
-
if (expr.typeArguments && expr.typeArguments.length > 0) {
|
|
2038
|
-
if (expr.requiresSpecialization) {
|
|
2039
|
-
const [specializedName, specContext] = generateSpecializedName(finalCalleeName, expr.typeArguments, currentContext);
|
|
2040
|
-
finalCalleeName = specializedName;
|
|
2041
|
-
currentContext = specContext;
|
|
2042
|
-
}
|
|
2043
|
-
else {
|
|
2044
|
-
const [typeArgs, typeContext] = emitTypeArgumentsAst(expr.typeArguments, currentContext);
|
|
2045
|
-
typeArgAsts = typeArgs;
|
|
2046
|
-
currentContext = typeContext;
|
|
2047
|
-
}
|
|
2048
|
-
}
|
|
2049
|
-
const [argAsts, argContext] = emitCallArguments(expr.arguments, expr, currentContext);
|
|
2050
|
-
currentContext = argContext;
|
|
2051
|
-
// Prepend receiver as first argument (static extension call)
|
|
2052
|
-
const allArgAsts = [
|
|
2053
|
-
receiverAst,
|
|
2054
|
-
...argAsts,
|
|
2055
|
-
];
|
|
2056
|
-
const invocation = {
|
|
2057
|
-
kind: "invocationExpression",
|
|
2058
|
-
expression: {
|
|
2059
|
-
kind: "identifierExpression",
|
|
2060
|
-
identifier: finalCalleeName,
|
|
2061
|
-
},
|
|
2062
|
-
arguments: allArgAsts,
|
|
2063
|
-
typeArguments: typeArgAsts.length > 0 ? typeArgAsts : undefined,
|
|
2064
|
-
};
|
|
2065
|
-
// Wrap in ToArray() if result type is array
|
|
2066
|
-
const callAst = expr.inferredType?.kind === "arrayType"
|
|
2067
|
-
? {
|
|
2068
|
-
kind: "invocationExpression",
|
|
2069
|
-
expression: {
|
|
2070
|
-
kind: "identifierExpression",
|
|
2071
|
-
identifier: "global::System.Linq.Enumerable.ToArray",
|
|
2072
|
-
},
|
|
2073
|
-
arguments: [invocation],
|
|
2074
|
-
}
|
|
2075
|
-
: invocation;
|
|
2076
|
-
return [
|
|
2077
|
-
wrapIntCast(needsIntCast(expr, finalCalleeName), callAst),
|
|
2078
|
-
currentContext,
|
|
2079
|
-
];
|
|
2080
|
-
}
|
|
2081
|
-
const arrayWrapperInteropCall = emitArrayWrapperInteropCall(expr, context);
|
|
2082
|
-
const arrayMutationInteropCall = emitArrayMutationInteropCall(expr, context);
|
|
291
|
+
const arrayWrapperInteropCall = emitArrayWrapperInteropCall(normalizedExpr, context, expectedType);
|
|
292
|
+
const arrayMutationInteropCall = emitArrayMutationInteropCall(normalizedExpr, context);
|
|
2083
293
|
if (arrayMutationInteropCall) {
|
|
2084
294
|
return arrayMutationInteropCall;
|
|
2085
295
|
}
|
|
2086
296
|
if (arrayWrapperInteropCall) {
|
|
2087
297
|
return arrayWrapperInteropCall;
|
|
2088
298
|
}
|
|
299
|
+
// Extension method lowering — delegated to call-extension-methods.ts
|
|
300
|
+
// Keep this after native array interop so lifted/static container array
|
|
301
|
+
// mutation calls cannot fall through to copy-based source-owned array syntax.
|
|
302
|
+
const extensionResult = tryEmitExtensionMethodCall(normalizedExpr, context, expectedType);
|
|
303
|
+
if (extensionResult) {
|
|
304
|
+
return extensionResult;
|
|
305
|
+
}
|
|
306
|
+
const callableStaticAccessor = tryGetCallableStaticAccessorCall(normalizedExpr);
|
|
307
|
+
if (callableStaticAccessor) {
|
|
308
|
+
return emitCallableStaticAccessorCall(normalizedExpr, callableStaticAccessor.binding, context);
|
|
309
|
+
}
|
|
2089
310
|
// Regular function call
|
|
2090
|
-
const
|
|
2091
|
-
|
|
2092
|
-
|
|
311
|
+
const calleeExprForEmission = normalizedExpr.callee;
|
|
312
|
+
const shouldPreferParameterExpectedType = transparentCalleeIdentifier !== undefined &&
|
|
313
|
+
context.promiseResolveValueTypes?.has(transparentCalleeIdentifier.name) ===
|
|
314
|
+
true;
|
|
315
|
+
const calleeExpectedType = calleeExprForEmission.kind === "memberAccess"
|
|
316
|
+
? undefined
|
|
317
|
+
: buildCallTargetExpectedType(normalizedExpr, shouldPreferParameterExpectedType);
|
|
318
|
+
const [calleeAst, newContext] = calleeExprForEmission.kind === "memberAccess"
|
|
319
|
+
? emitMemberAccess(calleeExprForEmission, context, "call")
|
|
320
|
+
: emitExpressionAst(calleeExprForEmission, context, calleeExpectedType);
|
|
2093
321
|
let currentContext = newContext;
|
|
2094
322
|
let calleeExpr = calleeAst;
|
|
2095
323
|
let typeArgAsts = [];
|
|
2096
|
-
if (
|
|
2097
|
-
|
|
324
|
+
if (calleeExpr.kind === "lambdaExpression") {
|
|
325
|
+
const castedLambdaTarget = castInvokedLambdaTarget(calleeExpr, calleeExpectedType, currentContext);
|
|
326
|
+
calleeExpr = castedLambdaTarget[0];
|
|
327
|
+
currentContext = castedLambdaTarget[1];
|
|
328
|
+
}
|
|
329
|
+
if (normalizedExpr.typeArguments && normalizedExpr.typeArguments.length > 0) {
|
|
330
|
+
if (normalizedExpr.requiresSpecialization) {
|
|
2098
331
|
const calleeText = extractCalleeNameFromAst(calleeAst);
|
|
2099
|
-
const [specializedName, specContext] = generateSpecializedName(calleeText,
|
|
332
|
+
const [specializedName, specContext] = generateSpecializedName(calleeText, normalizedExpr.typeArguments, currentContext);
|
|
2100
333
|
calleeExpr = {
|
|
2101
334
|
kind: "identifierExpression",
|
|
2102
335
|
identifier: specializedName,
|
|
@@ -2104,15 +337,16 @@ export const emitCall = (expr, context) => {
|
|
|
2104
337
|
currentContext = specContext;
|
|
2105
338
|
}
|
|
2106
339
|
else {
|
|
2107
|
-
const [typeArgs, typeContext] = emitTypeArgumentsAst(
|
|
340
|
+
const [typeArgs, typeContext] = emitTypeArgumentsAst(normalizedExpr.typeArguments, currentContext);
|
|
2108
341
|
typeArgAsts = typeArgs;
|
|
2109
342
|
currentContext = typeContext;
|
|
2110
343
|
}
|
|
2111
344
|
}
|
|
2112
|
-
const
|
|
345
|
+
const structuralViewParameterTypes = resolveStructuralViewCallParameterTypes(normalizedExpr.callee, currentContext);
|
|
346
|
+
const [argAsts, argContext] = emitCallArguments(normalizedExpr.arguments, normalizedExpr, currentContext, structuralViewParameterTypes);
|
|
2113
347
|
currentContext = argContext;
|
|
2114
348
|
// Build the invocation target (may need optional chaining wrapper)
|
|
2115
|
-
const invocationTarget =
|
|
349
|
+
const invocationTarget = normalizedExpr.isOptional
|
|
2116
350
|
? (() => {
|
|
2117
351
|
// Optional call: callee?.(args) — in C# this requires the callee to be
|
|
2118
352
|
// a delegate and the call to be ?.Invoke(). For member access callees
|
|
@@ -2134,9 +368,26 @@ export const emitCall = (expr, context) => {
|
|
|
2134
368
|
arguments: argAsts,
|
|
2135
369
|
typeArguments: typeArgAsts.length > 0 ? typeArgAsts : undefined,
|
|
2136
370
|
};
|
|
371
|
+
const shouldCastSuperCallResult = normalizedExpr.callee.kind === "memberAccess" &&
|
|
372
|
+
normalizedExpr.callee.object.kind === "identifier" &&
|
|
373
|
+
normalizedExpr.callee.object.name === "super" &&
|
|
374
|
+
!!expectedType &&
|
|
375
|
+
expectedType.kind !== "voidType" &&
|
|
376
|
+
expectedType.kind !== "anyType" &&
|
|
377
|
+
expectedType.kind !== "unknownType";
|
|
378
|
+
let finalInvocation = invocation;
|
|
379
|
+
if (shouldCastSuperCallResult && expectedType) {
|
|
380
|
+
const [expectedTypeAst, expectedTypeContext] = emitTypeAst(expectedType, currentContext);
|
|
381
|
+
finalInvocation = {
|
|
382
|
+
kind: "castExpression",
|
|
383
|
+
type: expectedTypeAst,
|
|
384
|
+
expression: invocation,
|
|
385
|
+
};
|
|
386
|
+
currentContext = expectedTypeContext;
|
|
387
|
+
}
|
|
2137
388
|
const calleeText = extractCalleeNameFromAst(calleeAst);
|
|
2138
389
|
return [
|
|
2139
|
-
wrapIntCast(needsIntCast(
|
|
390
|
+
wrapIntCast(needsIntCast(normalizedExpr, calleeText), finalInvocation),
|
|
2140
391
|
currentContext,
|
|
2141
392
|
];
|
|
2142
393
|
};
|