eliscript 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/bootstrap/README.md +26 -0
- package/bootstrap/backends/README.md +515 -0
- package/bootstrap/backends/async.eli +230 -0
- package/bootstrap/backends/binary.eli +173 -0
- package/bootstrap/backends/capabilities.eli +74 -0
- package/bootstrap/backends/elf.eli +246 -0
- package/bootstrap/backends/managed.eli +5976 -0
- package/bootstrap/backends/memory.eli +100 -0
- package/bootstrap/backends/native.eli +2000 -0
- package/bootstrap/backends/numeric.eli +1362 -0
- package/bootstrap/backends/optimize.eli +79 -0
- package/bootstrap/backends/regexp.eli +2263 -0
- package/bootstrap/backends/sha256.eli +138 -0
- package/bootstrap/backends/wasm.eli +1161 -0
- package/bootstrap/compiler/analyzer.eli +165 -77
- package/bootstrap/compiler/compiler.eli +43 -19
- package/bootstrap/compiler/emitter.eli +780 -170
- package/bootstrap/compiler/expander.eli +136 -45
- package/bootstrap/compiler/formatter.eli +8 -1
- package/bootstrap/compiler/ir.eli +148 -45
- package/bootstrap/compiler/lower.eli +29 -2
- package/bootstrap/compiler/project.eli +51 -21
- package/bootstrap/compiler/reader.eli +128 -36
- package/bootstrap/compiler/source-map.eli +46 -4
- package/bootstrap/compiler/symbol.eli +2 -1
- package/bootstrap/compiler/syntax.eli +47 -12
- package/bootstrap/compiler/transient-analysis.eli +40 -4
- package/bootstrap/host/check-cli-legacy.mjs +163 -0
- package/bootstrap/host/check-cli.mjs +59 -158
- package/bootstrap/host/check-cli.mjs.map +1 -0
- package/bootstrap/host/compiler-session.eli +1579 -0
- package/bootstrap/host/compiler-tools.eli +513 -0
- package/bootstrap/host/eliscript-cli-legacy.mjs +37 -0
- package/bootstrap/host/eliscript-cli.mjs +53 -33
- package/bootstrap/host/eliscript-cli.mjs.map +1 -0
- package/bootstrap/host/project-cli-legacy.mjs +295 -0
- package/bootstrap/host/project-cli.mjs +74 -289
- package/bootstrap/host/project-cli.mjs.map +1 -0
- package/bootstrap/host/project-legacy.mjs +1080 -0
- package/bootstrap/host/project.mjs +210 -1060
- package/bootstrap/host/project.mjs.map +1 -0
- package/bootstrap/runtime/UNICODE-LICENSE.txt +39 -0
- package/bootstrap/runtime/memory.eli +30379 -0
- package/browser/host.mjs +89 -0
- package/compiler/eliscript-analyzer.el +371 -4
- package/compiler/eliscript-cli.el +84 -1
- package/compiler/eliscript-emitter.el +1189 -256
- package/compiler/eliscript-expander.el +147 -10
- package/compiler/eliscript-ir-emitter.el +725 -208
- package/compiler/eliscript-lower.el +127 -1
- package/compiler/eliscript-portable.el +177 -51
- package/compiler/eliscript-project.el +20 -2
- package/compiler/eliscript-reader.el +141 -57
- package/compiler/eliscript-source-map.el +26 -12
- package/compiler/eliscript-transient-analysis.el +382 -19
- package/dist/backends/async.mjs +561 -0
- package/dist/backends/async.mjs.macro-origins.json +1 -0
- package/dist/backends/async.mjs.map +1 -0
- package/dist/backends/binary.mjs +381 -0
- package/dist/backends/binary.mjs.macro-origins.json +1 -0
- package/dist/backends/binary.mjs.map +1 -0
- package/dist/backends/capabilities.mjs +237 -0
- package/dist/backends/capabilities.mjs.macro-origins.json +1 -0
- package/dist/backends/capabilities.mjs.map +1 -0
- package/dist/backends/elf.mjs +540 -0
- package/dist/backends/elf.mjs.macro-origins.json +1 -0
- package/dist/backends/elf.mjs.map +1 -0
- package/dist/backends/managed.mjs +10616 -0
- package/dist/backends/managed.mjs.macro-origins.json +1 -0
- package/dist/backends/managed.mjs.map +1 -0
- package/dist/backends/memory.mjs +278 -0
- package/dist/backends/memory.mjs.macro-origins.json +1 -0
- package/dist/backends/memory.mjs.map +1 -0
- package/dist/backends/native.mjs +4099 -0
- package/dist/backends/native.mjs.macro-origins.json +1 -0
- package/dist/backends/native.mjs.map +1 -0
- package/dist/backends/numeric.mjs +2458 -0
- package/dist/backends/numeric.mjs.macro-origins.json +1 -0
- package/dist/backends/numeric.mjs.map +1 -0
- package/dist/backends/optimize.mjs +204 -0
- package/dist/backends/optimize.mjs.macro-origins.json +1 -0
- package/dist/backends/optimize.mjs.map +1 -0
- package/dist/backends/regexp.mjs +2033 -0
- package/dist/backends/regexp.mjs.macro-origins.json +1 -0
- package/dist/backends/regexp.mjs.map +1 -0
- package/dist/backends/sha256.mjs +310 -0
- package/dist/backends/sha256.mjs.macro-origins.json +1 -0
- package/dist/backends/sha256.mjs.map +1 -0
- package/dist/backends/wasm.mjs +2258 -0
- package/dist/backends/wasm.mjs.macro-origins.json +1 -0
- package/dist/backends/wasm.mjs.map +1 -0
- package/dist/bootstrap/analyzer.mjs +1908 -776
- package/dist/bootstrap/analyzer.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/analyzer.mjs.map +1 -1
- package/dist/bootstrap/compiler.mjs +450 -142
- package/dist/bootstrap/compiler.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/compiler.mjs.map +1 -1
- package/dist/bootstrap/emitter.mjs +3083 -909
- package/dist/bootstrap/emitter.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/emitter.mjs.map +1 -1
- package/dist/bootstrap/expander.mjs +2887 -1233
- package/dist/bootstrap/expander.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/expander.mjs.map +1 -1
- package/dist/bootstrap/formatter.mjs +582 -218
- package/dist/bootstrap/formatter.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/formatter.mjs.map +1 -1
- package/dist/bootstrap/ir.mjs +670 -116
- package/dist/bootstrap/ir.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/ir.mjs.map +1 -1
- package/dist/bootstrap/lower.mjs +866 -257
- package/dist/bootstrap/lower.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/lower.mjs.map +1 -1
- package/dist/bootstrap/package.json +1 -0
- package/dist/bootstrap/project.mjs +1168 -498
- package/dist/bootstrap/project.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/project.mjs.map +1 -1
- package/dist/bootstrap/reader.mjs +674 -175
- package/dist/bootstrap/reader.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/reader.mjs.map +1 -1
- package/dist/bootstrap/runtime/math.mjs +1117 -0
- package/dist/bootstrap/runtime/math.mjs.map +1 -0
- package/dist/bootstrap/runtime/unicode-case-data.mjs +10125 -0
- package/dist/bootstrap/runtime/unicode-case-data.mjs.map +1 -0
- package/dist/bootstrap/runtime/unicode-case.mjs +281 -0
- package/dist/bootstrap/runtime/unicode-case.mjs.map +1 -0
- package/dist/bootstrap/source-map.mjs +430 -119
- package/dist/bootstrap/source-map.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/source-map.mjs.map +1 -1
- package/dist/bootstrap/symbol.mjs +229 -53
- package/dist/bootstrap/symbol.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/symbol.mjs.map +1 -1
- package/dist/bootstrap/syntax.mjs +205 -7
- package/dist/bootstrap/syntax.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/syntax.mjs.map +1 -1
- package/dist/bootstrap/transient-analysis.mjs +1185 -489
- package/dist/bootstrap/transient-analysis.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/transient-analysis.mjs.map +1 -1
- package/dist/browser/compiler.js +199 -6478
- package/dist/browser/host.mjs +446 -0
- package/dist/browser/loader.js +1 -0
- package/dist/browser/loader.mjs +231 -0
- package/dist/browser/worker.mjs +60 -0
- package/dist/compiler-artifact.json +1 -0
- package/dist/host/compiler-session.mjs +2980 -0
- package/dist/host/compiler-session.mjs.macro-origins.json +1 -0
- package/dist/host/compiler-session.mjs.map +1 -0
- package/dist/host/compiler-tools.mjs +1084 -0
- package/dist/host/compiler-tools.mjs.macro-origins.json +1 -0
- package/dist/host/compiler-tools.mjs.map +1 -0
- package/dist/literal-sources/runtime/core/collection-internals.eli +60 -0
- package/dist/literal-sources/runtime/core/collection.eli +579 -0
- package/dist/literal-sources/runtime/core/data-text.eli +290 -0
- package/dist/literal-sources/runtime/core/data.eli +22 -0
- package/dist/literal-sources/runtime/core/identifier.eli +44 -0
- package/dist/literal-sources/runtime/core/lazy-sequence.eli +131 -0
- package/dist/literal-sources/runtime/core/list.eli +19 -0
- package/dist/literal-sources/runtime/core/map.eli +9 -0
- package/dist/literal-sources/runtime/core/metadata-internals.eli +6 -0
- package/dist/literal-sources/runtime/core/metadata.eli +23 -0
- package/dist/literal-sources/runtime/core/object.eli +8 -0
- package/dist/literal-sources/runtime/core/order.eli +123 -0
- package/dist/literal-sources/runtime/core/persistent-kind.eli +28 -0
- package/dist/literal-sources/runtime/core/protocol-error.eli +32 -0
- package/dist/literal-sources/runtime/core/protocol.eli +28 -0
- package/dist/literal-sources/runtime/core/queue.eli +9 -0
- package/dist/literal-sources/runtime/core/record.eli +191 -0
- package/dist/literal-sources/runtime/core/regex.eli +158 -0
- package/dist/literal-sources/runtime/core/sequence.eli +305 -0
- package/dist/literal-sources/runtime/core/set-algebra.eli +28 -0
- package/dist/literal-sources/runtime/core/set.eli +9 -0
- package/dist/literal-sources/runtime/core/sorted.eli +408 -0
- package/dist/literal-sources/runtime/core/text.eli +14 -0
- package/dist/literal-sources/runtime/core/transducer.eli +268 -0
- package/dist/literal-sources/runtime/core/transient.eli +17 -0
- package/dist/literal-sources/runtime/core/truth.eli +4 -0
- package/dist/literal-sources/runtime/core/type.eli +232 -0
- package/dist/literal-sources/runtime/core/value-internals.eli +13 -0
- package/dist/literal-sources/runtime/core/value.eli +19 -0
- package/dist/literal-sources/runtime/core/vector.eli +20 -0
- package/dist/literal-sources/runtime/literals.eli +23 -0
- package/dist/literal-sources/runtime/testing/value.eli +6 -0
- package/dist/literal-sources/runtime/wire/http-rpc.eli +362 -0
- package/dist/literal-sources/runtime/wire/markdown.eli +275 -0
- package/dist/literal-sources/runtime/wire/schema.eli +193 -0
- package/dist/literal-sources/stdlib/bit.eli +36 -0
- package/dist/literal-sources/stdlib/core/data.eli +306 -0
- package/dist/literal-sources/stdlib/core/object.eli +89 -0
- package/dist/literal-sources/stdlib/core/protocol.eli +451 -0
- package/dist/literal-sources/stdlib/core/set.eli +312 -0
- package/dist/literal-sources/stdlib/core/text.eli +103 -0
- package/dist/literal-sources/stdlib/managed-literal-protocols.eli +483 -0
- package/dist/literal-sources/stdlib/managed-literals.eli +1414 -0
- package/dist/literal-sources/stdlib/managed-queue-state.eli +65 -0
- package/dist/literal-sources/stdlib/managed-sorted-state.eli +233 -0
- package/dist/literal-sources/stdlib/managed-transient-state.eli +348 -0
- package/dist/literal-sources/stdlib/managed-value-state.eli +153 -0
- package/dist/literal-sources/stdlib/managed-vector-view-state.eli +102 -0
- package/dist/literal-sources/stdlib/persistent-list.eli +145 -0
- package/dist/literal-sources/stdlib/persistent-map.eli +724 -0
- package/dist/literal-sources/stdlib/persistent-set.eli +236 -0
- package/dist/literal-sources/stdlib/persistent-vector.eli +359 -0
- package/dist/literal-sources/stdlib/value.eli +325 -0
- package/dist/package.json +10 -0
- package/dist/runtime/math.mjs +1116 -0
- package/dist/runtime/math.mjs.macro-origins.json +1 -0
- package/dist/runtime/math.mjs.map +1 -0
- package/dist/runtime/unicode-case-data.mjs +10124 -0
- package/dist/runtime/unicode-case-data.mjs.macro-origins.json +1 -0
- package/dist/runtime/unicode-case-data.mjs.map +1 -0
- package/dist/runtime/unicode-case.mjs +280 -0
- package/dist/runtime/unicode-case.mjs.macro-origins.json +1 -0
- package/dist/runtime/unicode-case.mjs.map +1 -0
- package/dist/runtime.eli +30379 -0
- package/dist/stage3-release.json +1 -0
- package/editor/README.md +1 -1
- package/editor/eliscript-mode.el +1 -1
- package/editor/eliscript-repl.el +1 -1
- package/package.json +97 -10
- package/platform/http.mjs +20 -0
- package/runtime/array-text.mjs +159 -0
- package/runtime/core/map-internals.mjs +27 -9
- package/runtime/core/object-impl.mjs +26 -17
- package/runtime/core/object-impl.mjs.map +1 -1
- package/runtime/core/protocol-impl.mjs +682 -255
- package/runtime/core/protocol-impl.mjs.map +1 -1
- package/runtime/core/protocol.mjs +4 -0
- package/runtime/core/record.mjs +23 -2
- package/runtime/core/regex.mjs +4 -0
- package/runtime/core/sorted.mjs +53 -0
- package/runtime/core/text-impl.mjs +167 -48
- package/runtime/core/text-impl.mjs.map +1 -1
- package/runtime/core/type.mjs +75 -3
- package/runtime/core/vector.mjs +6 -0
- package/runtime/math.eli +429 -0
- package/runtime/math.mjs +1116 -0
- package/runtime/math.mjs.map +1 -0
- package/runtime/number-radix.mjs +105 -0
- package/runtime/unicode-case-data.eli +29 -0
- package/runtime/unicode-case-data.mjs +10124 -0
- package/runtime/unicode-case-data.mjs.map +1 -0
- package/runtime/unicode-case.eli +100 -0
- package/runtime/unicode-case.mjs +280 -0
- package/runtime/unicode-case.mjs.map +1 -0
- package/runtime/wire/http-rpc.mjs +168 -0
- package/runtime/wire/markdown.mjs +196 -0
- package/runtime/wire/schema.mjs +109 -0
- package/stdlib/README.md +54 -0
- package/stdlib/core/protocol.eli +81 -17
- package/stdlib/core/seq.eli +1 -1
- package/stdlib/core/zipper.eli +114 -47
- package/stdlib/gepo.eli +12 -0
- package/stdlib/interop/js.eli +56 -15
- package/stdlib/managed-literal-protocols.eli +483 -0
- package/stdlib/managed-literals.eli +1414 -0
- package/stdlib/managed-protocol-error.eli +32 -0
- package/stdlib/managed-queue-state.eli +65 -0
- package/stdlib/managed-runtime-collection-internals.eli +60 -0
- package/stdlib/managed-runtime-collection.eli +579 -0
- package/stdlib/managed-runtime-data-text.eli +290 -0
- package/stdlib/managed-runtime-data.eli +22 -0
- package/stdlib/managed-runtime-identifier.eli +44 -0
- package/stdlib/managed-runtime-lazy-sequence.eli +131 -0
- package/stdlib/managed-runtime-list.eli +19 -0
- package/stdlib/managed-runtime-literals.eli +23 -0
- package/stdlib/managed-runtime-map.eli +9 -0
- package/stdlib/managed-runtime-metadata-internals.eli +6 -0
- package/stdlib/managed-runtime-metadata.eli +23 -0
- package/stdlib/managed-runtime-object.eli +8 -0
- package/stdlib/managed-runtime-order.eli +123 -0
- package/stdlib/managed-runtime-persistent-kind.eli +28 -0
- package/stdlib/managed-runtime-protocol.eli +28 -0
- package/stdlib/managed-runtime-queue.eli +9 -0
- package/stdlib/managed-runtime-record.eli +191 -0
- package/stdlib/managed-runtime-regex.eli +158 -0
- package/stdlib/managed-runtime-sequence.eli +305 -0
- package/stdlib/managed-runtime-set-algebra.eli +28 -0
- package/stdlib/managed-runtime-set.eli +9 -0
- package/stdlib/managed-runtime-sorted.eli +408 -0
- package/stdlib/managed-runtime-text.eli +14 -0
- package/stdlib/managed-runtime-transducer.eli +268 -0
- package/stdlib/managed-runtime-transient.eli +17 -0
- package/stdlib/managed-runtime-truth.eli +4 -0
- package/stdlib/managed-runtime-type.eli +232 -0
- package/stdlib/managed-runtime-value-internals.eli +13 -0
- package/stdlib/managed-runtime-value.eli +19 -0
- package/stdlib/managed-runtime-vector.eli +20 -0
- package/stdlib/managed-sorted-state.eli +233 -0
- package/stdlib/managed-testing-value.eli +6 -0
- package/stdlib/managed-transient-state.eli +348 -0
- package/stdlib/managed-value-state.eli +153 -0
- package/stdlib/managed-vector-view-state.eli +102 -0
- package/stdlib/managed-wire-http-rpc.eli +362 -0
- package/stdlib/managed-wire-markdown.eli +275 -0
- package/stdlib/managed-wire-schema.eli +193 -0
- package/stdlib/mdp.eli +7 -0
- package/stdlib/mds.eli +4 -0
- package/stdlib/persistent-vector.eli +23 -6
- package/tools/acceptance/check-legacy.mjs +687 -0
- package/tools/acceptance/check.eli +431 -0
- package/tools/acceptance/compile-evidence.el +49 -0
- package/tools/acceptance/finalize-legacy.mjs +498 -0
- package/tools/acceptance/finalize.eli +270 -0
- package/tools/backends/benchmark.mjs +175 -0
- package/tools/backends/build.mjs +135 -0
- package/tools/backends/compile.mjs +94 -0
- package/tools/backends/compiler-bootstrap.mjs +1001 -0
- package/tools/backends/compiler-browser.mjs +361 -0
- package/tools/backends/compiler-build.mjs +1628 -0
- package/tools/backends/compiler-cli-legacy.mjs +334 -0
- package/tools/backends/compiler-cli.mjs +29 -0
- package/tools/backends/compiler-corpus-bit.mjs +234 -0
- package/tools/backends/compiler-corpus-cli-adapters-legacy.mjs +362 -0
- package/tools/backends/compiler-corpus-cli-adapters.mjs +247 -0
- package/tools/backends/compiler-corpus-debugging.mjs +221 -0
- package/tools/backends/compiler-corpus-emitter.mjs +324 -0
- package/tools/backends/compiler-corpus-evaluation-adapters.mjs +65 -0
- package/tools/backends/compiler-corpus-execution-legacy.mjs +769 -0
- package/tools/backends/compiler-corpus-execution.mjs +3324 -0
- package/tools/backends/compiler-corpus-fuzz.mjs +229 -0
- package/tools/backends/compiler-corpus-generations.mjs +208 -0
- package/tools/backends/compiler-corpus-host-context-legacy.mjs +114 -0
- package/tools/backends/compiler-corpus-host-context.mjs +550 -0
- package/tools/backends/compiler-corpus-identity-host.mjs +553 -0
- package/tools/backends/compiler-corpus-identity-value-adapters-legacy.mjs +298 -0
- package/tools/backends/compiler-corpus-identity-value-adapters.mjs +69 -0
- package/tools/backends/compiler-corpus-isolated-exports.mjs +21 -0
- package/tools/backends/compiler-corpus-legacy.mjs +1155 -0
- package/tools/backends/compiler-corpus-literal-provider.mjs +282 -0
- package/tools/backends/compiler-corpus-managed-adapters-legacy.mjs +334 -0
- package/tools/backends/compiler-corpus-managed-adapters.mjs +937 -0
- package/tools/backends/compiler-corpus-managed-cases.mjs +179 -0
- package/tools/backends/compiler-corpus-managed-fixtures-legacy.mjs +879 -0
- package/tools/backends/compiler-corpus-managed-fixtures.mjs +1287 -0
- package/tools/backends/compiler-corpus-matchers.mjs +173 -0
- package/tools/backends/compiler-corpus-original-program.mjs +612 -0
- package/tools/backends/compiler-corpus-process.mjs +765 -0
- package/tools/backends/compiler-corpus-program-driver.mjs +306 -0
- package/tools/backends/compiler-corpus-project-adapters-legacy.mjs +497 -0
- package/tools/backends/compiler-corpus-project-adapters.mjs +340 -0
- package/tools/backends/compiler-corpus-project-entry-host.mjs +511 -0
- package/tools/backends/compiler-corpus-project-transport.mjs +151 -0
- package/tools/backends/compiler-corpus-raw-fixture-observer.mjs +1438 -0
- package/tools/backends/compiler-corpus-raw-language-fixtures.mjs +1456 -0
- package/tools/backends/compiler-corpus-raw-math-fixture.mjs +346 -0
- package/tools/backends/compiler-corpus-raw-special-fixtures.mjs +523 -0
- package/tools/backends/compiler-corpus-reference-legacy.mjs +263 -0
- package/tools/backends/compiler-corpus-reference.mjs +241 -0
- package/tools/backends/compiler-corpus-runtime-adapters-legacy.mjs +843 -0
- package/tools/backends/compiler-corpus-runtime-adapters.mjs +663 -0
- package/tools/backends/compiler-corpus-source-archive.mjs +206 -0
- package/tools/backends/compiler-corpus-tools-artifact-adapters.mjs +410 -0
- package/tools/backends/compiler-corpus-tools-cli.mjs +363 -0
- package/tools/backends/compiler-corpus-tools-reference.mjs +264 -0
- package/tools/backends/compiler-corpus.mjs +2054 -0
- package/tools/backends/compiler-debug.mjs +142 -0
- package/tools/backends/compiler-matrix.mjs +1955 -0
- package/tools/backends/compiler-metadata.mjs +203 -0
- package/tools/backends/compiler-package-browser.mjs +120 -0
- package/tools/backends/compiler-package-legacy.mjs +654 -0
- package/tools/backends/compiler-package.mjs +464 -0
- package/tools/backends/compiler-project.mjs +126 -0
- package/tools/backends/compiler-session.mjs +843 -0
- package/tools/backends/compiler-sha256.mjs +152 -0
- package/tools/backends/compiler-unicode-profile-host.mjs +196 -0
- package/tools/backends/compiler-worker.mjs +573 -0
- package/tools/backends/dist/bootstrap-js-stages.mjs +919 -0
- package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -0
- package/tools/backends/dist/managed-ir-inventory.mjs +488 -0
- package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -0
- package/tools/backends/dist/record-grid.mjs +1256 -0
- package/tools/backends/dist/record-grid.mjs.map +1 -0
- package/tools/backends/dist/release-cli.mjs +460 -0
- package/tools/backends/dist/release-cli.mjs.map +1 -0
- package/tools/backends/dist/run-artifact.mjs +517 -0
- package/tools/backends/dist/run-artifact.mjs.map +1 -0
- package/tools/backends/eliscript/compiler-corpus-bit.eli +77 -0
- package/tools/backends/eliscript/compiler-corpus-debugging.eli +70 -0
- package/tools/backends/eliscript/compiler-corpus-project-entry-host.eli +256 -0
- package/tools/backends/managed-foreign-binding.mjs +497 -0
- package/tools/backends/managed-host-legacy.mjs +1181 -0
- package/tools/backends/managed-host-lifecycle.mjs +310 -0
- package/tools/backends/managed-host-object-provider.mjs +155 -0
- package/tools/backends/managed-host-object-realm.mjs +797 -0
- package/tools/backends/managed-host-proxy.mjs +71 -0
- package/tools/backends/managed-host-runtime.mjs +5868 -0
- package/tools/backends/managed-host.mjs +716 -0
- package/tools/backends/managed-module-graph-legacy.mjs +308 -0
- package/tools/backends/managed-module-graph.mjs +694 -0
- package/tools/backends/managed-runtime-host-legacy.mjs +195 -0
- package/tools/backends/managed-runtime.mjs +939 -0
- package/tools/backends/managed-source-view-legacy.mjs +332 -0
- package/tools/backends/managed-source-view.mjs +959 -0
- package/tools/backends/memory-runtime.mjs +100 -0
- package/tools/backends/native-benchmark.mjs +88 -0
- package/tools/backends/native-managed-runtime.mjs +677 -0
- package/tools/backends/native-memory.mjs +768 -0
- package/tools/backends/native-node-memory.mjs +142 -0
- package/tools/backends/native-node-runner.mjs +99 -0
- package/tools/backends/native-node-watchdog.mjs +19 -0
- package/tools/backends/native-node-worker.mjs +75 -0
- package/tools/backends/stage3-targets.mjs +486 -0
- package/tools/bootstrap-command.el +13 -0
- package/tools/bootstrap-runtime.el +101 -0
- package/tools/bootstrap-seed.el +55 -0
- package/tools/project/check-cli.eli +31 -0
- package/tools/project/project-cli.eli +42 -0
- package/tools/project/project.eli +122 -0
- package/tools/runtime/unicode-case-profiles.mjs +13 -0
- package/tools/runtime/unicode-case-runtime.el +57 -0
- package/tools/testing/source-debugging-corpus-host.eli +16 -0
- package/tools/testing/source-debugging.eli +139 -0
- package/tools/testing/stdlib-bit-corpus-host.eli +21 -0
- package/tools/testing/stdlib-bit-corpus-host.mjs +118 -0
- package/tools/testing/stdlib-bit.eli +104 -0
- package/tools/testing/stdlib-bit.mjs +255 -0
- package/bin/eliscript-bootstrap +0 -15
|
@@ -1,897 +1,2487 @@
|
|
|
1
1
|
// Generated by Eliscript. Do not edit.
|
|
2
|
+
import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K";
|
|
3
|
+
var __eliscript_tdz_ready_0;
|
|
4
|
+
function __eliscript_tdz_read_0() { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("array_text_import"); return array_text_import; }
|
|
5
|
+
function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("array_text_import"); return __eliscript_const_error(); }
|
|
6
|
+
var __eliscript_tdz_ready_1;
|
|
7
|
+
function __eliscript_tdz_read_1() { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("literal_runtime_import"); return literal_runtime_import; }
|
|
8
|
+
function __eliscript_tdz_write_1(__eliscript_tdz_value_1) { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("literal_runtime_import"); return __eliscript_const_error(); }
|
|
9
|
+
var __eliscript_tdz_ready_2;
|
|
10
|
+
function __eliscript_tdz_read_2() { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("collection_runtime_import"); return collection_runtime_import; }
|
|
11
|
+
function __eliscript_tdz_write_2(__eliscript_tdz_value_2) { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("collection_runtime_import"); return __eliscript_const_error(); }
|
|
12
|
+
var __eliscript_tdz_ready_3;
|
|
13
|
+
function __eliscript_tdz_read_3() { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("list_runtime_import"); return list_runtime_import; }
|
|
14
|
+
function __eliscript_tdz_write_3(__eliscript_tdz_value_3) { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("list_runtime_import"); return __eliscript_const_error(); }
|
|
15
|
+
var __eliscript_tdz_ready_4;
|
|
16
|
+
function __eliscript_tdz_read_4() { if (__eliscript_tdz_ready_4 !== true) __eliscript_tdz_error("value_runtime_import"); return value_runtime_import; }
|
|
17
|
+
function __eliscript_tdz_write_4(__eliscript_tdz_value_4) { if (__eliscript_tdz_ready_4 !== true) __eliscript_tdz_error("value_runtime_import"); return __eliscript_const_error(); }
|
|
18
|
+
var __eliscript_tdz_ready_5;
|
|
19
|
+
function __eliscript_tdz_read_5() { if (__eliscript_tdz_ready_5 !== true) __eliscript_tdz_error("binding_runtime"); return binding_runtime; }
|
|
20
|
+
function __eliscript_tdz_write_5(__eliscript_tdz_value_5) { if (__eliscript_tdz_ready_5 !== true) __eliscript_tdz_error("binding_runtime"); return __eliscript_const_error(); }
|
|
21
|
+
var __eliscript_tdz_ready_6;
|
|
22
|
+
function __eliscript_tdz_read_6() { if (__eliscript_tdz_ready_6 !== true) __eliscript_tdz_error("number_conversion_intrinsics"); return number_conversion_intrinsics; }
|
|
23
|
+
function __eliscript_tdz_write_6(__eliscript_tdz_value_6) { if (__eliscript_tdz_ready_6 !== true) __eliscript_tdz_error("number_conversion_intrinsics"); return __eliscript_const_error(); }
|
|
24
|
+
var __eliscript_tdz_ready_7;
|
|
25
|
+
function __eliscript_tdz_read_7() { if (__eliscript_tdz_ready_7 !== true) __eliscript_tdz_error("number_conversion_capsule"); return number_conversion_capsule; }
|
|
26
|
+
function __eliscript_tdz_write_7(__eliscript_tdz_value_7) { if (__eliscript_tdz_ready_7 !== true) __eliscript_tdz_error("number_conversion_capsule"); return __eliscript_const_error(); }
|
|
27
|
+
var __eliscript_tdz_ready_8;
|
|
28
|
+
function __eliscript_tdz_read_8() { if (__eliscript_tdz_ready_8 !== true) __eliscript_tdz_error("number_conversion_body"); return number_conversion_body; }
|
|
29
|
+
function __eliscript_tdz_write_8(__eliscript_tdz_value_8) { if (__eliscript_tdz_ready_8 !== true) __eliscript_tdz_error("number_conversion_body"); return __eliscript_const_error(); }
|
|
30
|
+
var __eliscript_tdz_ready_9;
|
|
31
|
+
function __eliscript_tdz_read_9() { if (__eliscript_tdz_ready_9 !== true) __eliscript_tdz_error("number_conversion_helper"); return number_conversion_helper; }
|
|
32
|
+
function __eliscript_tdz_write_9(__eliscript_tdz_value_9) { if (__eliscript_tdz_ready_9 !== true) __eliscript_tdz_error("number_conversion_helper"); return __eliscript_const_error(); }
|
|
33
|
+
var __eliscript_tdz_ready_10;
|
|
34
|
+
function __eliscript_tdz_read_10() { if (__eliscript_tdz_ready_10 !== true) __eliscript_tdz_error("numeric_operator_helper"); return numeric_operator_helper; }
|
|
35
|
+
function __eliscript_tdz_write_10(__eliscript_tdz_value_10) { if (__eliscript_tdz_ready_10 !== true) __eliscript_tdz_error("numeric_operator_helper"); return __eliscript_const_error(); }
|
|
36
|
+
var __eliscript_tdz_ready_11;
|
|
37
|
+
function __eliscript_tdz_read_11() { if (__eliscript_tdz_ready_11 !== true) __eliscript_tdz_error("imul_intrinsic"); return imul_intrinsic; }
|
|
38
|
+
function __eliscript_tdz_write_11(__eliscript_tdz_value_11) { if (__eliscript_tdz_ready_11 !== true) __eliscript_tdz_error("imul_intrinsic"); return __eliscript_const_error(); }
|
|
39
|
+
var __eliscript_tdz_ready_12;
|
|
40
|
+
function __eliscript_tdz_read_12() { if (__eliscript_tdz_ready_12 !== true) __eliscript_tdz_error("imul_capsule"); return imul_capsule; }
|
|
41
|
+
function __eliscript_tdz_write_12(__eliscript_tdz_value_12) { if (__eliscript_tdz_ready_12 !== true) __eliscript_tdz_error("imul_capsule"); return __eliscript_const_error(); }
|
|
42
|
+
var __eliscript_tdz_ready_13;
|
|
43
|
+
function __eliscript_tdz_read_13() { if (__eliscript_tdz_ready_13 !== true) __eliscript_tdz_error("imul_operator_helper"); return imul_operator_helper; }
|
|
44
|
+
function __eliscript_tdz_write_13(__eliscript_tdz_value_13) { if (__eliscript_tdz_ready_13 !== true) __eliscript_tdz_error("imul_operator_helper"); return __eliscript_const_error(); }
|
|
45
|
+
var __eliscript_tdz_ready_14;
|
|
46
|
+
function __eliscript_tdz_read_14() { if (__eliscript_tdz_ready_14 !== true) __eliscript_tdz_error("numeric_emission_profile"); return numeric_emission_profile; }
|
|
47
|
+
function __eliscript_tdz_write_14(__eliscript_tdz_value_14) { if (__eliscript_tdz_ready_14 !== true) __eliscript_tdz_error("numeric_emission_profile"); return (numeric_emission_profile = __eliscript_tdz_value_14); }
|
|
48
|
+
var __eliscript_tdz_ready_15;
|
|
49
|
+
function __eliscript_tdz_read_15() { if (__eliscript_tdz_ready_15 !== true) __eliscript_tdz_error("host_identity_token_helper"); return host_identity_token_helper; }
|
|
50
|
+
function __eliscript_tdz_write_15(__eliscript_tdz_value_15) { if (__eliscript_tdz_ready_15 !== true) __eliscript_tdz_error("host_identity_token_helper"); return __eliscript_const_error(); }
|
|
51
|
+
var __eliscript_tdz_ready_16;
|
|
52
|
+
function __eliscript_tdz_read_16() { if (__eliscript_tdz_ready_16 !== true) __eliscript_tdz_error("fail"); return fail; }
|
|
53
|
+
function __eliscript_tdz_write_16(__eliscript_tdz_value_16) { if (__eliscript_tdz_ready_16 !== true) __eliscript_tdz_error("fail"); return __eliscript_const_error(); }
|
|
54
|
+
var __eliscript_tdz_ready_17;
|
|
55
|
+
function __eliscript_tdz_read_17() { if (__eliscript_tdz_ready_17 !== true) __eliscript_tdz_error("prefix_locate_mark"); return prefix_locate_mark; }
|
|
56
|
+
function __eliscript_tdz_write_17(__eliscript_tdz_value_17) { if (__eliscript_tdz_ready_17 !== true) __eliscript_tdz_error("prefix_locate_mark"); return __eliscript_const_error(); }
|
|
57
|
+
var __eliscript_tdz_ready_18;
|
|
58
|
+
function __eliscript_tdz_read_18() { if (__eliscript_tdz_ready_18 !== true) __eliscript_tdz_error("function_source_profile"); return function_source_profile; }
|
|
59
|
+
function __eliscript_tdz_write_18(__eliscript_tdz_value_18) { if (__eliscript_tdz_ready_18 !== true) __eliscript_tdz_error("function_source_profile"); return (function_source_profile = __eliscript_tdz_value_18); }
|
|
60
|
+
var __eliscript_tdz_ready_19;
|
|
61
|
+
function __eliscript_tdz_read_19() { if (__eliscript_tdz_ready_19 !== true) __eliscript_tdz_error("native_locate"); return native_locate; }
|
|
62
|
+
function __eliscript_tdz_write_19(__eliscript_tdz_value_19) { if (__eliscript_tdz_ready_19 !== true) __eliscript_tdz_error("native_locate"); return __eliscript_const_error(); }
|
|
63
|
+
var __eliscript_tdz_ready_20;
|
|
64
|
+
function __eliscript_tdz_read_20() { if (__eliscript_tdz_ready_20 !== true) __eliscript_tdz_error("temporary_counter"); return temporary_counter; }
|
|
65
|
+
function __eliscript_tdz_write_20(__eliscript_tdz_value_20) { if (__eliscript_tdz_ready_20 !== true) __eliscript_tdz_error("temporary_counter"); return (temporary_counter = __eliscript_tdz_value_20); }
|
|
66
|
+
var __eliscript_tdz_ready_21;
|
|
67
|
+
function __eliscript_tdz_read_21() { if (__eliscript_tdz_ready_21 !== true) __eliscript_tdz_error("binding_temporaries"); return binding_temporaries; }
|
|
68
|
+
function __eliscript_tdz_write_21(__eliscript_tdz_value_21) { if (__eliscript_tdz_ready_21 !== true) __eliscript_tdz_error("binding_temporaries"); return (binding_temporaries = __eliscript_tdz_value_21); }
|
|
69
|
+
var __eliscript_tdz_ready_22;
|
|
70
|
+
function __eliscript_tdz_read_22() { if (__eliscript_tdz_ready_22 !== true) __eliscript_tdz_error("tdz_import"); return tdz_import; }
|
|
71
|
+
function __eliscript_tdz_write_22(__eliscript_tdz_value_22) { if (__eliscript_tdz_ready_22 !== true) __eliscript_tdz_error("tdz_import"); return __eliscript_const_error(); }
|
|
72
|
+
var __eliscript_tdz_ready_23;
|
|
73
|
+
function __eliscript_tdz_read_23() { if (__eliscript_tdz_ready_23 !== true) __eliscript_tdz_error("tdz_state"); return tdz_state; }
|
|
74
|
+
function __eliscript_tdz_write_23(__eliscript_tdz_value_23) { if (__eliscript_tdz_ready_23 !== true) __eliscript_tdz_error("tdz_state"); return (tdz_state = __eliscript_tdz_value_23); }
|
|
75
|
+
var __eliscript_tdz_ready_24;
|
|
76
|
+
function __eliscript_tdz_read_24() { if (__eliscript_tdz_ready_24 !== true) __eliscript_tdz_error("native_indent"); return native_indent; }
|
|
77
|
+
function __eliscript_tdz_write_24(__eliscript_tdz_value_24) { if (__eliscript_tdz_ready_24 !== true) __eliscript_tdz_error("native_indent"); return __eliscript_const_error(); }
|
|
78
|
+
var __eliscript_tdz_ready_25;
|
|
79
|
+
function __eliscript_tdz_read_25() { if (__eliscript_tdz_ready_25 !== true) __eliscript_tdz_error("closed_scalar_operators"); return closed_scalar_operators; }
|
|
80
|
+
function __eliscript_tdz_write_25(__eliscript_tdz_value_25) { if (__eliscript_tdz_ready_25 !== true) __eliscript_tdz_error("closed_scalar_operators"); return __eliscript_const_error(); }
|
|
81
|
+
import "eliscript/runtime/unicode-case.mjs";
|
|
82
|
+
import "eliscript/runtime/math.mjs";
|
|
83
|
+
import { c as __eliscript_at, d as __eliscript_at_direct } from "data:text/javascript;base64,dmFyIG09UmVmbGVjdC5hcHBseSx0dD1OdW1iZXIucHJvdG90eXBlLnZhbHVlT2Ysaj1OdW1iZXIucHJvdG90eXBlLnRvU3RyaW5nLFU9TnVtYmVyLG50PU9iamVjdC5jcmVhdGUsaD1CaWdJbnQsZXQ9RGF0YVZpZXcsb3Q9QXJyYXlCdWZmZXIsaXQ9RGF0YVZpZXcucHJvdG90eXBlLnNldEZsb2F0NjQsSj1EYXRhVmlldy5wcm90b3R5cGUuZ2V0VWludDMyLHJ0PVJhbmdlRXJyb3I7ZnVuY3Rpb24gY3QodCxuKXtsZXQgZT1oKG4pLG89aCh0KSxpPSIiO2lmKG88MG4pbz0tbztkb3tsZXQgZj1vJWU7aT0iMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6IltVKGYpXStpLG8vPWV9d2hpbGUobyE9PTBuKTtyZXR1cm4gdDwwPyItIitpOml9ZnVuY3Rpb24gc3QodCxuKXtsZXQgZT1uZXcgZXQobmV3IG90KDgpKTttKGl0LGUsWzAsdCwhMV0pO2xldCBvPW0oSixlLFswLCExXSksaT1tKEosZSxbNCwhMV0pLGY9bz4+PjIwJjIwNDcsYj1vJjEwNDg1NzUscD1vPj4+MzEscj1oKGIpPDwzMm58aChpKTtpZihmIT09MClyKz0xbjw8NTJuO3I8PD0ybjtsZXQgbD00bix1PWY+MSYmYj09PTAmJmk9PT0wPzFuOjJuLGs9Mm47aWYoZj49MTA3NSl7bGV0IGM9aChmLTEwNzUpO3I8PD1jLHU8PD1jLGs8PD1jfWVsc2UgbDw8PWgoZj09PTA/MTA3NDoxMDc1LWYpO2xldCBkPWgobiksZz1udChudWxsKSxhPTAsUz0wLEQ9MDtpZihyPGwpd2hpbGUocjxsKXtpZihyKjJuPmwmJnIraz5sKWJyZWFrO3IqPWQsdSo9ZCxrKj1kLFMtLX1lbHNlIHdoaWxlKHI+PWwqZClsKj1kLFMrKztmb3IoOzspe2xldCBjPVUoci9sKTtyJT1sO2xldCBJPXI8dSx4PXIraz5sO2dbYSsrXT1jLEQ9RCoobiYxKStjJjE7bGV0IHE9cioybixQPXE+bHx8cT09PWwmJkQ9PT0xO2lmKFAmJnh8fCFQJiZJKXtpZihQKXtsZXQgUj1hLEI9ITA7d2hpbGUoUj4wJiZCKXtSLS07bGV0IEg9Z1tSXSsxO2lmKEg9PT1uKWdbUl09MDtlbHNlIGdbUl09SCxCPSExfWlmKEIpZ1swXT0xLFMrK31icmVha31pZihhPj02NCl0aHJvdyBuZXcgcnQoIm51bWJlciByYWRpeCBmb3JtYXR0aW5nIGRpZCBub3QgY29udmVyZ2UiKTtyKj1kLHUqPWQsayo9ZH13aGlsZShhPjEmJmdbYS0xXT09PTApYS0tO2xldCB3PSIiO2lmKFM8MCl7dz0iMC4iO2ZvcihsZXQgYz0wO2M8LTEtUztjKyspdys9IjAiO2ZvcihsZXQgYz0wO2M8YTtjKyspdys9IjAxMjM0NTY3ODlhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5eiJbZ1tjXV19ZWxzZXtsZXQgYz1TKzEsST1jPmE/YzphO2ZvcihsZXQgeD0wO3g8STt4Kyspe2lmKHg9PT1jJiZjPGEpdys9Ii4iO3crPXg8YT8iMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6IltnW3hdXToiMCJ9fXJldHVybiBwPyItIit3Ond9ZnVuY3Rpb24gRyh0LG4pe2xldCBlO3RyeXtlPW0odHQsdCxbXSl9Y2F0Y2h7cmV0dXJuIG0oaix0LFtuXSl9bGV0IG89MTA7aWYobiE9PXZvaWQgMCl7bGV0IGk9K247aWYobz1pIT09aT8wOmktaSUxLG88Mnx8bz4zNnx8byE9PW8pcmV0dXJuIG0oaixlLFtvXSl9aWYobz09PTEwfHxlPT09MHx8ZSE9PWV8fGU9PT0xLzB8fGU9PT0tMS8wKXJldHVybiBtKGosZSxbMTBdKTtyZXR1cm4gZSUxPT09MD9jdChlLG8pOnN0KGUsbyl9dmFyIHM9UmVmbGVjdC5hcHBseSxNPUZ1bmN0aW9uLnByb3RvdHlwZS5jYWxsLE49RnVuY3Rpb24ucHJvdG90eXBlLmFwcGx5LEU9RnVuY3Rpb24ucHJvdG90eXBlLmJpbmQsVD1PYmplY3QuZGVmaW5lUHJvcGVydHksbHQ9T2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcixmdD1PYmplY3QuZ2V0UHJvdG90eXBlT2YsdXQ9T2JqZWN0LnNldFByb3RvdHlwZU9mLGF0PVJlZmxlY3Qub3duS2V5cyxwdD1TeW1ib2wuaGFzSW5zdGFuY2UsVj1BcnJheS5pc0FycmF5LEs9QXJyYXkucHJvdG90eXBlLmpvaW4sej1BcnJheS5wcm90b3R5cGUudG9TdHJpbmcseXQ9T2JqZWN0LnByb3RvdHlwZS50b1N0cmluZyxidD1TdHJpbmcsQz1UeXBlRXJyb3IsZHQ9U3ltYm9sLnRvUHJpbWl0aXZlLGd0PVdlYWtTZXQucHJvdG90eXBlLmhhcyx3dD1XZWFrU2V0LnByb3RvdHlwZS5hZGQseHQ9V2Vha1NldC5wcm90b3R5cGUuZGVsZXRlLEY9bmV3IFdlYWtTZXQsTz1udWxsLFc9KHQpPT50IT09bnVsbCYmKHR5cGVvZiB0PT09Im9iamVjdCJ8fHR5cGVvZiB0PT09ImZ1bmN0aW9uInx8dHlwZW9mIHQ+InUiJiZ0IT09dm9pZCAwKSxBPSh0KT0+dHlwZW9mIHQ9PT0iZnVuY3Rpb24ifHx0eXBlb2YgdD4idSImJnQhPT12b2lkIDA7ZnVuY3Rpb24gaHQoKXtsZXQgbj1uZXcgQygiY3ljbGljIGFycmF5IHRleHQgY29udmVyc2lvbiIpO3Rocm93IG4uZWxpc2NyaXB0RGlhZ25vc3RpYz17Zm9ybWF0OiJlbGlzY3JpcHQtZGlhZ25vc3RpYyIsdmVyc2lvbjoxLGNvZGU6IkVMSS1SVDAwMDkiLHNldmVyaXR5OiJlcnJvciIscGhhc2U6InJ1bnRpbWUiLG1lc3NhZ2U6ImN5Y2xpYyBhcnJheSB0ZXh0IGNvbnZlcnNpb24ifSxufWZ1bmN0aW9uIG10KHQpe2lmKCFXKHQpKXJldHVybiB0O2xldCBuPXRbZHRdO2lmKG4hPT12b2lkIDAmJm4hPT1udWxsKXtsZXQgZT1zKG4sdCxbInN0cmluZyJdKTtpZighVyhlKSlyZXR1cm4gZTt0aHJvdyBuZXcgQygiQ2Fubm90IGNvbnZlcnQgb2JqZWN0IHRvIHByaW1pdGl2ZSB2YWx1ZSIpfWZvcihsZXQgZT0wO2U8MjtlKyspe2xldCBvPXRbZT09PTA/InRvU3RyaW5nIjoidmFsdWVPZiJdO2lmKEEobykpe2xldCBpPW89PT16JiZWKHQpP3YodCk6cyhvLHQsW10pO2lmKCFXKGkpKXJldHVybiBpfX10aHJvdyBuZXcgQygiQ2Fubm90IGNvbnZlcnQgb2JqZWN0IHRvIHByaW1pdGl2ZSB2YWx1ZSIpfWZ1bmN0aW9uIFEodCl7bGV0IG49bXQodCk7aWYodHlwZW9mIG49PT0ic3ltYm9sIil0aHJvdyBuZXcgQygiQ2Fubm90IGNvbnZlcnQgYSBTeW1ib2wgdmFsdWUgdG8gYSBzdHJpbmciKTtyZXR1cm4gYnQobil9ZnVuY3Rpb24gXyh0LG4pe2xldCBlPSt0Lmxlbmd0aCxvPWUhPT1lfHxlPD0wPzA6ZT49OTAwNzE5OTI1NDc0MDk5MT85MDA3MTk5MjU0NzQwOTkxOmUtZSUxLGk9bj09PXZvaWQgMD8iLCI6UShuKSxmPU89PT1udWxsO2lmKGYpTz10O2Vsc2V7aWYodD09PU98fHMoZ3QsRixbdF0pKWh0KCk7cyh3dCxGLFt0XSl9dHJ5e2xldCBiPSIiO2ZvcihsZXQgcD0wO3A8bztwKyspe2lmKHApYis9aTtsZXQgcj10W3BdO2lmKHIhPT1udWxsJiZyIT09dm9pZCAwKWIrPVEocil9cmV0dXJuIGJ9ZmluYWxseXtpZihmKU89bnVsbDtlbHNlIHMoeHQsRixbdF0pfX1mdW5jdGlvbiB2KHQpe2xldCBuPXQuam9pbjtyZXR1cm4gQShuKT9uPT09Sz9fKHQsdm9pZCAwKTpzKG4sdCxbXSk6cyh5dCx0LFtdKX1mdW5jdGlvbiB5KHQsbil7cmV0dXJuIG48dC5sZW5ndGg/dFtuXTp2b2lkIDB9ZnVuY3Rpb24gWCh0LG4pe2xldCBlPVtdO2ZvcihsZXQgbz1uO288dC5sZW5ndGg7bysrKVQoZSxlLmxlbmd0aCx7dmFsdWU6dFtvXSx3cml0YWJsZTohMCxlbnVtZXJhYmxlOiEwLGNvbmZpZ3VyYWJsZTohMH0pO3JldHVybiBlfWZ1bmN0aW9uIFN0KHQsbil7bGV0IGU9W107Zm9yKGxldCBvPTA7bzx0Lmxlbmd0aCtuLmxlbmd0aDtvKyspVChlLG8se3ZhbHVlOm88dC5sZW5ndGg/dFtvXTpuW28tdC5sZW5ndGhdLHdyaXRhYmxlOiEwLGVudW1lcmFibGU6ITAsY29uZmlndXJhYmxlOiEwfSk7cmV0dXJuIGV9ZnVuY3Rpb24gWSguLi50KXtyZXR1cm4gdH1mdW5jdGlvbiBaKHQsbil7cmV0dXJuIG4/cyhOLFksW3ZvaWQgMCx0XSk6cyhZLHZvaWQgMCx0KX1mdW5jdGlvbiBMKHQsbixlKXtmb3IoOzspe2lmKHQ9PT1qKXJldHVybiBHKG4seShlLDApKTtpZih0PT09SyYmVihuKSlyZXR1cm4gXyhuLHkoZSwwKSk7aWYodD09PXomJlYobikpcmV0dXJuIHYobik7aWYodD09PU0pe2lmKCFBKG4pKXJldHVybiBzKHQsbixlKTtsZXQgbz1uLGk9eShlLDApO2U9WChlLDEpLHQ9byxuPWk7Y29udGludWV9aWYodD09PU4pe2lmKCFBKG4pKXJldHVybiBzKHQsbixlKTtsZXQgbz1uLGk9eShlLDApO2U9Wih5KGUsMSksITApLHQ9byxuPWk7Y29udGludWV9aWYodD09PXMpe2xldCBvPXkoZSwwKSxpPXkoZSwxKTtpZighQShvKSlyZXR1cm4gcyh0LG4sZSk7ZT1aKHkoZSwyKSwhMSksdD1vLG49aTtjb250aW51ZX1pZih0PT09RSl7bGV0IG89cyh0LG4sZSk7aWYobiE9PWomJm4hPT1LJiZuIT09eiYmbiE9PU0mJm4hPT1OJiZuIT09cyYmbiE9PUUpcmV0dXJuIG87bGV0IGk9bixmPXkoZSwwKSxiPVgoZSwxKSxwPSguLi51KT0+TChpLGYsU3QoYix1KSk7VChwLHB0LHt2YWx1ZToodSk9PnUgaW5zdGFuY2VvZiBpLGNvbmZpZ3VyYWJsZTohMH0pO2xldCByPXMoRSxwLFt2b2lkIDBdKTt1dChyLGZ0KG8pKTtsZXQgbD1hdChvKTtmb3IobGV0IHU9MDt1PGwubGVuZ3RoO3UrKylUKHIsbFt1XSxsdChvLGxbdV0pKTtyZXR1cm4gcn1yZXR1cm4gcyh0LG4sZSl9fWZ1bmN0aW9uIFJ0KHQsbil7bGV0IGU9dFtuXTtyZXR1cm4oLi4ubyk9PkwoZSx0LG8pfWZ1bmN0aW9uIEF0KHQsbiwuLi5lKXtsZXQgbz10W25dO3JldHVybiBMKG8sdCxlKX1leHBvcnR7UnQgYXMgYyxBdCBhcyBkfTs=";
|
|
2
84
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
85
|
+
const __eliscript_number_intrinsic = globalThis.Number;
|
|
86
|
+
const __eliscript_bigint_intrinsic = globalThis.BigInt;
|
|
87
|
+
const __eliscript_numeric_apply = globalThis.Reflect.apply;
|
|
88
|
+
const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
|
|
89
|
+
const __eliscript_numeric_error = globalThis.TypeError;
|
|
90
|
+
const __eliscript_numeric_trim = globalThis.String.prototype.trim;
|
|
91
|
+
const __eliscript_numeric_slice = globalThis.String.prototype.slice;
|
|
92
|
+
const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
|
|
93
|
+
const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
|
|
94
|
+
const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
|
|
95
|
+
const __eliscript_numeric_primitive = (value) => {
|
|
96
|
+
if (!__eliscript_numeric_object(value)) return value;
|
|
97
|
+
const exotic = value[__eliscript_numeric_symbol];
|
|
98
|
+
if (exotic !== void 0 && exotic !== null) {
|
|
99
|
+
const result = __eliscript_numeric_apply(exotic, value, ["number"]);
|
|
100
|
+
if (!__eliscript_numeric_object(result)) return result;
|
|
101
|
+
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
102
|
+
}
|
|
103
|
+
for (let index = 0; index < 2; index++) {
|
|
104
|
+
const method = value[index === 0 ? "valueOf" : "toString"];
|
|
105
|
+
if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
|
|
106
|
+
const result = __eliscript_numeric_apply(method, value, []);
|
|
107
|
+
if (!__eliscript_numeric_object(result)) return result;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
111
|
+
};
|
|
112
|
+
const __eliscript_to_number = (value) => {
|
|
113
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
114
|
+
if (typeof primitive === "string") {
|
|
115
|
+
const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
|
|
116
|
+
if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
|
|
117
|
+
let first = 2;
|
|
118
|
+
while (first < text.length && text[first] === "0") first++;
|
|
119
|
+
if (first === text.length) return 0;
|
|
120
|
+
const prefix = text[1];
|
|
121
|
+
const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
|
|
122
|
+
if (text.length - first > limit) return 1 / 0;
|
|
123
|
+
const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
|
|
124
|
+
return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return __eliscript_number_intrinsic(primitive);
|
|
128
|
+
};
|
|
129
|
+
const __eliscript_numeric = (value) => {
|
|
130
|
+
if (typeof value === "number" || typeof value === "bigint") return value;
|
|
131
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
132
|
+
if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
|
|
133
|
+
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
134
|
+
};
|
|
135
|
+
const __eliscript_implicit_number = (value) => {
|
|
136
|
+
if (typeof value === "number") return value;
|
|
137
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
138
|
+
if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
|
|
139
|
+
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
140
|
+
};
|
|
141
|
+
const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
|
|
142
|
+
const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
|
|
143
|
+
const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
|
|
144
|
+
const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
|
|
145
|
+
const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
|
|
146
|
+
const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
|
|
147
|
+
const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
|
|
148
|
+
const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
|
|
149
|
+
const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
|
|
150
|
+
const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
|
|
151
|
+
const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
|
|
152
|
+
const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
|
|
153
|
+
const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
|
|
154
|
+
const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
|
|
155
|
+
const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
|
|
156
|
+
const __eliscript_numeric_relation = (operator, left, right) => {
|
|
157
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
158
|
+
if (operator === "<") return left < right;
|
|
159
|
+
if (operator === "<=") return left <= right;
|
|
160
|
+
if (operator === ">") return left > right;
|
|
161
|
+
return left >= right;
|
|
162
|
+
}
|
|
163
|
+
let a = __eliscript_numeric_primitive(left);
|
|
164
|
+
let b = __eliscript_numeric_primitive(right);
|
|
165
|
+
const x = typeof a, y = typeof b;
|
|
166
|
+
if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
|
|
167
|
+
a = __eliscript_numeric(a);
|
|
168
|
+
b = __eliscript_numeric(b);
|
|
169
|
+
}
|
|
170
|
+
if (operator === "<") return a < b;
|
|
171
|
+
if (operator === "<=") return a <= b;
|
|
172
|
+
if (operator === ">") return a > b;
|
|
173
|
+
return a >= b;
|
|
174
|
+
};
|
|
3
175
|
|
|
4
176
|
import {binding_name, reference_name} from "./symbol.mjs";
|
|
5
177
|
import {node_p, program_filename, program_body, ir_kind, ir_span, ir_value, ir_children, ir_property} from "./ir.mjs";
|
|
6
178
|
import {create_source_map} from "./source-map.mjs";
|
|
179
|
+
const array_text_import = "import { c as __eliscript_at, d as __eliscript_at_direct } from \"data:text/javascript;base64,dmFyIG09UmVmbGVjdC5hcHBseSx0dD1OdW1iZXIucHJvdG90eXBlLnZhbHVlT2Ysaj1OdW1iZXIucHJvdG90eXBlLnRvU3RyaW5nLFU9TnVtYmVyLG50PU9iamVjdC5jcmVhdGUsaD1CaWdJbnQsZXQ9RGF0YVZpZXcsb3Q9QXJyYXlCdWZmZXIsaXQ9RGF0YVZpZXcucHJvdG90eXBlLnNldEZsb2F0NjQsSj1EYXRhVmlldy5wcm90b3R5cGUuZ2V0VWludDMyLHJ0PVJhbmdlRXJyb3I7ZnVuY3Rpb24gY3QodCxuKXtsZXQgZT1oKG4pLG89aCh0KSxpPSIiO2lmKG88MG4pbz0tbztkb3tsZXQgZj1vJWU7aT0iMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6IltVKGYpXStpLG8vPWV9d2hpbGUobyE9PTBuKTtyZXR1cm4gdDwwPyItIitpOml9ZnVuY3Rpb24gc3QodCxuKXtsZXQgZT1uZXcgZXQobmV3IG90KDgpKTttKGl0LGUsWzAsdCwhMV0pO2xldCBvPW0oSixlLFswLCExXSksaT1tKEosZSxbNCwhMV0pLGY9bz4+PjIwJjIwNDcsYj1vJjEwNDg1NzUscD1vPj4+MzEscj1oKGIpPDwzMm58aChpKTtpZihmIT09MClyKz0xbjw8NTJuO3I8PD0ybjtsZXQgbD00bix1PWY+MSYmYj09PTAmJmk9PT0wPzFuOjJuLGs9Mm47aWYoZj49MTA3NSl7bGV0IGM9aChmLTEwNzUpO3I8PD1jLHU8PD1jLGs8PD1jfWVsc2UgbDw8PWgoZj09PTA/MTA3NDoxMDc1LWYpO2xldCBkPWgobiksZz1udChudWxsKSxhPTAsUz0wLEQ9MDtpZihyPGwpd2hpbGUocjxsKXtpZihyKjJuPmwmJnIraz5sKWJyZWFrO3IqPWQsdSo9ZCxrKj1kLFMtLX1lbHNlIHdoaWxlKHI+PWwqZClsKj1kLFMrKztmb3IoOzspe2xldCBjPVUoci9sKTtyJT1sO2xldCBJPXI8dSx4PXIraz5sO2dbYSsrXT1jLEQ9RCoobiYxKStjJjE7bGV0IHE9cioybixQPXE+bHx8cT09PWwmJkQ9PT0xO2lmKFAmJnh8fCFQJiZJKXtpZihQKXtsZXQgUj1hLEI9ITA7d2hpbGUoUj4wJiZCKXtSLS07bGV0IEg9Z1tSXSsxO2lmKEg9PT1uKWdbUl09MDtlbHNlIGdbUl09SCxCPSExfWlmKEIpZ1swXT0xLFMrK31icmVha31pZihhPj02NCl0aHJvdyBuZXcgcnQoIm51bWJlciByYWRpeCBmb3JtYXR0aW5nIGRpZCBub3QgY29udmVyZ2UiKTtyKj1kLHUqPWQsayo9ZH13aGlsZShhPjEmJmdbYS0xXT09PTApYS0tO2xldCB3PSIiO2lmKFM8MCl7dz0iMC4iO2ZvcihsZXQgYz0wO2M8LTEtUztjKyspdys9IjAiO2ZvcihsZXQgYz0wO2M8YTtjKyspdys9IjAxMjM0NTY3ODlhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5eiJbZ1tjXV19ZWxzZXtsZXQgYz1TKzEsST1jPmE/YzphO2ZvcihsZXQgeD0wO3g8STt4Kyspe2lmKHg9PT1jJiZjPGEpdys9Ii4iO3crPXg8YT8iMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6IltnW3hdXToiMCJ9fXJldHVybiBwPyItIit3Ond9ZnVuY3Rpb24gRyh0LG4pe2xldCBlO3RyeXtlPW0odHQsdCxbXSl9Y2F0Y2h7cmV0dXJuIG0oaix0LFtuXSl9bGV0IG89MTA7aWYobiE9PXZvaWQgMCl7bGV0IGk9K247aWYobz1pIT09aT8wOmktaSUxLG88Mnx8bz4zNnx8byE9PW8pcmV0dXJuIG0oaixlLFtvXSl9aWYobz09PTEwfHxlPT09MHx8ZSE9PWV8fGU9PT0xLzB8fGU9PT0tMS8wKXJldHVybiBtKGosZSxbMTBdKTtyZXR1cm4gZSUxPT09MD9jdChlLG8pOnN0KGUsbyl9dmFyIHM9UmVmbGVjdC5hcHBseSxNPUZ1bmN0aW9uLnByb3RvdHlwZS5jYWxsLE49RnVuY3Rpb24ucHJvdG90eXBlLmFwcGx5LEU9RnVuY3Rpb24ucHJvdG90eXBlLmJpbmQsVD1PYmplY3QuZGVmaW5lUHJvcGVydHksbHQ9T2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcixmdD1PYmplY3QuZ2V0UHJvdG90eXBlT2YsdXQ9T2JqZWN0LnNldFByb3RvdHlwZU9mLGF0PVJlZmxlY3Qub3duS2V5cyxwdD1TeW1ib2wuaGFzSW5zdGFuY2UsVj1BcnJheS5pc0FycmF5LEs9QXJyYXkucHJvdG90eXBlLmpvaW4sej1BcnJheS5wcm90b3R5cGUudG9TdHJpbmcseXQ9T2JqZWN0LnByb3RvdHlwZS50b1N0cmluZyxidD1TdHJpbmcsQz1UeXBlRXJyb3IsZHQ9U3ltYm9sLnRvUHJpbWl0aXZlLGd0PVdlYWtTZXQucHJvdG90eXBlLmhhcyx3dD1XZWFrU2V0LnByb3RvdHlwZS5hZGQseHQ9V2Vha1NldC5wcm90b3R5cGUuZGVsZXRlLEY9bmV3IFdlYWtTZXQsTz1udWxsLFc9KHQpPT50IT09bnVsbCYmKHR5cGVvZiB0PT09Im9iamVjdCJ8fHR5cGVvZiB0PT09ImZ1bmN0aW9uInx8dHlwZW9mIHQ+InUiJiZ0IT09dm9pZCAwKSxBPSh0KT0+dHlwZW9mIHQ9PT0iZnVuY3Rpb24ifHx0eXBlb2YgdD4idSImJnQhPT12b2lkIDA7ZnVuY3Rpb24gaHQoKXtsZXQgbj1uZXcgQygiY3ljbGljIGFycmF5IHRleHQgY29udmVyc2lvbiIpO3Rocm93IG4uZWxpc2NyaXB0RGlhZ25vc3RpYz17Zm9ybWF0OiJlbGlzY3JpcHQtZGlhZ25vc3RpYyIsdmVyc2lvbjoxLGNvZGU6IkVMSS1SVDAwMDkiLHNldmVyaXR5OiJlcnJvciIscGhhc2U6InJ1bnRpbWUiLG1lc3NhZ2U6ImN5Y2xpYyBhcnJheSB0ZXh0IGNvbnZlcnNpb24ifSxufWZ1bmN0aW9uIG10KHQpe2lmKCFXKHQpKXJldHVybiB0O2xldCBuPXRbZHRdO2lmKG4hPT12b2lkIDAmJm4hPT1udWxsKXtsZXQgZT1zKG4sdCxbInN0cmluZyJdKTtpZighVyhlKSlyZXR1cm4gZTt0aHJvdyBuZXcgQygiQ2Fubm90IGNvbnZlcnQgb2JqZWN0IHRvIHByaW1pdGl2ZSB2YWx1ZSIpfWZvcihsZXQgZT0wO2U8MjtlKyspe2xldCBvPXRbZT09PTA/InRvU3RyaW5nIjoidmFsdWVPZiJdO2lmKEEobykpe2xldCBpPW89PT16JiZWKHQpP3YodCk6cyhvLHQsW10pO2lmKCFXKGkpKXJldHVybiBpfX10aHJvdyBuZXcgQygiQ2Fubm90IGNvbnZlcnQgb2JqZWN0IHRvIHByaW1pdGl2ZSB2YWx1ZSIpfWZ1bmN0aW9uIFEodCl7bGV0IG49bXQodCk7aWYodHlwZW9mIG49PT0ic3ltYm9sIil0aHJvdyBuZXcgQygiQ2Fubm90IGNvbnZlcnQgYSBTeW1ib2wgdmFsdWUgdG8gYSBzdHJpbmciKTtyZXR1cm4gYnQobil9ZnVuY3Rpb24gXyh0LG4pe2xldCBlPSt0Lmxlbmd0aCxvPWUhPT1lfHxlPD0wPzA6ZT49OTAwNzE5OTI1NDc0MDk5MT85MDA3MTk5MjU0NzQwOTkxOmUtZSUxLGk9bj09PXZvaWQgMD8iLCI6UShuKSxmPU89PT1udWxsO2lmKGYpTz10O2Vsc2V7aWYodD09PU98fHMoZ3QsRixbdF0pKWh0KCk7cyh3dCxGLFt0XSl9dHJ5e2xldCBiPSIiO2ZvcihsZXQgcD0wO3A8bztwKyspe2lmKHApYis9aTtsZXQgcj10W3BdO2lmKHIhPT1udWxsJiZyIT09dm9pZCAwKWIrPVEocil9cmV0dXJuIGJ9ZmluYWxseXtpZihmKU89bnVsbDtlbHNlIHMoeHQsRixbdF0pfX1mdW5jdGlvbiB2KHQpe2xldCBuPXQuam9pbjtyZXR1cm4gQShuKT9uPT09Sz9fKHQsdm9pZCAwKTpzKG4sdCxbXSk6cyh5dCx0LFtdKX1mdW5jdGlvbiB5KHQsbil7cmV0dXJuIG48dC5sZW5ndGg/dFtuXTp2b2lkIDB9ZnVuY3Rpb24gWCh0LG4pe2xldCBlPVtdO2ZvcihsZXQgbz1uO288dC5sZW5ndGg7bysrKVQoZSxlLmxlbmd0aCx7dmFsdWU6dFtvXSx3cml0YWJsZTohMCxlbnVtZXJhYmxlOiEwLGNvbmZpZ3VyYWJsZTohMH0pO3JldHVybiBlfWZ1bmN0aW9uIFN0KHQsbil7bGV0IGU9W107Zm9yKGxldCBvPTA7bzx0Lmxlbmd0aCtuLmxlbmd0aDtvKyspVChlLG8se3ZhbHVlOm88dC5sZW5ndGg/dFtvXTpuW28tdC5sZW5ndGhdLHdyaXRhYmxlOiEwLGVudW1lcmFibGU6ITAsY29uZmlndXJhYmxlOiEwfSk7cmV0dXJuIGV9ZnVuY3Rpb24gWSguLi50KXtyZXR1cm4gdH1mdW5jdGlvbiBaKHQsbil7cmV0dXJuIG4/cyhOLFksW3ZvaWQgMCx0XSk6cyhZLHZvaWQgMCx0KX1mdW5jdGlvbiBMKHQsbixlKXtmb3IoOzspe2lmKHQ9PT1qKXJldHVybiBHKG4seShlLDApKTtpZih0PT09SyYmVihuKSlyZXR1cm4gXyhuLHkoZSwwKSk7aWYodD09PXomJlYobikpcmV0dXJuIHYobik7aWYodD09PU0pe2lmKCFBKG4pKXJldHVybiBzKHQsbixlKTtsZXQgbz1uLGk9eShlLDApO2U9WChlLDEpLHQ9byxuPWk7Y29udGludWV9aWYodD09PU4pe2lmKCFBKG4pKXJldHVybiBzKHQsbixlKTtsZXQgbz1uLGk9eShlLDApO2U9Wih5KGUsMSksITApLHQ9byxuPWk7Y29udGludWV9aWYodD09PXMpe2xldCBvPXkoZSwwKSxpPXkoZSwxKTtpZighQShvKSlyZXR1cm4gcyh0LG4sZSk7ZT1aKHkoZSwyKSwhMSksdD1vLG49aTtjb250aW51ZX1pZih0PT09RSl7bGV0IG89cyh0LG4sZSk7aWYobiE9PWomJm4hPT1LJiZuIT09eiYmbiE9PU0mJm4hPT1OJiZuIT09cyYmbiE9PUUpcmV0dXJuIG87bGV0IGk9bixmPXkoZSwwKSxiPVgoZSwxKSxwPSguLi51KT0+TChpLGYsU3QoYix1KSk7VChwLHB0LHt2YWx1ZToodSk9PnUgaW5zdGFuY2VvZiBpLGNvbmZpZ3VyYWJsZTohMH0pO2xldCByPXMoRSxwLFt2b2lkIDBdKTt1dChyLGZ0KG8pKTtsZXQgbD1hdChvKTtmb3IobGV0IHU9MDt1PGwubGVuZ3RoO3UrKylUKHIsbFt1XSxsdChvLGxbdV0pKTtyZXR1cm4gcn1yZXR1cm4gcyh0LG4sZSl9fWZ1bmN0aW9uIFJ0KHQsbil7bGV0IGU9dFtuXTtyZXR1cm4oLi4ubyk9PkwoZSx0LG8pfWZ1bmN0aW9uIEF0KHQsbiwuLi5lKXtsZXQgbz10W25dO3JldHVybiBMKG8sdCxlKX1leHBvcnR7UnQgYXMgYyxBdCBhcyBkfTs=\";\n";
|
|
180
|
+
__eliscript_tdz_ready_0 = true;
|
|
7
181
|
const literal_runtime_import = "import { hashMap as __eliscript_hash_map, hashSet as __eliscript_hash_set, keyword as __eliscript_keyword, list as __eliscript_list, queue as __eliscript_queue, symbol as __eliscript_symbol, vector as __eliscript_vector } from \"eliscript/runtime/literals.mjs\";\n";
|
|
182
|
+
__eliscript_tdz_ready_1 = true;
|
|
8
183
|
const collection_runtime_import = "import { count as __eliscript_count, nth as __eliscript_nth } from \"eliscript/runtime/core/collection.mjs\";\n";
|
|
184
|
+
__eliscript_tdz_ready_2 = true;
|
|
9
185
|
const list_runtime_import = "import { cons as __eliscript_cons, first as __eliscript_first, rest as __eliscript_rest } from \"eliscript/runtime/core/list.mjs\";\n";
|
|
186
|
+
__eliscript_tdz_ready_3 = true;
|
|
10
187
|
const value_runtime_import = "import { equalValues as __eliscript_equal } from \"eliscript/runtime/core/value.mjs\";\n";
|
|
188
|
+
__eliscript_tdz_ready_4 = true;
|
|
11
189
|
const binding_runtime = "import { get as __eliscript_get } from \"eliscript/runtime/core/collection.mjs\";\nconst __eliscript_binding_missing = Symbol(\"eliscript.binding.missing\");\nconst __eliscript_binding_get = (value, key, notFound) => { if (value == null) return notFound; const prototype = typeof value === \"object\" ? Object.getPrototypeOf(value) : undefined; if (prototype === Object.prototype || prototype === null) { const type = key && Object.getOwnPropertyDescriptor(key, Symbol.for(\"eliscript.value.type\")); if (type?.value === \"keyword\" || type?.value === \"symbol\") key = key.qualifiedName; } return __eliscript_get(value, key, notFound); };\n";
|
|
190
|
+
__eliscript_tdz_ready_5 = true;
|
|
191
|
+
const number_conversion_intrinsics = "const __eliscript_number_intrinsic = globalThis.Number;\nconst __eliscript_bigint_intrinsic = globalThis.BigInt;\nconst __eliscript_numeric_apply = globalThis.Reflect.apply;\nconst __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;\nconst __eliscript_numeric_error = globalThis.TypeError;\nconst __eliscript_numeric_trim = globalThis.String.prototype.trim;\nconst __eliscript_numeric_slice = globalThis.String.prototype.slice;\nconst __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;\n";
|
|
192
|
+
__eliscript_tdz_ready_6 = true;
|
|
193
|
+
const number_conversion_capsule = "import { __eliscript_number_intrinsic, __eliscript_bigint_intrinsic, __eliscript_numeric_apply, __eliscript_numeric_symbol, __eliscript_numeric_error, __eliscript_numeric_trim, __eliscript_numeric_slice, __eliscript_numeric_exec } from \"data:text/javascript;base64,ZXhwb3J0IGNvbnN0IF9fZWxpc2NyaXB0X251bWJlcl9pbnRyaW5zaWMgPSBnbG9iYWxUaGlzLk51bWJlcjsKZXhwb3J0IGNvbnN0IF9fZWxpc2NyaXB0X2JpZ2ludF9pbnRyaW5zaWMgPSBnbG9iYWxUaGlzLkJpZ0ludDsKZXhwb3J0IGNvbnN0IF9fZWxpc2NyaXB0X251bWVyaWNfYXBwbHkgPSBnbG9iYWxUaGlzLlJlZmxlY3QuYXBwbHk7CmV4cG9ydCBjb25zdCBfX2VsaXNjcmlwdF9udW1lcmljX3N5bWJvbCA9IGdsb2JhbFRoaXMuU3ltYm9sLnRvUHJpbWl0aXZlOwpleHBvcnQgY29uc3QgX19lbGlzY3JpcHRfbnVtZXJpY19lcnJvciA9IGdsb2JhbFRoaXMuVHlwZUVycm9yOwpleHBvcnQgY29uc3QgX19lbGlzY3JpcHRfbnVtZXJpY190cmltID0gZ2xvYmFsVGhpcy5TdHJpbmcucHJvdG90eXBlLnRyaW07CmV4cG9ydCBjb25zdCBfX2VsaXNjcmlwdF9udW1lcmljX3NsaWNlID0gZ2xvYmFsVGhpcy5TdHJpbmcucHJvdG90eXBlLnNsaWNlOwpleHBvcnQgY29uc3QgX19lbGlzY3JpcHRfbnVtZXJpY19leGVjID0gZ2xvYmFsVGhpcy5SZWdFeHAucHJvdG90eXBlLmV4ZWM7Cg==\";\n";
|
|
194
|
+
__eliscript_tdz_ready_7 = true;
|
|
195
|
+
const number_conversion_body = "const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;\nconst __eliscript_numeric_object = (value) => value !== null && (typeof value === \"object\" || typeof value === \"function\" || (typeof value === \"undefined\" && value !== void 0));\nconst __eliscript_numeric_primitive = (value) => {\n if (!__eliscript_numeric_object(value)) return value;\n const exotic = value[__eliscript_numeric_symbol];\n if (exotic !== void 0 && exotic !== null) {\n const result = __eliscript_numeric_apply(exotic, value, [\"number\"]);\n if (!__eliscript_numeric_object(result)) return result;\n throw new __eliscript_numeric_error(\"Cannot convert object to primitive value\");\n }\n for (let index = 0; index < 2; index++) {\n const method = value[index === 0 ? \"valueOf\" : \"toString\"];\n if (typeof method === \"function\" || (typeof method === \"undefined\" && method !== void 0)) {\n const result = __eliscript_numeric_apply(method, value, []);\n if (!__eliscript_numeric_object(result)) return result;\n }\n }\n throw new __eliscript_numeric_error(\"Cannot convert object to primitive value\");\n};\nconst __eliscript_to_number = (value) => {\n const primitive = __eliscript_numeric_primitive(value);\n if (typeof primitive === \"string\") {\n const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);\n if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {\n let first = 2;\n while (first < text.length && text[first] === \"0\") first++;\n if (first === text.length) return 0;\n const prefix = text[1];\n const limit = prefix === \"x\" || prefix === \"X\" ? 256 : prefix === \"b\" || prefix === \"B\" ? 1024 : 342;\n if (text.length - first > limit) return 1 / 0;\n const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);\n return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));\n }\n }\n return __eliscript_number_intrinsic(primitive);\n};\n";
|
|
196
|
+
__eliscript_tdz_ready_8 = true;
|
|
197
|
+
const number_conversion_helper = (String((__eliscript_tdz_read_6())) + String((__eliscript_tdz_read_8())));
|
|
198
|
+
__eliscript_tdz_ready_9 = true;
|
|
199
|
+
const numeric_operator_helper = "const __eliscript_numeric = (value) => {\n if (typeof value === \"number\" || typeof value === \"bigint\") return value;\n const primitive = __eliscript_numeric_primitive(value);\n if (typeof primitive === \"number\" || typeof primitive === \"bigint\") return primitive;\n return typeof primitive === \"string\" ? __eliscript_to_number(primitive) : +primitive;\n};\nconst __eliscript_implicit_number = (value) => {\n if (typeof value === \"number\") return value;\n const primitive = __eliscript_numeric_primitive(value);\n if (typeof primitive === \"bigint\") throw new __eliscript_numeric_error(\"Cannot convert a BigInt value to a number\");\n return typeof primitive === \"string\" ? __eliscript_to_number(primitive) : +primitive;\n};\nconst __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;\nconst __eliscript_numeric_sub = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };\nconst __eliscript_numeric_mul = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };\nconst __eliscript_numeric_div = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };\nconst __eliscript_numeric_rem = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };\nconst __eliscript_numeric_and = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };\nconst __eliscript_numeric_or = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };\nconst __eliscript_numeric_xor = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };\nconst __eliscript_numeric_shl = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };\nconst __eliscript_numeric_shr = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };\nconst __eliscript_numeric_ushr = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };\nconst __eliscript_numeric_neg = (a) => typeof a === \"number\" ? -a : -__eliscript_numeric(a);\nconst __eliscript_numeric_int32 = (a) => typeof a === \"number\" ? a | 0 : __eliscript_numeric(a) | 0;\nconst __eliscript_numeric_uint32 = (a) => typeof a === \"number\" ? a >>> 0 : __eliscript_numeric(a) >>> 0;\nconst __eliscript_numeric_not = (a) => typeof a === \"number\" ? ~a : ~__eliscript_numeric(a);\nconst __eliscript_numeric_relation = (operator, left, right) => {\n if (typeof left === \"number\" && typeof right === \"number\") {\n if (operator === \"<\") return left < right;\n if (operator === \"<=\") return left <= right;\n if (operator === \">\") return left > right;\n return left >= right;\n }\n let a = __eliscript_numeric_primitive(left);\n let b = __eliscript_numeric_primitive(right);\n const x = typeof a, y = typeof b;\n if (!((x === \"string\" && y === \"string\") || (x === \"bigint\" && y === \"string\") || (x === \"string\" && y === \"bigint\"))) {\n a = __eliscript_numeric(a);\n b = __eliscript_numeric(b);\n }\n if (operator === \"<\") return a < b;\n if (operator === \"<=\") return a <= b;\n if (operator === \">\") return a > b;\n return a >= b;\n};\n";
|
|
200
|
+
__eliscript_tdz_ready_10 = true;
|
|
201
|
+
const imul_intrinsic = "const __eliscript_numeric_imul_intrinsic = globalThis.Math.imul;\n";
|
|
202
|
+
__eliscript_tdz_ready_11 = true;
|
|
203
|
+
const imul_capsule = "import { __eliscript_numeric_imul_intrinsic } from \"data:text/javascript;base64,ZXhwb3J0IGNvbnN0IF9fZWxpc2NyaXB0X251bWVyaWNfaW11bF9pbnRyaW5zaWMgPSBnbG9iYWxUaGlzLk1hdGguaW11bDsK\";\n";
|
|
204
|
+
__eliscript_tdz_ready_12 = true;
|
|
205
|
+
const imul_operator_helper = "const __eliscript_numeric_imul = (a, b) => __eliscript_numeric_imul_intrinsic(__eliscript_implicit_number(a), __eliscript_implicit_number(b));\n";
|
|
206
|
+
__eliscript_tdz_ready_13 = true;
|
|
207
|
+
let numeric_emission_profile = false;
|
|
208
|
+
__eliscript_tdz_ready_14 = true;
|
|
12
209
|
const host_identity_token_helper = "const __eliscript_host_identity_token = (() => { const objects = new WeakMap(); const symbols = new Map(); let next = 1; return (value) => { const type = typeof value; if ((type !== \"object\" || value === null) && type !== \"function\" && type !== \"symbol\") throw new TypeError(\"host-identity-token expects an object, function, or symbol\"); const identities = type === \"symbol\" ? symbols : objects; const cached = identities.get(value); if (cached !== undefined) return cached; if (next > Number.MAX_SAFE_INTEGER) throw new RangeError(\"host identity token space exhausted\"); const token = next; next += 1; identities.set(value, token); return token; }; })();\n";
|
|
13
|
-
|
|
14
|
-
const
|
|
210
|
+
__eliscript_tdz_ready_15 = true;
|
|
211
|
+
const fail = ((message) => {
|
|
212
|
+
return ((__eliscript_value_1) => { throw __eliscript_value_1; })(new (Error)(message));
|
|
213
|
+
});
|
|
214
|
+
__eliscript_tdz_ready_16 = true;
|
|
215
|
+
const prefix_locate_mark = (head, tail) => [head, ...tail];
|
|
216
|
+
__eliscript_tdz_ready_17 = true;
|
|
217
|
+
let function_source_profile = false;
|
|
218
|
+
__eliscript_tdz_ready_18 = true;
|
|
219
|
+
const native_locate = ((span, output) => {
|
|
220
|
+
{
|
|
221
|
+
let fragment = ((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(output) === "string") ? ({"text": output, "marks": []}) : output);
|
|
222
|
+
let marks = (fragment)["marks"];
|
|
223
|
+
if (__eliscript_truthy(((__eliscript_value_2) => (__eliscript_truthy(__eliscript_value_2) ? __eliscript_value_2 : ((((fragment)["text"])["length"] === 0) || (span == null) || (span === false) || (__eliscript_numeric_relation(">", (marks)["length"], 0) && (((marks)[0])["offset"] === 0)))))((__eliscript_tdz_read_18())))) {
|
|
224
|
+
return fragment;
|
|
225
|
+
} else {
|
|
226
|
+
{
|
|
227
|
+
const __eliscript_value_3 = ({"text": (fragment)["text"], "marks": (__eliscript_tdz_read_17())(({"offset": 0, "span": span}), marks)});
|
|
228
|
+
{
|
|
229
|
+
let result = __eliscript_value_3;
|
|
230
|
+
if (__eliscript_truthy((__eliscript_tdz_read_18()))) {
|
|
231
|
+
((result)["functions"] = ((fragment)["functions"] ?? []));
|
|
232
|
+
}
|
|
233
|
+
return result;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
__eliscript_tdz_ready_19 = true;
|
|
15
240
|
let temporary_counter = 0;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
241
|
+
__eliscript_tdz_ready_20 = true;
|
|
242
|
+
let binding_temporaries = new (globalThis.Map)();
|
|
243
|
+
__eliscript_tdz_ready_21 = true;
|
|
244
|
+
const tdz_import = "import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from \"data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K\";\n";
|
|
245
|
+
__eliscript_tdz_ready_22 = true;
|
|
246
|
+
let tdz_state = null;
|
|
247
|
+
__eliscript_tdz_ready_23 = true;
|
|
248
|
+
function tdz_ready_name(record) {
|
|
249
|
+
return (String("__eliscript_tdz_ready_") + String((record)["index"]));
|
|
250
|
+
}
|
|
251
|
+
function tdz_root_name(name) {
|
|
252
|
+
{
|
|
253
|
+
const __eliscript_value_4 = (name)["indexOf"](".");
|
|
254
|
+
const __eliscript_value_5 = (name)["indexOf"]("/");
|
|
255
|
+
{
|
|
256
|
+
let dot = __eliscript_value_4;
|
|
257
|
+
let slash = __eliscript_value_5;
|
|
258
|
+
{
|
|
259
|
+
const __eliscript_value_6 = (__eliscript_numeric_relation("<", dot, 0) ? slash : (__eliscript_numeric_relation("<", slash, 0) ? dot : (__eliscript_numeric_relation("<", dot, slash) ? dot : slash)));
|
|
260
|
+
{
|
|
261
|
+
let end = __eliscript_value_6;
|
|
262
|
+
if (__eliscript_numeric_relation("<", end, 0)) {
|
|
263
|
+
return name;
|
|
264
|
+
} else {
|
|
265
|
+
return (name)["slice"](0, end);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function tdz_scope(parent) {
|
|
273
|
+
return ({"parent": parent, "names": new (globalThis.Map)()});
|
|
274
|
+
}
|
|
275
|
+
function tdz_find(scope, name) {
|
|
276
|
+
{
|
|
277
|
+
const __eliscript_value_7 = scope;
|
|
278
|
+
const __eliscript_value_8 = false;
|
|
279
|
+
const __eliscript_value_9 = null;
|
|
280
|
+
const __eliscript_value_10 = binding_name(name);
|
|
281
|
+
{
|
|
282
|
+
let current = __eliscript_value_7;
|
|
283
|
+
let found = __eliscript_value_8;
|
|
284
|
+
let record = __eliscript_value_9;
|
|
285
|
+
let key = __eliscript_value_10;
|
|
286
|
+
while (__eliscript_truthy(((__eliscript_value_11) => (__eliscript_truthy(__eliscript_value_11) ? (!__eliscript_truthy(found)) : __eliscript_value_11))(current))) {
|
|
287
|
+
{
|
|
288
|
+
const __eliscript_value_12 = (current)["names"];
|
|
289
|
+
{
|
|
290
|
+
let names = __eliscript_value_12;
|
|
291
|
+
if (__eliscript_truthy((names)["has"](key))) {
|
|
292
|
+
((record = (names)["get"](key)));
|
|
293
|
+
((found = true));
|
|
294
|
+
} else {
|
|
295
|
+
((current = (current)["parent"]));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return record;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
function tdz_pattern_names(node, scope) {
|
|
305
|
+
{
|
|
306
|
+
const __eliscript_value_13 = ir_kind(node);
|
|
307
|
+
const __eliscript_value_14 = children(node);
|
|
308
|
+
{
|
|
309
|
+
let kind = __eliscript_value_13;
|
|
310
|
+
let nodes = __eliscript_value_14;
|
|
311
|
+
if ((kind === "binding-name")) {
|
|
312
|
+
return ((scope)["names"])["set"](binding_name(ir_value(node)), null);
|
|
313
|
+
} else {
|
|
314
|
+
if ((kind === "map-binding-entry")) {
|
|
315
|
+
return tdz_pattern_names(((((nodes) ?? [])[0]) ?? null), scope);
|
|
316
|
+
} else {
|
|
317
|
+
if (((kind === "array-binding-pattern") || (kind === "map-binding-pattern"))) {
|
|
318
|
+
return (nodes)["forEach"](((child) => {
|
|
319
|
+
return tdz_pattern_names(child, scope);
|
|
320
|
+
}));
|
|
321
|
+
} else {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function tdz_bind(node, scope) {
|
|
330
|
+
if (__eliscript_truthy(ir_property(node, "pattern"))) {
|
|
331
|
+
return tdz_pattern_names(((((children(node)) ?? [])[0]) ?? null), scope);
|
|
332
|
+
} else {
|
|
333
|
+
return ((scope)["names"])["set"](binding_name(ir_value(node)), null);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
function tdz_pattern_defaults(node, scope, state) {
|
|
337
|
+
{
|
|
338
|
+
const __eliscript_value_15 = ir_kind(node);
|
|
339
|
+
const __eliscript_value_16 = children(node);
|
|
340
|
+
{
|
|
341
|
+
let kind = __eliscript_value_15;
|
|
342
|
+
let nodes = __eliscript_value_16;
|
|
343
|
+
if ((kind === "map-binding-entry")) {
|
|
344
|
+
if (__eliscript_numeric_relation(">", ((nodes) ?? []).length, 2)) {
|
|
345
|
+
tdz_walk(((((nodes) ?? [])[2]) ?? null), scope, state);
|
|
346
|
+
}
|
|
347
|
+
return tdz_pattern_defaults(((((nodes) ?? [])[0]) ?? null), scope, state);
|
|
348
|
+
} else {
|
|
349
|
+
if (((kind === "array-binding-pattern") || (kind === "map-binding-pattern"))) {
|
|
350
|
+
return (nodes)["forEach"](((child) => {
|
|
351
|
+
return tdz_pattern_defaults(child, scope, state);
|
|
352
|
+
}));
|
|
353
|
+
} else {
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function tdz_defaults(node, scope, state) {
|
|
361
|
+
if (__eliscript_truthy(ir_property(node, "pattern"))) {
|
|
362
|
+
return tdz_pattern_defaults(((((children(node)) ?? [])[0]) ?? null), scope, state);
|
|
363
|
+
} else {
|
|
364
|
+
return null;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
function tdz_predeclare(nodes, scope, state) {
|
|
368
|
+
return (nodes)["forEach"](((node) => {
|
|
369
|
+
{
|
|
370
|
+
const __eliscript_value_17 = ir_kind(node);
|
|
371
|
+
{
|
|
372
|
+
let kind = __eliscript_value_17;
|
|
373
|
+
if ((kind === "module-declaration")) {
|
|
374
|
+
return tdz_predeclare(children(node), scope, state);
|
|
375
|
+
} else {
|
|
376
|
+
if ((kind === "variable-declaration")) {
|
|
377
|
+
{
|
|
378
|
+
const __eliscript_value_18 = ({"name": ir_value(node), "index": (((state)["variables"]) ?? []).length, "mutable": ir_property(node, "mutable")});
|
|
379
|
+
{
|
|
380
|
+
let record = __eliscript_value_18;
|
|
381
|
+
((state)["variables"])["push"](record);
|
|
382
|
+
((state)["declarations"])["set"](node, record);
|
|
383
|
+
return ((scope)["names"])["set"](binding_name(ir_value(node)), record);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
} else {
|
|
387
|
+
if ((kind === "function-declaration")) {
|
|
388
|
+
return ((scope)["names"])["set"](binding_name(ir_value(node)), null);
|
|
389
|
+
} else {
|
|
390
|
+
if ((kind === "import-declaration")) {
|
|
391
|
+
return (children(node))["forEach"](((child) => {
|
|
392
|
+
return ((scope)["names"])["set"](binding_name(ir_value(child)), null);
|
|
393
|
+
}));
|
|
394
|
+
} else {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}));
|
|
403
|
+
}
|
|
404
|
+
function tdz_walk(node, scope, state) {
|
|
405
|
+
{
|
|
406
|
+
const __eliscript_value_19 = ir_kind(node);
|
|
407
|
+
const __eliscript_value_20 = children(node);
|
|
408
|
+
{
|
|
409
|
+
let kind = __eliscript_value_19;
|
|
410
|
+
let nodes = __eliscript_value_20;
|
|
411
|
+
if (((kind === "reference") || (kind === "assignment-pair"))) {
|
|
412
|
+
{
|
|
413
|
+
const __eliscript_value_21 = tdz_find(scope, tdz_root_name(ir_value(node)));
|
|
414
|
+
{
|
|
415
|
+
let record = __eliscript_value_21;
|
|
416
|
+
if (__eliscript_truthy(record)) {
|
|
417
|
+
((state)[((kind === "reference") ? "reads" : "writes")])["set"](node, record);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
return (nodes)["forEach"](((child) => {
|
|
422
|
+
return tdz_walk(child, scope, state);
|
|
423
|
+
}));
|
|
424
|
+
} else {
|
|
425
|
+
if (((kind === "function-declaration") || (kind === "function-expression"))) {
|
|
426
|
+
{
|
|
427
|
+
const __eliscript_value_22 = tdz_scope(scope);
|
|
428
|
+
const __eliscript_value_23 = ir_property(node, "parameterCount");
|
|
429
|
+
const __eliscript_value_24 = 0;
|
|
430
|
+
{
|
|
431
|
+
let child = __eliscript_value_22;
|
|
432
|
+
let count = __eliscript_value_23;
|
|
433
|
+
let index = __eliscript_value_24;
|
|
434
|
+
while (__eliscript_numeric_relation("<", index, count)) {
|
|
435
|
+
tdz_defaults(((((nodes) ?? [])[index]) ?? null), scope, state);
|
|
436
|
+
((index = (index + 1)));
|
|
437
|
+
}
|
|
438
|
+
((index = 0));
|
|
439
|
+
while (__eliscript_numeric_relation("<", index, count)) {
|
|
440
|
+
tdz_bind(((((nodes) ?? [])[index]) ?? null), child);
|
|
441
|
+
((index = (index + 1)));
|
|
442
|
+
}
|
|
443
|
+
while (__eliscript_numeric_relation("<", index, ((nodes) ?? []).length)) {
|
|
444
|
+
tdz_walk(((((nodes) ?? [])[index]) ?? null), child, state);
|
|
445
|
+
((index = (index + 1)));
|
|
446
|
+
}
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
} else {
|
|
451
|
+
if (((kind === "lexical-bindings") || (kind === "binding-loop"))) {
|
|
452
|
+
{
|
|
453
|
+
const __eliscript_value_25 = tdz_scope(scope);
|
|
454
|
+
const __eliscript_value_26 = ir_property(node, "bindingCount");
|
|
455
|
+
const __eliscript_value_27 = ir_property(node, "sequential");
|
|
456
|
+
const __eliscript_value_28 = 0;
|
|
457
|
+
{
|
|
458
|
+
let child = __eliscript_value_25;
|
|
459
|
+
let count = __eliscript_value_26;
|
|
460
|
+
let sequential = __eliscript_value_27;
|
|
461
|
+
let index = __eliscript_value_28;
|
|
462
|
+
while (__eliscript_numeric_relation("<", index, count)) {
|
|
463
|
+
{
|
|
464
|
+
let binding = ((((nodes) ?? [])[index]) ?? null);
|
|
465
|
+
let values = children(binding);
|
|
466
|
+
let outer = (__eliscript_truthy(sequential) ? child : scope);
|
|
467
|
+
let start = (__eliscript_truthy(ir_property(binding, "pattern")) ? 1 : 0);
|
|
468
|
+
while (__eliscript_numeric_relation("<", start, ((values) ?? []).length)) {
|
|
469
|
+
tdz_walk(((((values) ?? [])[start]) ?? null), outer, state);
|
|
470
|
+
((start = (start + 1)));
|
|
471
|
+
}
|
|
472
|
+
tdz_defaults(binding, outer, state);
|
|
473
|
+
if (__eliscript_truthy(sequential)) {
|
|
474
|
+
tdz_bind(binding, child);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
((index = (index + 1)));
|
|
478
|
+
}
|
|
479
|
+
if ((!__eliscript_truthy(sequential))) {
|
|
480
|
+
((index = 0));
|
|
481
|
+
while (__eliscript_numeric_relation("<", index, count)) {
|
|
482
|
+
tdz_bind(((((nodes) ?? [])[index]) ?? null), child);
|
|
483
|
+
((index = (index + 1)));
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
while (__eliscript_numeric_relation("<", index, ((nodes) ?? []).length)) {
|
|
487
|
+
tdz_walk(((((nodes) ?? [])[index]) ?? null), child, state);
|
|
488
|
+
((index = (index + 1)));
|
|
489
|
+
}
|
|
490
|
+
return null;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
} else {
|
|
494
|
+
if ((kind === "catch-clause")) {
|
|
495
|
+
{
|
|
496
|
+
const __eliscript_value_29 = tdz_scope(scope);
|
|
497
|
+
const __eliscript_value_30 = ((((nodes) ?? [])[0]) ?? null);
|
|
498
|
+
const __eliscript_value_31 = 1;
|
|
499
|
+
{
|
|
500
|
+
let child = __eliscript_value_29;
|
|
501
|
+
let binding = __eliscript_value_30;
|
|
502
|
+
let index = __eliscript_value_31;
|
|
503
|
+
tdz_defaults(binding, scope, state);
|
|
504
|
+
tdz_bind(binding, child);
|
|
505
|
+
while (__eliscript_numeric_relation("<", index, ((nodes) ?? []).length)) {
|
|
506
|
+
tdz_walk(((((nodes) ?? [])[index]) ?? null), child, state);
|
|
507
|
+
((index = (index + 1)));
|
|
508
|
+
}
|
|
509
|
+
return null;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
} else {
|
|
513
|
+
if (((kind === "quoted-literal") || (kind === "raw-javascript") || (kind === "import-declaration"))) {
|
|
514
|
+
return null;
|
|
515
|
+
} else {
|
|
516
|
+
return (nodes)["forEach"](((child) => {
|
|
517
|
+
return tdz_walk(child, scope, state);
|
|
518
|
+
}));
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
function tdz_prepare(program) {
|
|
528
|
+
{
|
|
529
|
+
const __eliscript_value_32 = ({"variables": [], "declarations": new (globalThis.Map)(), "reads": new (globalThis.Map)(), "writes": new (globalThis.Map)()});
|
|
530
|
+
const __eliscript_value_33 = tdz_scope(null);
|
|
531
|
+
{
|
|
532
|
+
let state = __eliscript_value_32;
|
|
533
|
+
let scope = __eliscript_value_33;
|
|
534
|
+
tdz_predeclare(program_body(program), scope, state);
|
|
535
|
+
if (__eliscript_numeric_relation(">", (((state)["variables"]) ?? []).length, 0)) {
|
|
536
|
+
(program_body(program))["forEach"](((node) => {
|
|
537
|
+
return tdz_walk(node, scope, state);
|
|
538
|
+
}));
|
|
539
|
+
}
|
|
540
|
+
return state;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
function tdz_reader_name(record) {
|
|
545
|
+
return (String("__eliscript_tdz_read_") + String((record)["index"]));
|
|
546
|
+
}
|
|
547
|
+
function tdz_writer_name(record) {
|
|
548
|
+
return (String("__eliscript_tdz_write_") + String((record)["index"]));
|
|
549
|
+
}
|
|
550
|
+
function tdz_prologue() {
|
|
551
|
+
if ((((__eliscript_tdz_read_23()) === null) || (((((__eliscript_tdz_read_23()))["variables"]) ?? []).length === 0))) {
|
|
552
|
+
return "";
|
|
553
|
+
} else {
|
|
554
|
+
return (String((__eliscript_tdz_read_22())) + String(__eliscript_at_direct((((__eliscript_tdz_read_23()))["variables"])["map"](((record) => {
|
|
555
|
+
{
|
|
556
|
+
const __eliscript_value_34 = tdz_ready_name(record);
|
|
557
|
+
const __eliscript_value_35 = binding_name((record)["name"]);
|
|
558
|
+
const __eliscript_value_36 = (String("__eliscript_tdz_value_") + String((record)["index"]));
|
|
559
|
+
{
|
|
560
|
+
let ready = __eliscript_value_34;
|
|
561
|
+
let name = __eliscript_value_35;
|
|
562
|
+
let argument = __eliscript_value_36;
|
|
563
|
+
return (String("var ") + String(ready) + String(";\n") + String("function ") + String(tdz_reader_name(record)) + String("() { if (") + String(ready) + String(" !== true) __eliscript_tdz_error(") + String(json_string(name)) + String("); return ") + String(name) + String("; }\n") + String("function ") + String(tdz_writer_name(record)) + String("(") + String(argument) + String(") { if (") + String(ready) + String(" !== true) __eliscript_tdz_error(") + String(json_string(name)) + String("); ") + String((__eliscript_truthy((record)["mutable"]) ? (String("return (") + String(name) + String(" = ") + String(argument) + String(");")) : "return __eliscript_const_error();")) + String(" }\n"));
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
})), "join", "")));
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
function tdz_read(node) {
|
|
570
|
+
{
|
|
571
|
+
const __eliscript_value_37 = ((__eliscript_value_38) => (__eliscript_truthy(__eliscript_value_38) ? (((__eliscript_tdz_read_23()))["reads"])["get"](node) : __eliscript_value_38))((__eliscript_tdz_read_23()));
|
|
572
|
+
{
|
|
573
|
+
let record = __eliscript_value_37;
|
|
574
|
+
if ((!__eliscript_truthy(record))) {
|
|
575
|
+
return text_fragment(reference_name(ir_value(node)));
|
|
576
|
+
} else {
|
|
577
|
+
{
|
|
578
|
+
let name = binding_name((record)["name"]);
|
|
579
|
+
let reference = reference_name(ir_value(node));
|
|
580
|
+
return text_fragment((String("(") + String(tdz_reader_name(record)) + String("())") + String((reference)["slice"](((name) ?? []).length))));
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
function tdz_assignment(pair) {
|
|
587
|
+
{
|
|
588
|
+
let record = ((__eliscript_value_39) => (__eliscript_truthy(__eliscript_value_39) ? (((__eliscript_tdz_read_23()))["writes"])["get"](pair) : __eliscript_value_39))((__eliscript_tdz_read_23()));
|
|
589
|
+
let value = emit_expression(((((children(pair)) ?? [])[0]) ?? null));
|
|
590
|
+
if ((!__eliscript_truthy(record))) {
|
|
591
|
+
return combine(["(", emit_binding_name(pair), " = ", value, ")"]);
|
|
592
|
+
} else {
|
|
593
|
+
return combine([tdz_writer_name(record), "(", value, ")"]);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
function make_fragment(text, marks, functions = null) {
|
|
598
|
+
{
|
|
599
|
+
const __eliscript_value_40 = ({"text": text, "marks": marks});
|
|
600
|
+
{
|
|
601
|
+
let fragment = __eliscript_value_40;
|
|
602
|
+
if (__eliscript_truthy((__eliscript_tdz_read_18()))) {
|
|
603
|
+
((fragment)["functions"] = ((__eliscript_value_41) => (__eliscript_truthy(__eliscript_value_41) ? __eliscript_value_41 : []))(functions));
|
|
604
|
+
}
|
|
605
|
+
return fragment;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
function function_source_fragment(node, output, start, end) {
|
|
610
|
+
{
|
|
611
|
+
const __eliscript_value_42 = as_fragment(output);
|
|
612
|
+
{
|
|
613
|
+
let fragment = __eliscript_value_42;
|
|
614
|
+
if (__eliscript_truthy((__eliscript_tdz_read_18()))) {
|
|
615
|
+
{
|
|
616
|
+
const __eliscript_value_43 = (((fragment)["functions"] ?? []))["slice"]();
|
|
617
|
+
{
|
|
618
|
+
let functions = __eliscript_value_43;
|
|
619
|
+
(functions)["push"](({"node": node, "start": start, "end": end}));
|
|
620
|
+
((fragment)["functions"] = functions);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
return fragment;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
function function_indented_offset(starts, offset) {
|
|
629
|
+
{
|
|
630
|
+
const __eliscript_value_44 = 0;
|
|
631
|
+
const __eliscript_value_45 = ((starts) ?? []).length;
|
|
632
|
+
{
|
|
633
|
+
let low = __eliscript_value_44;
|
|
634
|
+
let high = __eliscript_value_45;
|
|
635
|
+
while (__eliscript_numeric_relation("<", low, high)) {
|
|
636
|
+
{
|
|
637
|
+
const __eliscript_value_46 = (low + Math.floor(__eliscript_numeric_div(__eliscript_numeric_sub(high, low), 2)));
|
|
638
|
+
{
|
|
639
|
+
let middle = __eliscript_value_46;
|
|
640
|
+
if (__eliscript_numeric_relation("<=", ((((starts) ?? [])[middle]) ?? null), offset)) {
|
|
641
|
+
((low = (middle + 1)));
|
|
642
|
+
} else {
|
|
643
|
+
((high = middle));
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
return (offset + __eliscript_numeric_mul(low, 2));
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
function indent_function_sources(source, functions) {
|
|
653
|
+
{
|
|
654
|
+
const __eliscript_value_47 = [];
|
|
655
|
+
const __eliscript_value_48 = (source)["split"]("\n");
|
|
656
|
+
const __eliscript_value_49 = 0;
|
|
657
|
+
const __eliscript_value_50 = 0;
|
|
658
|
+
{
|
|
659
|
+
let starts = __eliscript_value_47;
|
|
660
|
+
let parts = __eliscript_value_48;
|
|
661
|
+
let offset = __eliscript_value_49;
|
|
662
|
+
let index = __eliscript_value_50;
|
|
663
|
+
while (__eliscript_numeric_relation("<", index, ((parts) ?? []).length)) {
|
|
664
|
+
{
|
|
665
|
+
const __eliscript_value_51 = ((((parts) ?? [])[index]) ?? null);
|
|
666
|
+
{
|
|
667
|
+
let line = __eliscript_value_51;
|
|
668
|
+
if (__eliscript_numeric_relation(">", ((line) ?? []).length, 0)) {
|
|
669
|
+
(starts)["push"](offset);
|
|
670
|
+
}
|
|
671
|
+
((offset = (offset + ((line) ?? []).length + 1)));
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
((index = (index + 1)));
|
|
675
|
+
}
|
|
676
|
+
return (functions)["map"](((record) => {
|
|
677
|
+
return ({"node": (record)["node"], "start": function_indented_offset(starts, (record)["start"]), "end": function_indented_offset(starts, (record)["end"])});
|
|
678
|
+
}));
|
|
679
|
+
}
|
|
680
|
+
}
|
|
19
681
|
}
|
|
20
682
|
function text_fragment(text) {
|
|
21
683
|
return make_fragment(text, []);
|
|
22
684
|
}
|
|
23
685
|
function as_fragment(part) {
|
|
24
|
-
|
|
686
|
+
if ((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(part) === "string")) {
|
|
687
|
+
return text_fragment(part);
|
|
688
|
+
} else {
|
|
689
|
+
return part;
|
|
690
|
+
}
|
|
25
691
|
}
|
|
26
692
|
function combine(parts) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
693
|
+
{
|
|
694
|
+
const __eliscript_value_52 = "";
|
|
695
|
+
const __eliscript_value_53 = [];
|
|
696
|
+
const __eliscript_value_54 = [];
|
|
697
|
+
const __eliscript_value_55 = 0;
|
|
698
|
+
const __eliscript_value_56 = null;
|
|
699
|
+
const __eliscript_value_57 = 0;
|
|
700
|
+
const __eliscript_value_58 = null;
|
|
701
|
+
const __eliscript_value_59 = 0;
|
|
702
|
+
const __eliscript_value_60 = null;
|
|
703
|
+
{
|
|
704
|
+
let text = __eliscript_value_52;
|
|
705
|
+
let marks = __eliscript_value_53;
|
|
706
|
+
let functions = __eliscript_value_54;
|
|
707
|
+
let part_index = __eliscript_value_55;
|
|
708
|
+
let fragment = __eliscript_value_56;
|
|
709
|
+
let offset = __eliscript_value_57;
|
|
710
|
+
let fragment_marks = __eliscript_value_58;
|
|
711
|
+
let mark_index = __eliscript_value_59;
|
|
712
|
+
let mark = __eliscript_value_60;
|
|
713
|
+
while (__eliscript_numeric_relation("<", part_index, (parts)["length"])) {
|
|
30
714
|
((fragment = as_fragment(((((parts) ?? [])[part_index]) ?? null))));
|
|
31
715
|
((offset = (text)["length"]));
|
|
32
716
|
((fragment_marks = (fragment)["marks"]));
|
|
33
717
|
((mark_index = 0));
|
|
34
|
-
(()
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
return null;
|
|
41
|
-
})();
|
|
718
|
+
while (__eliscript_numeric_relation("<", mark_index, (fragment_marks)["length"])) {
|
|
719
|
+
((mark = ((((fragment_marks) ?? [])[mark_index]) ?? null)));
|
|
720
|
+
(marks)["push"](({"offset": (offset + (mark)["offset"]), "span": (mark)["span"]}));
|
|
721
|
+
((mark_index = (mark_index + 1)));
|
|
722
|
+
}
|
|
42
723
|
((text = (String(text) + String((fragment)["text"]))));
|
|
724
|
+
if (__eliscript_truthy((__eliscript_tdz_read_18()))) {
|
|
725
|
+
(((fragment)["functions"] ?? []))["forEach"](((record) => {
|
|
726
|
+
return (functions)["push"](({"node": (record)["node"], "start": (offset + (record)["start"]), "end": (offset + (record)["end"])}));
|
|
727
|
+
}));
|
|
728
|
+
}
|
|
43
729
|
((part_index = (part_index + 1)));
|
|
44
730
|
}
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
})("", [], 0, null, 0, null, 0, null);
|
|
731
|
+
return make_fragment(text, marks, functions);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
49
734
|
}
|
|
50
735
|
function join_fragments(parts, separator) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
736
|
+
{
|
|
737
|
+
const __eliscript_value_61 = [];
|
|
738
|
+
const __eliscript_value_62 = 0;
|
|
739
|
+
{
|
|
740
|
+
let joined = __eliscript_value_61;
|
|
741
|
+
let index = __eliscript_value_62;
|
|
742
|
+
while (__eliscript_numeric_relation("<", index, (parts)["length"])) {
|
|
743
|
+
if (__eliscript_numeric_relation(">", index, 0)) {
|
|
744
|
+
(joined)["push"](separator);
|
|
745
|
+
}
|
|
55
746
|
(joined)["push"](((((parts) ?? [])[index]) ?? null));
|
|
56
747
|
((index = (index + 1)));
|
|
57
748
|
}
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
})([], 0);
|
|
749
|
+
return combine(joined);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
62
752
|
}
|
|
63
753
|
function reference_indent(fragment) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
754
|
+
{
|
|
755
|
+
let input = as_fragment(fragment);
|
|
756
|
+
let source = (input)["text"];
|
|
757
|
+
let source_marks = (input)["marks"];
|
|
758
|
+
let text = "";
|
|
759
|
+
let marks = [];
|
|
760
|
+
let index = 0;
|
|
761
|
+
let mark_index = 0;
|
|
762
|
+
let line_start = true;
|
|
763
|
+
while (__eliscript_numeric_relation("<", index, (source)["length"])) {
|
|
764
|
+
{
|
|
765
|
+
const __eliscript_value_63 = (source)["charCodeAt"](index);
|
|
766
|
+
{
|
|
767
|
+
let code = __eliscript_value_63;
|
|
768
|
+
if (__eliscript_truthy(((__eliscript_value_64) => (__eliscript_truthy(__eliscript_value_64) ? (!(code === 10)) : __eliscript_value_64))(line_start))) {
|
|
769
|
+
((text = (String(text) + String(" "))));
|
|
770
|
+
}
|
|
771
|
+
while ((__eliscript_numeric_relation("<", mark_index, (source_marks)["length"]) && ((((((source_marks) ?? [])[mark_index]) ?? null))["offset"] === index))) {
|
|
772
|
+
(marks)["push"](({"offset": (text)["length"], "span": (((((source_marks) ?? [])[mark_index]) ?? null))["span"]}));
|
|
773
|
+
((mark_index = (mark_index + 1)));
|
|
774
|
+
}
|
|
775
|
+
((text = (String(text) + String((source)["charAt"](index)))));
|
|
776
|
+
((line_start = (code === 10)));
|
|
777
|
+
((index = (index + 1)));
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
return make_fragment(text, marks, (__eliscript_truthy((__eliscript_tdz_read_18())) ? indent_function_sources(source, ((input)["functions"] ?? [])) : null));
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
const native_indent = ((input) => {
|
|
785
|
+
{
|
|
786
|
+
let source = (input)["text"];
|
|
787
|
+
let source_marks = (input)["marks"];
|
|
788
|
+
let parts = (source)["split"]("\n");
|
|
789
|
+
let marks = [];
|
|
790
|
+
let start = 0;
|
|
791
|
+
let added = 0;
|
|
792
|
+
let mark_index = 0;
|
|
793
|
+
let mark = (source_marks)[0];
|
|
794
|
+
let index = 0;
|
|
795
|
+
while (__eliscript_numeric_relation("<", index, (parts)["length"])) {
|
|
796
|
+
{
|
|
797
|
+
let line = (parts)[index];
|
|
798
|
+
let end = ((start + (line)["length"]) + (__eliscript_numeric_relation("<", (index + 1), (parts)["length"]) ? 1 : 0));
|
|
799
|
+
if (__eliscript_numeric_relation(">", (line)["length"], 0)) {
|
|
800
|
+
((parts)[index] = (" " + line));
|
|
801
|
+
((added = (added + 2)));
|
|
802
|
+
}
|
|
803
|
+
while (((!(mark === undefined)) && __eliscript_numeric_relation(">=", (mark)["offset"], start) && __eliscript_numeric_relation("<", (mark)["offset"], end))) {
|
|
804
|
+
(marks)["push"](({"offset": ((mark)["offset"] + added), "span": (mark)["span"]}));
|
|
805
|
+
((mark_index = (mark_index + 1)));
|
|
806
|
+
((mark = (source_marks)[mark_index]));
|
|
807
|
+
}
|
|
808
|
+
((start = end));
|
|
809
|
+
}
|
|
810
|
+
((index = (index + 1)));
|
|
811
|
+
}
|
|
812
|
+
return ({"text": __eliscript_at_direct(parts, "join", "\n"), "marks": marks});
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
__eliscript_tdz_ready_24 = true;
|
|
102
816
|
function indent(fragment) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return ((mark_index) => {
|
|
112
|
-
return ((mark_count) => {
|
|
113
|
-
return (() => {
|
|
114
|
-
(() => {
|
|
115
|
-
while (__eliscript_truthy((source_index < source_length))) {
|
|
116
|
-
((newline_index) => {
|
|
117
|
-
return ((segment_end) => {
|
|
118
|
-
return ((indented) => {
|
|
119
|
-
return (() => {
|
|
120
|
-
(__eliscript_truthy(indented) ? (() => {
|
|
121
|
-
(text_parts)["push"](" ");
|
|
122
|
-
return ((output_length = (output_length + 2)));
|
|
123
|
-
})() : null);
|
|
124
|
-
(() => {
|
|
125
|
-
while (__eliscript_truthy(((__eliscript_value_3) => (__eliscript_truthy(__eliscript_value_3) ? ((__eliscript_value_4) => (__eliscript_truthy(__eliscript_value_4) ? ((((((source_marks) ?? [])[mark_index]) ?? null))["offset"] < segment_end) : __eliscript_value_4))(((((((source_marks) ?? [])[mark_index]) ?? null))["offset"] >= source_index)) : __eliscript_value_3))((mark_index < mark_count)))) {
|
|
126
|
-
((mark) => {
|
|
127
|
-
return (marks)["push"](({"offset": (output_length + ((mark)["offset"] - source_index)), "span": (mark)["span"]}));
|
|
128
|
-
})(((((source_marks) ?? [])[mark_index]) ?? null));
|
|
129
|
-
((mark_index = (mark_index + 1)));
|
|
130
|
-
}
|
|
131
|
-
return null;
|
|
132
|
-
})();
|
|
133
|
-
(text_parts)["push"]((source)["slice"](source_index, segment_end));
|
|
134
|
-
((output_length = (output_length + (segment_end - source_index))));
|
|
135
|
-
return ((source_index = segment_end));
|
|
136
|
-
})();
|
|
137
|
-
})((!__eliscript_truthy(((source)["charCodeAt"](source_index) === 10))));
|
|
138
|
-
})((__eliscript_truthy((newline_index === -1)) ? source_length : (newline_index + 1)));
|
|
139
|
-
})((source)["indexOf"]("\n", source_index));
|
|
140
|
-
}
|
|
141
|
-
return null;
|
|
142
|
-
})();
|
|
143
|
-
return make_fragment((text_parts)["join"](""), marks);
|
|
144
|
-
})();
|
|
145
|
-
})((source_marks)["length"]);
|
|
146
|
-
})(0);
|
|
147
|
-
})(0);
|
|
148
|
-
})(0);
|
|
149
|
-
})((source)["length"]);
|
|
150
|
-
})([]);
|
|
151
|
-
})([]);
|
|
152
|
-
})((input)["marks"]);
|
|
153
|
-
})((input)["text"]);
|
|
154
|
-
})(as_fragment(fragment));
|
|
817
|
+
{
|
|
818
|
+
let input = as_fragment(fragment);
|
|
819
|
+
let output = (__eliscript_tdz_read_24())(input);
|
|
820
|
+
if (__eliscript_truthy((__eliscript_tdz_read_18()))) {
|
|
821
|
+
((output)["functions"] = indent_function_sources((input)["text"], ((input)["functions"] ?? [])));
|
|
822
|
+
}
|
|
823
|
+
return output;
|
|
824
|
+
}
|
|
155
825
|
}
|
|
156
826
|
function reference_locate(node, output) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
827
|
+
{
|
|
828
|
+
let fragment = as_fragment(output);
|
|
829
|
+
let marks = (fragment)["marks"];
|
|
830
|
+
let has_start = (marks)["some"](((mark) => {
|
|
831
|
+
return ((mark)["offset"] === 0);
|
|
832
|
+
}));
|
|
833
|
+
if (__eliscript_truthy(((__eliscript_value_65) => (__eliscript_truthy(__eliscript_value_65) ? __eliscript_value_65 : ((__eliscript_value_66) => (__eliscript_truthy(__eliscript_value_66) ? __eliscript_value_66 : has_start))((!__eliscript_truthy(ir_span(node))))))((((fragment)["text"])["length"] === 0)))) {
|
|
834
|
+
return fragment;
|
|
835
|
+
} else {
|
|
836
|
+
{
|
|
837
|
+
const __eliscript_value_67 = [({"offset": 0, "span": ir_span(node)})];
|
|
838
|
+
{
|
|
839
|
+
let located = __eliscript_value_67;
|
|
840
|
+
(marks)["forEach"](((mark) => {
|
|
162
841
|
return (located)["push"](mark);
|
|
163
|
-
});
|
|
164
|
-
return make_fragment((fragment)["text"], located);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
})((fragment)["marks"]);
|
|
170
|
-
})(as_fragment(output));
|
|
842
|
+
}));
|
|
843
|
+
return make_fragment((fragment)["text"], located, ((fragment)["functions"] ?? []));
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
171
848
|
}
|
|
172
849
|
function locate(node, output) {
|
|
173
|
-
return
|
|
850
|
+
return (__eliscript_tdz_read_19())(ir_span(node), output);
|
|
174
851
|
}
|
|
175
852
|
function fresh_name() {
|
|
176
|
-
((
|
|
177
|
-
return (String("__eliscript_value_") + String(
|
|
853
|
+
(__eliscript_tdz_write_20(((__eliscript_tdz_read_20()) + 1)));
|
|
854
|
+
return (String("__eliscript_value_") + String((__eliscript_tdz_read_20())));
|
|
178
855
|
}
|
|
179
856
|
function json_string(value) {
|
|
180
857
|
return JSON.stringify(value);
|
|
181
858
|
}
|
|
182
859
|
function children(node) {
|
|
183
|
-
return ((
|
|
860
|
+
return ((__eliscript_value_68) => (__eliscript_truthy(__eliscript_value_68) ? __eliscript_value_68 : []))(ir_children(node));
|
|
184
861
|
}
|
|
185
862
|
function require_arity(name, nodes, minimum, maximum) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
863
|
+
{
|
|
864
|
+
const __eliscript_value_69 = (nodes)["length"];
|
|
865
|
+
{
|
|
866
|
+
let count = __eliscript_value_69;
|
|
867
|
+
if (__eliscript_truthy(((__eliscript_value_70) => (__eliscript_truthy(__eliscript_value_70) ? __eliscript_value_70 : ((__eliscript_value_71) => (__eliscript_truthy(__eliscript_value_71) ? __eliscript_numeric_relation(">", count, maximum) : __eliscript_value_71))(maximum)))(__eliscript_numeric_relation("<", count, minimum)))) {
|
|
868
|
+
{
|
|
869
|
+
const __eliscript_value_72 = (__eliscript_truthy(((__eliscript_value_74) => (__eliscript_truthy(__eliscript_value_74) ? (minimum === maximum) : __eliscript_value_74))(maximum)) ? (String(minimum)) : (String(minimum) + String((__eliscript_truthy(maximum) ? (String("..") + String(maximum)) : "+"))));
|
|
870
|
+
const __eliscript_value_73 = (__eliscript_truthy(((__eliscript_value_75) => (__eliscript_truthy(__eliscript_value_75) ? ((minimum === maximum) && (minimum === 1)) : __eliscript_value_75))(maximum)) ? "" : "s");
|
|
871
|
+
{
|
|
872
|
+
let expected = __eliscript_value_72;
|
|
873
|
+
let plural = __eliscript_value_73;
|
|
874
|
+
return (__eliscript_tdz_read_16())((String(name) + String(" expects ") + String(expected) + String(" argument") + String(plural) + String(", got ") + String(count)));
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
} else {
|
|
878
|
+
return null;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
191
882
|
}
|
|
192
883
|
function require_node_arity(node, minimum, maximum) {
|
|
193
|
-
return
|
|
884
|
+
return (() => {
|
|
885
|
+
try {
|
|
886
|
+
return require_arity(((__eliscript_value_76) => (__eliscript_truthy(__eliscript_value_76) ? __eliscript_value_76 : ir_kind(node)))(ir_value(node)), children(node), minimum, maximum);
|
|
887
|
+
} catch (error) {
|
|
888
|
+
return (() => {
|
|
889
|
+
try {
|
|
890
|
+
if ((!__eliscript_truthy(Object.hasOwn(error, "eliscriptIRSpan")))) {
|
|
891
|
+
return ((error)["eliscriptIRSpan"] = ir_span(node));
|
|
892
|
+
} else {
|
|
893
|
+
return null;
|
|
894
|
+
}
|
|
895
|
+
} finally {
|
|
896
|
+
((__eliscript_value_77) => { throw __eliscript_value_77; })(error);
|
|
897
|
+
}
|
|
898
|
+
})();
|
|
899
|
+
}
|
|
900
|
+
})();
|
|
194
901
|
}
|
|
195
902
|
function emit_binding_name(node) {
|
|
196
|
-
return
|
|
903
|
+
return (__eliscript_tdz_read_19())(ir_span(node), binding_name(ir_value(node)));
|
|
197
904
|
}
|
|
198
905
|
function emit_array_binding_pattern(node) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
})(false);
|
|
214
|
-
})(0);
|
|
215
|
-
})([]);
|
|
216
|
-
})(((nodes)["length"] - 1));
|
|
217
|
-
})(ir_property(node, "rest"));
|
|
218
|
-
})(children(node));
|
|
906
|
+
{
|
|
907
|
+
let nodes = children(node);
|
|
908
|
+
let rest = ir_property(node, "rest");
|
|
909
|
+
let last_index = __eliscript_numeric_decrement((nodes)["length"]);
|
|
910
|
+
let parts = [];
|
|
911
|
+
let index = 0;
|
|
912
|
+
let last_hole = false;
|
|
913
|
+
(nodes)["forEach"](((child) => {
|
|
914
|
+
((last_hole = (ir_kind(child) === "binding-hole")));
|
|
915
|
+
(parts)["push"]((__eliscript_truthy(((__eliscript_value_78) => (__eliscript_truthy(__eliscript_value_78) ? (index === last_index) : __eliscript_value_78))(rest)) ? combine(["...", emit_binding_pattern_node(child)]) : (__eliscript_truthy(last_hole) ? "" : emit_binding_pattern_node(child))));
|
|
916
|
+
return ((index = (index + 1)));
|
|
917
|
+
}));
|
|
918
|
+
return (__eliscript_tdz_read_19())(ir_span(node), combine(["[", join_fragments(parts, ", "), (__eliscript_truthy(((__eliscript_value_79) => (__eliscript_truthy(__eliscript_value_79) ? (!__eliscript_truthy(rest)) : __eliscript_value_79))(last_hole)) ? "," : ""), "]"]));
|
|
919
|
+
}
|
|
219
920
|
}
|
|
220
921
|
function map_binding_pattern_p(node) {
|
|
221
|
-
return ((
|
|
922
|
+
return ((__eliscript_value_80) => (__eliscript_truthy(__eliscript_value_80) ? (ir_kind(((((children(node)) ?? [])[0]) ?? null)) === "map-binding-pattern") : __eliscript_value_80))(ir_property(node, "pattern"));
|
|
222
923
|
}
|
|
223
924
|
function binding_temporary(node) {
|
|
224
|
-
|
|
225
|
-
(
|
|
226
|
-
|
|
227
|
-
|
|
925
|
+
if (__eliscript_truthy(((__eliscript_tdz_read_21()))["has"](node))) {
|
|
926
|
+
return ((__eliscript_tdz_read_21()))["get"](node);
|
|
927
|
+
} else {
|
|
928
|
+
{
|
|
929
|
+
const __eliscript_value_81 = fresh_name();
|
|
930
|
+
{
|
|
931
|
+
let name = __eliscript_value_81;
|
|
932
|
+
((__eliscript_tdz_read_21()))["set"](node, name);
|
|
933
|
+
return name;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
}
|
|
228
937
|
}
|
|
229
938
|
function emit_map_binding_pattern(node, source) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
})(children(entry));
|
|
254
|
-
});
|
|
255
|
-
return join_fragments(parts, "\n");
|
|
256
|
-
})();
|
|
257
|
-
})([]);
|
|
258
|
-
})(((__eliscript_value_17) => (__eliscript_truthy(__eliscript_value_17) ? ((((nodes) ?? [])[entry_count]) ?? null) : __eliscript_value_17))(ir_property(node, "as")));
|
|
259
|
-
})((nodes)["slice"](0, entry_count));
|
|
260
|
-
})(ir_property(node, "entryCount"));
|
|
261
|
-
})(children(node));
|
|
939
|
+
{
|
|
940
|
+
let nodes = children(node);
|
|
941
|
+
let entry_count = ir_property(node, "entryCount");
|
|
942
|
+
let entries = (nodes)["slice"](0, entry_count);
|
|
943
|
+
let as = ((__eliscript_value_82) => (__eliscript_truthy(__eliscript_value_82) ? ((((nodes) ?? [])[entry_count]) ?? null) : __eliscript_value_82))(ir_property(node, "as"));
|
|
944
|
+
let parts = [];
|
|
945
|
+
if (__eliscript_truthy(as)) {
|
|
946
|
+
(parts)["push"](combine(["let ", emit_binding_name(as), " = ", source, ";"]));
|
|
947
|
+
}
|
|
948
|
+
(entries)["forEach"](((entry) => {
|
|
949
|
+
{
|
|
950
|
+
let entry_nodes = children(entry);
|
|
951
|
+
let target = ((((entry_nodes) ?? [])[0]) ?? null);
|
|
952
|
+
let key = ((((entry_nodes) ?? [])[1]) ?? null);
|
|
953
|
+
let default$ = ((__eliscript_value_83) => (__eliscript_truthy(__eliscript_value_83) ? ((((entry_nodes) ?? [])[2]) ?? null) : __eliscript_value_83))(ir_property(entry, "default"));
|
|
954
|
+
let temporary = fresh_name();
|
|
955
|
+
let resolved = combine(["(", temporary, " === __eliscript_binding_missing ? ", (__eliscript_truthy(default$) ? emit_expression(default$) : "null"), " : ", temporary, ")"]);
|
|
956
|
+
(parts)["push"](combine(["const ", temporary, " = __eliscript_binding_get(", source, ", ", emit_expression(key), ", __eliscript_binding_missing);"]));
|
|
957
|
+
return (parts)["push"](emit_pattern_setup(target, resolved));
|
|
958
|
+
}
|
|
959
|
+
}));
|
|
960
|
+
return join_fragments(parts, "\n");
|
|
961
|
+
}
|
|
262
962
|
}
|
|
263
963
|
function emit_pattern_setup(pattern, source) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
964
|
+
{
|
|
965
|
+
const __eliscript_value_84 = ir_kind(pattern);
|
|
966
|
+
{
|
|
967
|
+
let kind = __eliscript_value_84;
|
|
968
|
+
if ((kind === "binding-name")) {
|
|
969
|
+
return combine(["let ", emit_binding_name(pattern), " = ", source, ";"]);
|
|
970
|
+
} else {
|
|
971
|
+
if ((kind === "array-binding-pattern")) {
|
|
972
|
+
return combine(["let ", emit_array_binding_pattern(pattern), " = ", source, ";"]);
|
|
973
|
+
} else {
|
|
974
|
+
if ((kind === "map-binding-pattern")) {
|
|
975
|
+
return emit_map_binding_pattern(pattern, source);
|
|
976
|
+
} else {
|
|
977
|
+
return (__eliscript_tdz_read_16())((String("invalid IR binding setup node: ") + String(kind)));
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
}
|
|
267
983
|
}
|
|
268
984
|
function emit_binding_setup(binding) {
|
|
269
|
-
|
|
985
|
+
if (__eliscript_truthy(map_binding_pattern_p(binding))) {
|
|
986
|
+
return emit_map_binding_pattern(((((children(binding)) ?? [])[0]) ?? null), binding_temporary(binding));
|
|
987
|
+
} else {
|
|
988
|
+
return text_fragment("");
|
|
989
|
+
}
|
|
270
990
|
}
|
|
271
991
|
function emit_binding_setups(bindings) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
992
|
+
{
|
|
993
|
+
const __eliscript_value_85 = [];
|
|
994
|
+
{
|
|
995
|
+
let parts = __eliscript_value_85;
|
|
996
|
+
(bindings)["forEach"](((binding) => {
|
|
997
|
+
if (__eliscript_truthy(map_binding_pattern_p(binding))) {
|
|
998
|
+
return (parts)["push"](emit_binding_setup(binding));
|
|
999
|
+
} else {
|
|
1000
|
+
return null;
|
|
1001
|
+
}
|
|
1002
|
+
}));
|
|
1003
|
+
return join_fragments(parts, "\n");
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
278
1006
|
}
|
|
279
1007
|
function binding_default_value(binding) {
|
|
280
|
-
|
|
1008
|
+
if (__eliscript_truthy(((__eliscript_value_86) => (__eliscript_truthy(__eliscript_value_86) ? (!__eliscript_truthy(map_binding_pattern_p(binding))) : __eliscript_value_86))(ir_property(binding, "pattern")))) {
|
|
1009
|
+
return "[]";
|
|
1010
|
+
} else {
|
|
1011
|
+
return "null";
|
|
1012
|
+
}
|
|
281
1013
|
}
|
|
282
1014
|
function emit_binding_pattern_node(node) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
1015
|
+
{
|
|
1016
|
+
const __eliscript_value_87 = ir_kind(node);
|
|
1017
|
+
{
|
|
1018
|
+
let kind = __eliscript_value_87;
|
|
1019
|
+
if ((kind === "binding-name")) {
|
|
1020
|
+
return emit_binding_name(node);
|
|
1021
|
+
} else {
|
|
1022
|
+
if ((kind === "binding-hole")) {
|
|
1023
|
+
return "";
|
|
1024
|
+
} else {
|
|
1025
|
+
if ((kind === "array-binding-pattern")) {
|
|
1026
|
+
return emit_array_binding_pattern(node);
|
|
1027
|
+
} else {
|
|
1028
|
+
if ((kind === "map-binding-pattern")) {
|
|
1029
|
+
return (__eliscript_tdz_read_16())("map binding patterns require a generated source binding");
|
|
1030
|
+
} else {
|
|
1031
|
+
return (__eliscript_tdz_read_16())((String("invalid IR binding pattern node: ") + String(kind)));
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
286
1038
|
}
|
|
287
1039
|
function emit_binding_target(node) {
|
|
288
|
-
|
|
1040
|
+
if (__eliscript_truthy(map_binding_pattern_p(node))) {
|
|
1041
|
+
return binding_temporary(node);
|
|
1042
|
+
} else {
|
|
1043
|
+
if (__eliscript_truthy(ir_property(node, "pattern"))) {
|
|
1044
|
+
return emit_binding_pattern_node(((((children(node)) ?? [])[0]) ?? null));
|
|
1045
|
+
} else {
|
|
1046
|
+
return emit_binding_name(node);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
289
1049
|
}
|
|
290
1050
|
function binding_initializer(node) {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
1051
|
+
{
|
|
1052
|
+
const __eliscript_value_88 = children(node);
|
|
1053
|
+
{
|
|
1054
|
+
let nodes = __eliscript_value_88;
|
|
1055
|
+
return (((((__eliscript_truthy(ir_property(node, "pattern")) ? (nodes)["slice"](1) : nodes)) ?? [])[0]) ?? null);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
294
1058
|
}
|
|
295
1059
|
function emit_parameter(node) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
1060
|
+
{
|
|
1061
|
+
const __eliscript_value_89 = emit_binding_target(node);
|
|
1062
|
+
const __eliscript_value_90 = ir_property(node, "parameterKind");
|
|
1063
|
+
const __eliscript_value_91 = ir_property(node, "pattern");
|
|
1064
|
+
{
|
|
1065
|
+
let name = __eliscript_value_89;
|
|
1066
|
+
let kind = __eliscript_value_90;
|
|
1067
|
+
let pattern = __eliscript_value_91;
|
|
1068
|
+
if ((kind === "optional")) {
|
|
1069
|
+
return combine([name, " = ", (__eliscript_truthy(pattern) ? binding_default_value(node) : "null")]);
|
|
1070
|
+
} else {
|
|
1071
|
+
if ((kind === "rest")) {
|
|
1072
|
+
return combine(["...", name]);
|
|
1073
|
+
} else {
|
|
1074
|
+
return name;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
299
1079
|
}
|
|
300
1080
|
function emit_arguments(nodes) {
|
|
301
|
-
return join_fragments((nodes)["map"]((node) => {
|
|
1081
|
+
return join_fragments((nodes)["map"](((node) => {
|
|
302
1082
|
return emit_expression(node);
|
|
303
|
-
}), ", ");
|
|
1083
|
+
})), ", ");
|
|
1084
|
+
}
|
|
1085
|
+
function qualified_apply_reference_p(node) {
|
|
1086
|
+
return ((__eliscript_value_92) => (__eliscript_truthy(__eliscript_value_92) ? ((__eliscript_value_93) => (__eliscript_truthy(__eliscript_value_93) ? ((__eliscript_value_94) => (__eliscript_truthy(__eliscript_value_94) ? ((name) => {
|
|
1087
|
+
while (__eliscript_truthy((name)["endsWith"]("."))) {
|
|
1088
|
+
((name = (name)["slice"](0, -1)));
|
|
1089
|
+
}
|
|
1090
|
+
return (name)["endsWith"](".apply");
|
|
1091
|
+
})((ir_value(node))["replaceAll"]("/", ".")) : __eliscript_value_94))((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(ir_value(node)) === "string")) : __eliscript_value_93))((ir_kind(node) === "reference")) : __eliscript_value_92))(node_p(node));
|
|
304
1092
|
}
|
|
305
1093
|
function emit_callee(node) {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
1094
|
+
{
|
|
1095
|
+
const __eliscript_value_95 = emit_expression(node);
|
|
1096
|
+
{
|
|
1097
|
+
let output = __eliscript_value_95;
|
|
1098
|
+
if (__eliscript_truthy(qualified_apply_reference_p(node))) {
|
|
1099
|
+
return combine(["__eliscript_at(", (__eliscript_tdz_read_19())(ir_span(node), text_fragment(((output)["text"])["slice"](0, -6))), ", \"apply\")"]);
|
|
1100
|
+
} else {
|
|
1101
|
+
if ((ir_kind(node) === "reference")) {
|
|
1102
|
+
return output;
|
|
1103
|
+
} else {
|
|
1104
|
+
return combine(["(", output, ")"]);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
function boolean_reference_text_p(text) {
|
|
1111
|
+
{
|
|
1112
|
+
const __eliscript_value_96 = ((text) ?? []).length;
|
|
1113
|
+
const __eliscript_value_97 = 2;
|
|
1114
|
+
const __eliscript_value_98 = true;
|
|
1115
|
+
{
|
|
1116
|
+
let length = __eliscript_value_96;
|
|
1117
|
+
let index = __eliscript_value_97;
|
|
1118
|
+
let valid = __eliscript_value_98;
|
|
1119
|
+
if ((__eliscript_numeric_relation("<", length, 3) || ((__eliscript_value_99, __eliscript_value_100) => (__eliscript_value_99 !== __eliscript_value_100))((text)["charCodeAt"](0), 33) || ((__eliscript_value_101, __eliscript_value_102) => (__eliscript_value_101 !== __eliscript_value_102))((text)["charCodeAt"](1), 33))) {
|
|
1120
|
+
((valid = false));
|
|
1121
|
+
}
|
|
1122
|
+
while (__eliscript_truthy(((__eliscript_value_103) => (__eliscript_truthy(__eliscript_value_103) ? __eliscript_numeric_relation("<", index, length) : __eliscript_value_103))(valid))) {
|
|
1123
|
+
{
|
|
1124
|
+
const __eliscript_value_104 = (text)["charCodeAt"](index);
|
|
1125
|
+
{
|
|
1126
|
+
let code = __eliscript_value_104;
|
|
1127
|
+
if ((!((__eliscript_numeric_relation(">=", code, 65) && __eliscript_numeric_relation("<=", code, 90)) || (__eliscript_numeric_relation(">=", code, 97) && __eliscript_numeric_relation("<=", code, 122)) || (code === 95) || (code === 36) || (__eliscript_numeric_relation(">", index, 2) && __eliscript_numeric_relation(">=", code, 48) && __eliscript_numeric_relation("<=", code, 57))))) {
|
|
1128
|
+
((valid = false));
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
((index = (index + 1)));
|
|
1133
|
+
}
|
|
1134
|
+
return valid;
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
function boolean_p(node) {
|
|
1139
|
+
{
|
|
1140
|
+
const __eliscript_value_105 = ir_kind(node);
|
|
1141
|
+
const __eliscript_value_106 = ir_value(node);
|
|
1142
|
+
{
|
|
1143
|
+
let kind = __eliscript_value_105;
|
|
1144
|
+
let value = __eliscript_value_106;
|
|
1145
|
+
if ((kind === "literal")) {
|
|
1146
|
+
return ((value === true) || (value === false));
|
|
1147
|
+
} else {
|
|
1148
|
+
if ((kind === "raw-javascript")) {
|
|
1149
|
+
{
|
|
1150
|
+
const __eliscript_value_107 = children(node);
|
|
1151
|
+
{
|
|
1152
|
+
let nodes = __eliscript_value_107;
|
|
1153
|
+
return ((__eliscript_value_108) => (__eliscript_truthy(__eliscript_value_108) ? ((__eliscript_value_109) => (__eliscript_truthy(__eliscript_value_109) ? ((__eliscript_value_110) => (__eliscript_truthy(__eliscript_value_110) ? boolean_reference_text_p((ir_value(((((nodes) ?? [])[0]) ?? null)))["trim"]()) : __eliscript_value_110))((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(ir_value(((((nodes) ?? [])[0]) ?? null))) === "string")) : __eliscript_value_109))((ir_kind(((((nodes) ?? [])[0]) ?? null)) === "literal")) : __eliscript_value_108))((((nodes) ?? []).length === 1));
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
} else {
|
|
1157
|
+
if ((kind === "intrinsic")) {
|
|
1158
|
+
return (!((["not", "=", "/=", "not=", "<", "<=", ">", ">=", "eq", "equal", "nil?", "undefined?", "null", "nullish?"])["indexOf"](value) === -1));
|
|
1159
|
+
} else {
|
|
1160
|
+
if ((kind === "short-circuit")) {
|
|
1161
|
+
{
|
|
1162
|
+
const __eliscript_value_111 = children(node);
|
|
1163
|
+
{
|
|
1164
|
+
let nodes = __eliscript_value_111;
|
|
1165
|
+
return ((__eliscript_value_112) => (__eliscript_truthy(__eliscript_value_112) ? (nodes)["every"](boolean_p) : __eliscript_value_112))(__eliscript_numeric_relation(">", (nodes)["length"], 0));
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
} else {
|
|
1169
|
+
return false;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
function emit_test(node) {
|
|
1178
|
+
{
|
|
1179
|
+
const __eliscript_value_113 = emit_expression(node);
|
|
1180
|
+
{
|
|
1181
|
+
let output = __eliscript_value_113;
|
|
1182
|
+
if (__eliscript_truthy(boolean_p(node))) {
|
|
1183
|
+
return output;
|
|
1184
|
+
} else {
|
|
1185
|
+
return combine(["__eliscript_truthy(", output, ")"]);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
function context_sequential_safe_p(bindings) {
|
|
1191
|
+
if (__eliscript_numeric_relation("<=", ((bindings) ?? []).length, 1)) {
|
|
1192
|
+
return false;
|
|
1193
|
+
} else {
|
|
1194
|
+
{
|
|
1195
|
+
const __eliscript_value_114 = new (globalThis.Map)();
|
|
1196
|
+
const __eliscript_value_115 = 0;
|
|
1197
|
+
const __eliscript_value_116 = true;
|
|
1198
|
+
{
|
|
1199
|
+
let names = __eliscript_value_114;
|
|
1200
|
+
let index = __eliscript_value_115;
|
|
1201
|
+
let safe = __eliscript_value_116;
|
|
1202
|
+
while (__eliscript_truthy(((__eliscript_value_117) => (__eliscript_truthy(__eliscript_value_117) ? __eliscript_numeric_relation("<", index, ((bindings) ?? []).length) : __eliscript_value_117))(safe))) {
|
|
1203
|
+
{
|
|
1204
|
+
const __eliscript_value_118 = binding_name(ir_value(((((bindings) ?? [])[index]) ?? null)));
|
|
1205
|
+
{
|
|
1206
|
+
let name = __eliscript_value_118;
|
|
1207
|
+
if (__eliscript_truthy((names)["has"](name))) {
|
|
1208
|
+
((safe = false));
|
|
1209
|
+
} else {
|
|
1210
|
+
(names)["set"](name, index);
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
((index = (index + 1)));
|
|
1215
|
+
}
|
|
1216
|
+
((index = 0));
|
|
1217
|
+
while (__eliscript_truthy(((__eliscript_value_119) => (__eliscript_truthy(__eliscript_value_119) ? __eliscript_numeric_relation("<", index, ((bindings) ?? []).length) : __eliscript_value_119))(safe))) {
|
|
1218
|
+
{
|
|
1219
|
+
let initializer = binding_initializer(((((bindings) ?? [])[index]) ?? null));
|
|
1220
|
+
let pending = (__eliscript_truthy(initializer) ? [initializer] : []);
|
|
1221
|
+
while (__eliscript_truthy(((__eliscript_value_120) => (__eliscript_truthy(__eliscript_value_120) ? __eliscript_numeric_relation(">", ((pending) ?? []).length, 0) : __eliscript_value_120))(safe))) {
|
|
1222
|
+
{
|
|
1223
|
+
let node = (pending)["pop"]();
|
|
1224
|
+
let kind = ir_kind(node);
|
|
1225
|
+
if ((kind === "raw-javascript")) {
|
|
1226
|
+
((safe = false));
|
|
1227
|
+
} else {
|
|
1228
|
+
if (((kind === "reference") || (kind === "assignment-pair"))) {
|
|
1229
|
+
{
|
|
1230
|
+
let name = reference_name(ir_value(node));
|
|
1231
|
+
let root = (((((name)["split"](".")) ?? [])[0]) ?? null);
|
|
1232
|
+
if (__eliscript_truthy(((__eliscript_value_121) => (__eliscript_truthy(__eliscript_value_121) ? __eliscript_numeric_relation(">=", (names)["get"](root), index) : __eliscript_value_121))((names)["has"](root)))) {
|
|
1233
|
+
((safe = false));
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
(children(node))["forEach"](((child) => {
|
|
1238
|
+
return (pending)["push"](child);
|
|
1239
|
+
}));
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
((index = (index + 1)));
|
|
1245
|
+
}
|
|
1246
|
+
return safe;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
function emit_context_let(bindings, body, sequential, returning) {
|
|
1252
|
+
if (((bindings)["length"] === 0)) {
|
|
1253
|
+
if (__eliscript_truthy(returning)) {
|
|
1254
|
+
return emit_returning_body(body);
|
|
1255
|
+
} else {
|
|
1256
|
+
return emit_statement_body(body);
|
|
1257
|
+
}
|
|
1258
|
+
} else {
|
|
1259
|
+
if (__eliscript_truthy(((__eliscript_value_122) => (__eliscript_truthy(__eliscript_value_122) ? context_sequential_safe_p(bindings) : __eliscript_value_122))(sequential))) {
|
|
1260
|
+
{
|
|
1261
|
+
const __eliscript_value_123 = [];
|
|
1262
|
+
{
|
|
1263
|
+
let declarations = __eliscript_value_123;
|
|
1264
|
+
(bindings)["forEach"](((binding) => {
|
|
1265
|
+
{
|
|
1266
|
+
const __eliscript_value_124 = binding_initializer(binding);
|
|
1267
|
+
{
|
|
1268
|
+
let initializer = __eliscript_value_124;
|
|
1269
|
+
return (declarations)["push"](combine(["let ", emit_binding_target(binding), " = ", (__eliscript_truthy(initializer) ? emit_expression(initializer) : "null"), ";"]));
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
}));
|
|
1273
|
+
(declarations)["push"]((__eliscript_truthy(returning) ? emit_returning_body(body) : emit_statement_body(body)));
|
|
1274
|
+
return combine(["{\n", indent(join_fragments(declarations, "\n")), "\n}"]);
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
} else {
|
|
1278
|
+
{
|
|
1279
|
+
let group = (__eliscript_truthy(sequential) ? [((((bindings) ?? [])[0]) ?? null)] : bindings);
|
|
1280
|
+
let temporaries = temporary_names(group);
|
|
1281
|
+
let initializers = [];
|
|
1282
|
+
let declarations = [];
|
|
1283
|
+
let index = 0;
|
|
1284
|
+
while (__eliscript_numeric_relation("<", index, (group)["length"])) {
|
|
1285
|
+
{
|
|
1286
|
+
let binding = ((((group) ?? [])[index]) ?? null);
|
|
1287
|
+
let initializer = binding_initializer(binding);
|
|
1288
|
+
(initializers)["push"](combine(["const ", ((((temporaries) ?? [])[index]) ?? null), " = ", (__eliscript_truthy(initializer) ? emit_expression(initializer) : "null"), ";"]));
|
|
1289
|
+
}
|
|
1290
|
+
((index = (index + 1)));
|
|
1291
|
+
}
|
|
1292
|
+
((index = 0));
|
|
1293
|
+
while (__eliscript_numeric_relation("<", index, (group)["length"])) {
|
|
1294
|
+
(declarations)["push"](combine(["let ", emit_binding_target(((((group) ?? [])[index]) ?? null)), " = ", ((((temporaries) ?? [])[index]) ?? null), ";"]));
|
|
1295
|
+
((index = (index + 1)));
|
|
1296
|
+
}
|
|
1297
|
+
(declarations)["push"](emit_context_let((__eliscript_truthy(sequential) ? (bindings)["slice"](1) : []), body, sequential, returning));
|
|
1298
|
+
(initializers)["push"](combine(["{\n", indent(join_fragments(declarations, "\n")), "\n}"]));
|
|
1299
|
+
return combine(["{\n", indent(join_fragments(initializers, "\n")), "\n}"]);
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
function emit_context_cond(clauses, returning) {
|
|
1305
|
+
if (((clauses)["length"] === 0)) {
|
|
1306
|
+
return text_fragment((__eliscript_truthy(returning) ? "return null;" : ""));
|
|
1307
|
+
} else {
|
|
1308
|
+
{
|
|
1309
|
+
let clause = ((((clauses) ?? [])[0]) ?? null);
|
|
1310
|
+
let nodes = children(clause);
|
|
1311
|
+
let test = ((((nodes) ?? [])[0]) ?? null);
|
|
1312
|
+
let body = (nodes)["slice"](1);
|
|
1313
|
+
return (__eliscript_tdz_read_19())(ir_span(clause), (((ir_kind(test) === "literal") && (ir_value(test) === true)) ? (__eliscript_truthy(returning) ? emit_returning_body(body) : emit_statement_body(body)) : combine(["if (", emit_test(test), ") {\n", indent((__eliscript_truthy(returning) ? emit_returning_body(body) : emit_statement_body(body))), "\n} else {\n", indent(emit_context_cond((clauses)["slice"](1), returning)), "\n}"])));
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
function emit_context(node, returning) {
|
|
1318
|
+
{
|
|
1319
|
+
const __eliscript_value_125 = ir_kind(node);
|
|
1320
|
+
const __eliscript_value_126 = children(node);
|
|
1321
|
+
{
|
|
1322
|
+
let kind = __eliscript_value_125;
|
|
1323
|
+
let nodes = __eliscript_value_126;
|
|
1324
|
+
return locate(node, (__eliscript_truthy(contains_await_p(node)) ? combine([(__eliscript_truthy(returning) ? "return " : ""), emit_expression(node), ";"]) : ((kind === "sequence") ? (__eliscript_truthy(returning) ? emit_returning_body(nodes) : emit_statement_body(nodes)) : ((kind === "conditional") ? combine(["if (", emit_test(((((nodes) ?? [])[0]) ?? null)), ") {\n", indent(emit_context(((((nodes) ?? [])[1]) ?? null), returning)), "\n}", (__eliscript_truthy(((__eliscript_value_127) => (__eliscript_truthy(__eliscript_value_127) ? __eliscript_value_127 : __eliscript_numeric_relation(">", (nodes)["length"], 2)))(returning)) ? combine([" else {\n", indent((__eliscript_numeric_relation(">", (nodes)["length"], 2) ? emit_context(((((nodes) ?? [])[2]) ?? null), returning) : text_fragment("return null;"))), "\n}"]) : "")]) : ((kind === "conditional-sugar") ? combine(["if (", ((ir_value(node) === "when") ? emit_test(((((nodes) ?? [])[0]) ?? null)) : combine(["(!", emit_test(((((nodes) ?? [])[0]) ?? null)), ")"])), ") {\n", indent((__eliscript_truthy(returning) ? emit_returning_body((nodes)["slice"](1)) : emit_statement_body((nodes)["slice"](1)))), "\n}", (__eliscript_truthy(returning) ? " else {\n return null;\n}" : "")]) : ((kind === "conditional-chain") ? emit_context_cond(nodes, returning) : ((kind === "loop") ? combine(["while (", emit_test(((((nodes) ?? [])[0]) ?? null)), ") {\n", indent(emit_statement_body((nodes)["slice"](1))), "\n}", (__eliscript_truthy(returning) ? "\nreturn null;" : "")]) : (__eliscript_truthy(((__eliscript_value_128) => (__eliscript_truthy(__eliscript_value_128) ? ((nodes)["slice"](0, ir_property(node, "bindingCount")))["every"](((binding) => {
|
|
1325
|
+
return (!__eliscript_truthy(ir_property(binding, "pattern")));
|
|
1326
|
+
})) : __eliscript_value_128))((kind === "lexical-bindings"))) ? ((parts) => {
|
|
1327
|
+
return emit_context_let(((((parts) ?? [])[0]) ?? null), ((((parts) ?? [])[1]) ?? null), ir_property(node, "sequential"), returning);
|
|
1328
|
+
})(split_counted_children(node, "bindingCount")) : combine([(__eliscript_truthy(returning) ? "return " : ""), emit_expression(node), ";"])))))))));
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
309
1331
|
}
|
|
310
1332
|
function emit_returning_body(nodes) {
|
|
311
|
-
|
|
312
|
-
(
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
1333
|
+
if (((nodes)["length"] === 0)) {
|
|
1334
|
+
return text_fragment("return null;");
|
|
1335
|
+
} else {
|
|
1336
|
+
{
|
|
1337
|
+
const __eliscript_value_129 = [];
|
|
1338
|
+
const __eliscript_value_130 = 0;
|
|
1339
|
+
const __eliscript_value_131 = __eliscript_numeric_decrement((nodes)["length"]);
|
|
1340
|
+
{
|
|
1341
|
+
let parts = __eliscript_value_129;
|
|
1342
|
+
let index = __eliscript_value_130;
|
|
1343
|
+
let last_index = __eliscript_value_131;
|
|
1344
|
+
while (__eliscript_numeric_relation("<", index, last_index)) {
|
|
1345
|
+
(parts)["push"](emit_context(((((nodes) ?? [])[index]) ?? null), false));
|
|
1346
|
+
((index = (index + 1)));
|
|
1347
|
+
}
|
|
1348
|
+
(parts)["push"](emit_context(((((nodes) ?? [])[last_index]) ?? null), true));
|
|
1349
|
+
return join_fragments(parts, "\n");
|
|
317
1350
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
(parts)["push"]("return ");
|
|
321
|
-
(parts)["push"](emit_expression(((((nodes) ?? [])[last_index]) ?? null)));
|
|
322
|
-
(parts)["push"](";");
|
|
323
|
-
return combine(parts);
|
|
324
|
-
})([], 0, ((nodes)["length"] - 1)));
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
325
1353
|
}
|
|
326
1354
|
function emit_statement_body(nodes) {
|
|
327
|
-
return ((
|
|
328
|
-
(
|
|
329
|
-
|
|
330
|
-
});
|
|
331
|
-
return join_fragments(parts, "\n");
|
|
332
|
-
})([]);
|
|
1355
|
+
return join_fragments((nodes)["map"](((node) => {
|
|
1356
|
+
return emit_context(node, false);
|
|
1357
|
+
})), "\n");
|
|
333
1358
|
}
|
|
334
1359
|
function contains_await_p(value) {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
1360
|
+
{
|
|
1361
|
+
const __eliscript_value_132 = [value];
|
|
1362
|
+
const __eliscript_value_133 = null;
|
|
1363
|
+
const __eliscript_value_134 = null;
|
|
1364
|
+
const __eliscript_value_135 = null;
|
|
1365
|
+
const __eliscript_value_136 = 0;
|
|
1366
|
+
const __eliscript_value_137 = false;
|
|
1367
|
+
{
|
|
1368
|
+
let pending = __eliscript_value_132;
|
|
1369
|
+
let current = __eliscript_value_133;
|
|
1370
|
+
let kind = __eliscript_value_134;
|
|
1371
|
+
let nodes = __eliscript_value_135;
|
|
1372
|
+
let index = __eliscript_value_136;
|
|
1373
|
+
let found = __eliscript_value_137;
|
|
1374
|
+
while (((!__eliscript_truthy(found)) && __eliscript_numeric_relation(">", (pending)["length"], 0))) {
|
|
338
1375
|
((current = (pending)["pop"]()));
|
|
339
|
-
(__eliscript_truthy(node_p(current))
|
|
1376
|
+
if (__eliscript_truthy(node_p(current))) {
|
|
340
1377
|
((kind = ir_kind(current)));
|
|
341
|
-
|
|
342
|
-
((
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
1378
|
+
if ((kind === "await-expression")) {
|
|
1379
|
+
((found = true));
|
|
1380
|
+
} else {
|
|
1381
|
+
if ((!(kind === "function-expression"))) {
|
|
1382
|
+
((nodes = children(current)));
|
|
1383
|
+
((index = __eliscript_numeric_decrement((nodes)["length"])));
|
|
1384
|
+
while (__eliscript_numeric_relation(">=", index, 0)) {
|
|
346
1385
|
(pending)["push"](((((nodes) ?? [])[index]) ?? null));
|
|
347
|
-
((index = (index
|
|
1386
|
+
((index = __eliscript_numeric_decrement(index)));
|
|
348
1387
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
1388
|
+
} else {
|
|
1389
|
+
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
} else {
|
|
1393
|
+
if (__eliscript_truthy(Array.isArray(current))) {
|
|
1394
|
+
((index = __eliscript_numeric_decrement((current)["length"])));
|
|
1395
|
+
while (__eliscript_numeric_relation(">=", index, 0)) {
|
|
356
1396
|
(pending)["push"](((((current) ?? [])[index]) ?? null));
|
|
357
|
-
((index = (index
|
|
1397
|
+
((index = __eliscript_numeric_decrement(index)));
|
|
358
1398
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
1399
|
+
} else {
|
|
1400
|
+
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
362
1403
|
}
|
|
363
|
-
return
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
})([value], null, null, null, 0, false);
|
|
1404
|
+
return found;
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
367
1407
|
}
|
|
368
1408
|
function emit_iife(parameters, body, invocation, asynchronous) {
|
|
369
|
-
|
|
1409
|
+
if (__eliscript_truthy(asynchronous)) {
|
|
1410
|
+
return combine(["(await (async (", parameters, ") => {\n", body, "\n})(", invocation, "))"]);
|
|
1411
|
+
} else {
|
|
1412
|
+
return combine(["((", parameters, ") => {\n", body, "\n})(", invocation, ")"]);
|
|
1413
|
+
}
|
|
370
1414
|
}
|
|
371
1415
|
function emit_do(nodes) {
|
|
372
|
-
|
|
1416
|
+
if (((nodes)["length"] === 0)) {
|
|
1417
|
+
return text_fragment("null");
|
|
1418
|
+
} else {
|
|
1419
|
+
if (((nodes)["length"] === 1)) {
|
|
1420
|
+
return emit_expression(((((nodes) ?? [])[0]) ?? null));
|
|
1421
|
+
} else {
|
|
1422
|
+
return emit_iife("", indent(emit_returning_body(nodes)), "", contains_await_p(nodes));
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
373
1425
|
}
|
|
374
1426
|
function split_counted_children(node, property) {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
1427
|
+
{
|
|
1428
|
+
const __eliscript_value_138 = children(node);
|
|
1429
|
+
const __eliscript_value_139 = ir_property(node, property);
|
|
1430
|
+
{
|
|
1431
|
+
let all = __eliscript_value_138;
|
|
1432
|
+
let count = __eliscript_value_139;
|
|
1433
|
+
return [(all)["slice"](0, count), (all)["slice"](count)];
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
378
1436
|
}
|
|
379
1437
|
function emit_function(node) {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
1438
|
+
{
|
|
1439
|
+
let parts = split_counted_children(node, "parameterCount");
|
|
1440
|
+
let parameters = ((((parts) ?? [])[0]) ?? null);
|
|
1441
|
+
let body = ((((parts) ?? [])[1]) ?? null);
|
|
1442
|
+
{
|
|
1443
|
+
const __eliscript_value_140 = combine(["(", (__eliscript_truthy(ir_property(node, "async")) ? "async " : ""), "(", join_fragments((parameters)["map"](((parameter) => {
|
|
1444
|
+
return emit_parameter(parameter);
|
|
1445
|
+
})), ", "), ") => {\n", indent(emit_function_body(parameters, body)), "\n})"]);
|
|
1446
|
+
{
|
|
1447
|
+
let fragment = __eliscript_value_140;
|
|
1448
|
+
return function_source_fragment(node, fragment, 1, __eliscript_numeric_decrement((((fragment)["text"]) ?? []).length));
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
389
1452
|
}
|
|
390
1453
|
function contains_recur_target_p(value, target_kind) {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
1454
|
+
{
|
|
1455
|
+
const __eliscript_value_141 = [value];
|
|
1456
|
+
const __eliscript_value_142 = null;
|
|
1457
|
+
const __eliscript_value_143 = null;
|
|
1458
|
+
const __eliscript_value_144 = null;
|
|
1459
|
+
const __eliscript_value_145 = 0;
|
|
1460
|
+
const __eliscript_value_146 = false;
|
|
1461
|
+
{
|
|
1462
|
+
let pending = __eliscript_value_141;
|
|
1463
|
+
let current = __eliscript_value_142;
|
|
1464
|
+
let kind = __eliscript_value_143;
|
|
1465
|
+
let nodes = __eliscript_value_144;
|
|
1466
|
+
let index = __eliscript_value_145;
|
|
1467
|
+
let found = __eliscript_value_146;
|
|
1468
|
+
while (((!__eliscript_truthy(found)) && __eliscript_numeric_relation(">", (pending)["length"], 0))) {
|
|
394
1469
|
((current = (pending)["pop"]()));
|
|
395
|
-
(__eliscript_truthy(node_p(current))
|
|
1470
|
+
if (__eliscript_truthy(node_p(current))) {
|
|
396
1471
|
((kind = ir_kind(current)));
|
|
397
|
-
|
|
398
|
-
((
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
1472
|
+
if ((kind === "recur")) {
|
|
1473
|
+
if ((ir_property(current, "targetKind") === target_kind)) {
|
|
1474
|
+
((found = true));
|
|
1475
|
+
}
|
|
1476
|
+
} else {
|
|
1477
|
+
if ((!(kind === "function-expression"))) {
|
|
1478
|
+
((nodes = children(current)));
|
|
1479
|
+
((index = __eliscript_numeric_decrement((nodes)["length"])));
|
|
1480
|
+
while (__eliscript_numeric_relation(">=", index, 0)) {
|
|
402
1481
|
(pending)["push"](((((nodes) ?? [])[index]) ?? null));
|
|
403
|
-
((index = (index
|
|
1482
|
+
((index = __eliscript_numeric_decrement(index)));
|
|
404
1483
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
1484
|
+
} else {
|
|
1485
|
+
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
} else {
|
|
1489
|
+
if (__eliscript_truthy(Array.isArray(current))) {
|
|
1490
|
+
((index = __eliscript_numeric_decrement((current)["length"])));
|
|
1491
|
+
while (__eliscript_numeric_relation(">=", index, 0)) {
|
|
412
1492
|
(pending)["push"](((((current) ?? [])[index]) ?? null));
|
|
413
|
-
((index = (index
|
|
1493
|
+
((index = __eliscript_numeric_decrement(index)));
|
|
414
1494
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
1495
|
+
} else {
|
|
1496
|
+
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
418
1499
|
}
|
|
419
|
-
return
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
})([value], null, null, null, 0, false);
|
|
1500
|
+
return found;
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
423
1503
|
}
|
|
424
1504
|
function emit_rebinding_target(binding, temporary) {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
1505
|
+
{
|
|
1506
|
+
const __eliscript_value_147 = emit_binding_target(binding);
|
|
1507
|
+
{
|
|
1508
|
+
let target = __eliscript_value_147;
|
|
1509
|
+
if (__eliscript_truthy(ir_property(binding, "pattern"))) {
|
|
1510
|
+
return combine(["(", target, " = ", temporary, ");"]);
|
|
1511
|
+
} else {
|
|
1512
|
+
return combine([target, " = ", temporary, ";"]);
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
428
1516
|
}
|
|
429
1517
|
function emit_recur_tail(node, target) {
|
|
430
|
-
(
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
1518
|
+
if ((!(ir_property(node, "targetKind") === (target)["kind"]))) {
|
|
1519
|
+
(__eliscript_tdz_read_16())("recur target does not match its enclosing loop");
|
|
1520
|
+
}
|
|
1521
|
+
{
|
|
1522
|
+
const __eliscript_value_148 = children(node);
|
|
1523
|
+
const __eliscript_value_149 = (target)["bindings"];
|
|
1524
|
+
const __eliscript_value_150 = [];
|
|
1525
|
+
const __eliscript_value_151 = [];
|
|
1526
|
+
const __eliscript_value_152 = 0;
|
|
1527
|
+
{
|
|
1528
|
+
let args = __eliscript_value_148;
|
|
1529
|
+
let bindings = __eliscript_value_149;
|
|
1530
|
+
let temporaries = __eliscript_value_150;
|
|
1531
|
+
let parts = __eliscript_value_151;
|
|
1532
|
+
let index = __eliscript_value_152;
|
|
1533
|
+
while (__eliscript_numeric_relation("<", index, (args)["length"])) {
|
|
1534
|
+
{
|
|
1535
|
+
const __eliscript_value_153 = fresh_name();
|
|
1536
|
+
{
|
|
1537
|
+
let temporary = __eliscript_value_153;
|
|
1538
|
+
(temporaries)["push"](temporary);
|
|
1539
|
+
(parts)["push"](combine(["const ", temporary, " = ", emit_expression(((((args) ?? [])[index]) ?? null)), ";"]));
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
438
1542
|
((index = (index + 1)));
|
|
439
1543
|
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
((index = 0));
|
|
443
|
-
(() => {
|
|
444
|
-
while (__eliscript_truthy((index < (bindings)["length"]))) {
|
|
1544
|
+
((index = 0));
|
|
1545
|
+
while (__eliscript_numeric_relation("<", index, (bindings)["length"])) {
|
|
445
1546
|
(parts)["push"](emit_rebinding_target(((((bindings) ?? [])[index]) ?? null), ((((temporaries) ?? [])[index]) ?? null)));
|
|
446
1547
|
((index = (index + 1)));
|
|
447
1548
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
})(children(node), (target)["bindings"], [], [], 0);
|
|
1549
|
+
(parts)["push"](combine(["continue ", (target)["label"], ";"]));
|
|
1550
|
+
return (__eliscript_tdz_read_19())(ir_span(node), join_fragments(parts, "\n"));
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
453
1553
|
}
|
|
454
1554
|
function emit_tail_body(nodes, target) {
|
|
455
|
-
|
|
456
|
-
(
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
1555
|
+
if (((nodes)["length"] === 0)) {
|
|
1556
|
+
return text_fragment("return null;");
|
|
1557
|
+
} else {
|
|
1558
|
+
{
|
|
1559
|
+
const __eliscript_value_154 = [];
|
|
1560
|
+
const __eliscript_value_155 = 0;
|
|
1561
|
+
const __eliscript_value_156 = __eliscript_numeric_decrement((nodes)["length"]);
|
|
1562
|
+
{
|
|
1563
|
+
let parts = __eliscript_value_154;
|
|
1564
|
+
let index = __eliscript_value_155;
|
|
1565
|
+
let last_index = __eliscript_value_156;
|
|
1566
|
+
while (__eliscript_numeric_relation("<", index, last_index)) {
|
|
1567
|
+
(parts)["push"](combine([emit_expression(((((nodes) ?? [])[index]) ?? null)), ";"]));
|
|
1568
|
+
((index = (index + 1)));
|
|
1569
|
+
}
|
|
1570
|
+
(parts)["push"](emit_tail_node(((((nodes) ?? [])[last_index]) ?? null), target));
|
|
1571
|
+
return join_fragments(parts, "\n");
|
|
460
1572
|
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
(parts)["push"](emit_tail_node(((((nodes) ?? [])[last_index]) ?? null), target));
|
|
464
|
-
return join_fragments(parts, "\n");
|
|
465
|
-
})([], 0, ((nodes)["length"] - 1)));
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
466
1575
|
}
|
|
467
1576
|
function emit_tail_cond(clauses, target) {
|
|
468
|
-
|
|
469
|
-
return (
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
1577
|
+
if (((clauses)["length"] === 0)) {
|
|
1578
|
+
return text_fragment("return null;");
|
|
1579
|
+
} else {
|
|
1580
|
+
{
|
|
1581
|
+
let clause = ((((clauses) ?? [])[0]) ?? null);
|
|
1582
|
+
let nodes = children(clause);
|
|
1583
|
+
let test = ((((nodes) ?? [])[0]) ?? null);
|
|
1584
|
+
let body = (nodes)["slice"](1);
|
|
1585
|
+
return (__eliscript_tdz_read_19())(ir_span(clause), (((ir_kind(test) === "literal") && (ir_value(test) === true)) ? emit_tail_body(body, target) : combine(["if (__eliscript_truthy(", emit_expression(test), ")) {\n", indent(emit_tail_body(body, target)), "\n} else {\n", indent(emit_tail_cond((clauses)["slice"](1), target)), "\n}"])));
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
477
1588
|
}
|
|
478
1589
|
function emit_tail_let(node, target) {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
((index = (index + 1)));
|
|
523
|
-
}
|
|
524
|
-
return null;
|
|
525
|
-
})();
|
|
526
|
-
})());
|
|
527
|
-
(statements)["push"](emit_tail_body(body, target));
|
|
528
|
-
return native_locate(ir_span(node), combine(["{\n", indent(join_fragments(statements, "\n")), "\n}"]));
|
|
529
|
-
})();
|
|
530
|
-
})(0);
|
|
531
|
-
})([]);
|
|
532
|
-
})([]);
|
|
533
|
-
})(ir_property(node, "sequential"));
|
|
534
|
-
})(((((parts) ?? [])[1]) ?? null));
|
|
535
|
-
})(((((parts) ?? [])[0]) ?? null));
|
|
536
|
-
})(split_counted_children(node, "bindingCount"));
|
|
1590
|
+
{
|
|
1591
|
+
let parts = split_counted_children(node, "bindingCount");
|
|
1592
|
+
let bindings = ((((parts) ?? [])[0]) ?? null);
|
|
1593
|
+
let body = ((((parts) ?? [])[1]) ?? null);
|
|
1594
|
+
let sequential = ir_property(node, "sequential");
|
|
1595
|
+
let statements = [];
|
|
1596
|
+
let temporaries = [];
|
|
1597
|
+
let index = 0;
|
|
1598
|
+
if (__eliscript_truthy(sequential)) {
|
|
1599
|
+
while (__eliscript_numeric_relation("<", index, (bindings)["length"])) {
|
|
1600
|
+
{
|
|
1601
|
+
let binding = ((((bindings) ?? [])[index]) ?? null);
|
|
1602
|
+
let initializer = binding_initializer(binding);
|
|
1603
|
+
(statements)["push"](combine(["let ", emit_binding_target(binding), " = ", (__eliscript_truthy(initializer) ? emit_expression(initializer) : binding_default_value(binding)), ";"]));
|
|
1604
|
+
if (__eliscript_truthy(map_binding_pattern_p(binding))) {
|
|
1605
|
+
(statements)["push"](emit_binding_setup(binding));
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
((index = (index + 1)));
|
|
1609
|
+
}
|
|
1610
|
+
} else {
|
|
1611
|
+
while (__eliscript_numeric_relation("<", index, (bindings)["length"])) {
|
|
1612
|
+
{
|
|
1613
|
+
let binding = ((((bindings) ?? [])[index]) ?? null);
|
|
1614
|
+
let initializer = binding_initializer(binding);
|
|
1615
|
+
let temporary = fresh_name();
|
|
1616
|
+
(temporaries)["push"](temporary);
|
|
1617
|
+
(statements)["push"](combine(["const ", temporary, " = ", (__eliscript_truthy(initializer) ? emit_expression(initializer) : binding_default_value(binding)), ";"]));
|
|
1618
|
+
}
|
|
1619
|
+
((index = (index + 1)));
|
|
1620
|
+
}
|
|
1621
|
+
((index = 0));
|
|
1622
|
+
while (__eliscript_numeric_relation("<", index, (bindings)["length"])) {
|
|
1623
|
+
(statements)["push"](combine(["let ", emit_binding_target(((((bindings) ?? [])[index]) ?? null)), " = ", ((((temporaries) ?? [])[index]) ?? null), ";"]));
|
|
1624
|
+
if (__eliscript_truthy(map_binding_pattern_p(((((bindings) ?? [])[index]) ?? null)))) {
|
|
1625
|
+
(statements)["push"](emit_binding_setup(((((bindings) ?? [])[index]) ?? null)));
|
|
1626
|
+
}
|
|
1627
|
+
((index = (index + 1)));
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
(statements)["push"](emit_tail_body(body, target));
|
|
1631
|
+
return (__eliscript_tdz_read_19())(ir_span(node), combine(["{\n", indent(join_fragments(statements, "\n")), "\n}"]));
|
|
1632
|
+
}
|
|
537
1633
|
}
|
|
538
1634
|
function emit_tail_short_circuit(nodes, kind, target) {
|
|
539
|
-
|
|
540
|
-
return ((
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
1635
|
+
if (((nodes)["length"] === 0)) {
|
|
1636
|
+
return text_fragment(((kind === "and") ? "return true;" : "return null;"));
|
|
1637
|
+
} else {
|
|
1638
|
+
if (((nodes)["length"] === 1)) {
|
|
1639
|
+
return emit_tail_node(((((nodes) ?? [])[0]) ?? null), target);
|
|
1640
|
+
} else {
|
|
1641
|
+
{
|
|
1642
|
+
let temporary = fresh_name();
|
|
1643
|
+
let first = emit_expression(((((nodes) ?? [])[0]) ?? null));
|
|
1644
|
+
let rest = (nodes)["slice"](1);
|
|
1645
|
+
let truthy = ((kind === "and") ? emit_tail_short_circuit(rest, kind, target) : combine(["return ", temporary, ";"]));
|
|
1646
|
+
let falsey = ((kind === "and") ? combine(["return ", temporary, ";"]) : emit_tail_short_circuit(rest, kind, target));
|
|
1647
|
+
return combine(["const ", temporary, " = ", first, ";\n", "if (__eliscript_truthy(", temporary, ")) {\n", indent(truthy), "\n} else {\n", indent(falsey), "\n}"]);
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
550
1651
|
}
|
|
551
1652
|
function emit_tail_node(node, target) {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
1653
|
+
{
|
|
1654
|
+
const __eliscript_value_157 = ir_kind(node);
|
|
1655
|
+
const __eliscript_value_158 = children(node);
|
|
1656
|
+
{
|
|
1657
|
+
let kind = __eliscript_value_157;
|
|
1658
|
+
let nodes = __eliscript_value_158;
|
|
1659
|
+
if ((kind === "recur")) {
|
|
1660
|
+
return emit_recur_tail(node, target);
|
|
1661
|
+
} else {
|
|
1662
|
+
if ((kind === "conditional")) {
|
|
1663
|
+
return combine(["if (__eliscript_truthy(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")) {\n", indent(emit_tail_node(((((nodes) ?? [])[1]) ?? null), target)), "\n} else {\n", indent((__eliscript_numeric_relation(">", (nodes)["length"], 2) ? emit_tail_node(((((nodes) ?? [])[2]) ?? null), target) : text_fragment("return null;"))), "\n}"]);
|
|
1664
|
+
} else {
|
|
1665
|
+
if ((kind === "conditional-sugar")) {
|
|
1666
|
+
return combine(["if (", ((ir_value(node) === "when") ? "" : "!"), "__eliscript_truthy(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")) {\n", indent(emit_tail_body((nodes)["slice"](1), target)), "\n} else {\n return null;\n}"]);
|
|
1667
|
+
} else {
|
|
1668
|
+
if ((kind === "conditional-chain")) {
|
|
1669
|
+
return emit_tail_cond(nodes, target);
|
|
1670
|
+
} else {
|
|
1671
|
+
if ((kind === "sequence")) {
|
|
1672
|
+
return emit_tail_body(nodes, target);
|
|
1673
|
+
} else {
|
|
1674
|
+
if ((kind === "lexical-bindings")) {
|
|
1675
|
+
return emit_tail_let(node, target);
|
|
1676
|
+
} else {
|
|
1677
|
+
if ((kind === "short-circuit")) {
|
|
1678
|
+
return emit_tail_short_circuit(nodes, ir_value(node), target);
|
|
1679
|
+
} else {
|
|
1680
|
+
return combine(["return ", emit_expression(node), ";"]);
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
const closed_scalar_operators = ["+", "-", "*", "/", "%", "mod", "1+", "1-", "=", "eq", "<", "<=", ">", ">=", "/=", "not=", "not"];
|
|
1692
|
+
__eliscript_tdz_ready_25 = true;
|
|
1693
|
+
function closed_scalar_node_p(node, scope, state) {
|
|
1694
|
+
if ((node == null)) {
|
|
1695
|
+
return true;
|
|
1696
|
+
} else {
|
|
1697
|
+
{
|
|
1698
|
+
const __eliscript_value_159 = ir_kind(node);
|
|
1699
|
+
const __eliscript_value_160 = children(node);
|
|
1700
|
+
{
|
|
1701
|
+
let kind = __eliscript_value_159;
|
|
1702
|
+
let nodes = __eliscript_value_160;
|
|
1703
|
+
if ((kind === "literal")) {
|
|
1704
|
+
return ((ir_value(node) === null) || (((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })((node)["value"]) === "number") || (((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })((node)["value"]) === "boolean") || (((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })((node)["value"]) === "undefined"));
|
|
1705
|
+
} else {
|
|
1706
|
+
if ((kind === "reference")) {
|
|
1707
|
+
return __eliscript_numeric_relation(">=", (scope)["indexOf"](ir_value(node)), 0);
|
|
1708
|
+
} else {
|
|
1709
|
+
if ((kind === "lexical-bindings")) {
|
|
1710
|
+
{
|
|
1711
|
+
let parts = split_counted_children(node, "bindingCount");
|
|
1712
|
+
let bindings = ((((parts) ?? [])[0]) ?? null);
|
|
1713
|
+
let inner = (scope)["slice"]();
|
|
1714
|
+
let valid = true;
|
|
1715
|
+
(bindings)["forEach"](((binding) => {
|
|
1716
|
+
if (__eliscript_truthy(((__eliscript_value_161) => (__eliscript_truthy(__eliscript_value_161) ? __eliscript_value_161 : ((__eliscript_value_162) => (__eliscript_truthy(__eliscript_value_162) ? __eliscript_value_162 : (!__eliscript_truthy(closed_scalar_node_p(binding_initializer(binding), (__eliscript_truthy(ir_property(node, "sequential")) ? inner : scope), state)))))(ir_property(binding, "pattern"))))((!(ir_kind(binding) === "lexical-binding"))))) {
|
|
1717
|
+
((valid = false));
|
|
1718
|
+
}
|
|
1719
|
+
return (inner)["push"](ir_value(binding));
|
|
1720
|
+
}));
|
|
1721
|
+
return ((__eliscript_value_163) => (__eliscript_truthy(__eliscript_value_163) ? (((((parts) ?? [])[1]) ?? null))["every"](((child) => {
|
|
1722
|
+
return closed_scalar_node_p(child, inner, state);
|
|
1723
|
+
})) : __eliscript_value_163))(valid);
|
|
1724
|
+
}
|
|
1725
|
+
} else {
|
|
1726
|
+
if ((kind === "assignment")) {
|
|
1727
|
+
return (nodes)["every"](((pair) => {
|
|
1728
|
+
return ((__eliscript_value_164) => (__eliscript_truthy(__eliscript_value_164) ? ((__eliscript_value_165) => (__eliscript_truthy(__eliscript_value_165) ? closed_scalar_node_p(((((children(pair)) ?? [])[0]) ?? null), scope, state) : __eliscript_value_165))(__eliscript_numeric_relation(">=", (scope)["indexOf"](ir_value(pair)), 0)) : __eliscript_value_164))((ir_kind(pair) === "assignment-pair"));
|
|
1729
|
+
}));
|
|
1730
|
+
} else {
|
|
1731
|
+
if ((((kind === "intrinsic") && __eliscript_numeric_relation(">=", ((__eliscript_tdz_read_25()))["indexOf"](ir_value(node)), 0)) || (kind === "conditional") || (kind === "conditional-sugar") || (kind === "short-circuit") || (kind === "sequence") || (kind === "loop"))) {
|
|
1732
|
+
if ((kind === "loop")) {
|
|
1733
|
+
((state)["loop"] = true);
|
|
1734
|
+
}
|
|
1735
|
+
return ((__eliscript_value_166) => (__eliscript_truthy(__eliscript_value_166) ? (nodes)["every"](((child) => {
|
|
1736
|
+
return closed_scalar_node_p(child, scope, state);
|
|
1737
|
+
})) : __eliscript_value_166))(((!(kind === "intrinsic")) || (!__eliscript_truthy(relational_operator_p(ir_value(node)))) || (((nodes) ?? []).length === 2)));
|
|
1738
|
+
} else {
|
|
1739
|
+
return false;
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
function closed_scalar_loop_p(parameters, body) {
|
|
1750
|
+
{
|
|
1751
|
+
const __eliscript_value_167 = ({"loop": false});
|
|
1752
|
+
const __eliscript_value_168 = (parameters)["map"](((parameter) => {
|
|
1753
|
+
return ir_value(parameter);
|
|
1754
|
+
}));
|
|
1755
|
+
{
|
|
1756
|
+
let state = __eliscript_value_167;
|
|
1757
|
+
let scope = __eliscript_value_168;
|
|
1758
|
+
return ((__eliscript_value_169) => (__eliscript_truthy(__eliscript_value_169) ? ((__eliscript_value_170) => (__eliscript_truthy(__eliscript_value_170) ? ((__eliscript_value_171) => (__eliscript_truthy(__eliscript_value_171) ? (state)["loop"] : __eliscript_value_171))((body)["every"](((node) => {
|
|
1759
|
+
return closed_scalar_node_p(node, scope, state);
|
|
1760
|
+
}))) : __eliscript_value_170))((parameters)["every"](((parameter) => {
|
|
1761
|
+
return ((ir_property(parameter, "parameterKind") === "required") && (!__eliscript_truthy(ir_property(parameter, "pattern"))));
|
|
1762
|
+
}))) : __eliscript_value_169))(__eliscript_numeric_relation(">", ((parameters) ?? []).length, 0));
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
555
1765
|
}
|
|
556
1766
|
function emit_function_body(parameters, body) {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
1767
|
+
if (__eliscript_truthy(((__eliscript_value_172) => (__eliscript_truthy(__eliscript_value_172) ? closed_scalar_loop_p(parameters, body) : __eliscript_value_172))((!__eliscript_truthy((__eliscript_tdz_read_14())))))) {
|
|
1768
|
+
{
|
|
1769
|
+
const __eliscript_value_173 = null;
|
|
1770
|
+
const __eliscript_value_174 = null;
|
|
1771
|
+
const __eliscript_value_175 = (__eliscript_tdz_read_14());
|
|
1772
|
+
{
|
|
1773
|
+
let fast = __eliscript_value_173;
|
|
1774
|
+
let slow = __eliscript_value_174;
|
|
1775
|
+
let previous = __eliscript_value_175;
|
|
1776
|
+
(__eliscript_tdz_write_14(true));
|
|
1777
|
+
(() => {
|
|
1778
|
+
try {
|
|
1779
|
+
return ((fast = emit_function_body_unversioned(parameters, body)));
|
|
1780
|
+
} finally {
|
|
1781
|
+
(__eliscript_tdz_write_14(previous));
|
|
1782
|
+
}
|
|
1783
|
+
})();
|
|
1784
|
+
((slow = emit_function_body_unversioned(parameters, body)));
|
|
1785
|
+
return combine(["if (", __eliscript_at_direct((parameters)["map"](((parameter) => {
|
|
1786
|
+
return (String("typeof ") + String(binding_name(ir_value(parameter))) + String(" === \"number\""));
|
|
1787
|
+
})), "join", " && "), ") {\n", indent(fast), "\n} else {\n", indent(slow), "\n}"]);
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
} else {
|
|
1791
|
+
return emit_function_body_unversioned(parameters, body);
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
function emit_function_body_unversioned(parameters, body) {
|
|
1795
|
+
{
|
|
1796
|
+
const __eliscript_value_176 = emit_binding_setups(parameters);
|
|
1797
|
+
{
|
|
1798
|
+
let setups = __eliscript_value_176;
|
|
1799
|
+
if ((!__eliscript_truthy(contains_recur_target_p(body, "function")))) {
|
|
1800
|
+
if ((((setups)["text"])["length"] === 0)) {
|
|
1801
|
+
return emit_returning_body(body);
|
|
1802
|
+
} else {
|
|
1803
|
+
return combine([setups, "\n", emit_returning_body(body)]);
|
|
1804
|
+
}
|
|
1805
|
+
} else {
|
|
1806
|
+
{
|
|
1807
|
+
let label = fresh_name();
|
|
1808
|
+
let target = ({"kind": "function", "bindings": parameters, "label": label});
|
|
1809
|
+
return combine([label, ": while (true) {\n", indent(((((setups)["text"])["length"] === 0) ? emit_tail_body(body, target) : combine([setups, "\n", emit_tail_body(body, target)]))), "\n}"]);
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
564
1814
|
}
|
|
565
1815
|
function emit_if(nodes) {
|
|
566
|
-
return combine(["(
|
|
1816
|
+
return combine(["(", emit_test(((((nodes) ?? [])[0]) ?? null)), " ? ", emit_expression(((((nodes) ?? [])[1]) ?? null)), " : ", (__eliscript_numeric_relation(">", (nodes)["length"], 2) ? emit_expression(((((nodes) ?? [])[2]) ?? null)) : "null"), ")"]);
|
|
567
1817
|
}
|
|
568
1818
|
function emit_conditional_sugar(node) {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
})(children(node));
|
|
1819
|
+
{
|
|
1820
|
+
let nodes = children(node);
|
|
1821
|
+
let test = emit_test(((((nodes) ?? [])[0]) ?? null));
|
|
1822
|
+
let body = emit_do((nodes)["slice"](1));
|
|
1823
|
+
return combine(["(", ((ir_value(node) === "when") ? test : combine(["(!", test, ")"])), " ? ", body, " : null)"]);
|
|
1824
|
+
}
|
|
576
1825
|
}
|
|
577
1826
|
function emit_cond(clauses) {
|
|
578
|
-
|
|
579
|
-
return (
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
1827
|
+
if (((clauses)["length"] === 0)) {
|
|
1828
|
+
return text_fragment("null");
|
|
1829
|
+
} else {
|
|
1830
|
+
{
|
|
1831
|
+
let clause = ((((clauses) ?? [])[0]) ?? null);
|
|
1832
|
+
let nodes = children(clause);
|
|
1833
|
+
let test = ((((nodes) ?? [])[0]) ?? null);
|
|
1834
|
+
let body = (nodes)["slice"](1);
|
|
1835
|
+
return (__eliscript_tdz_read_19())(ir_span(clause), (((ir_kind(test) === "literal") && (ir_value(test) === true)) ? emit_do(body) : combine(["(", emit_test(test), " ? ", emit_do(body), " : ", emit_cond((clauses)["slice"](1)), ")"])));
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
587
1838
|
}
|
|
588
1839
|
function emit_throw(node) {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
1840
|
+
{
|
|
1841
|
+
const __eliscript_value_177 = fresh_name();
|
|
1842
|
+
{
|
|
1843
|
+
let temporary = __eliscript_value_177;
|
|
1844
|
+
return combine(["((", temporary, ") => { throw ", temporary, "; })(", emit_expression(((((children(node)) ?? [])[0]) ?? null)), ")"]);
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
592
1847
|
}
|
|
593
1848
|
function emit_catch(node) {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
})(children(node));
|
|
1849
|
+
{
|
|
1850
|
+
let nodes = children(node);
|
|
1851
|
+
let binding = ((((nodes) ?? [])[0]) ?? null);
|
|
1852
|
+
let body = (nodes)["slice"](1);
|
|
1853
|
+
return (__eliscript_tdz_read_19())(ir_span(node), combine([" catch (", emit_binding_target(binding), ") {\n", indent((__eliscript_truthy(map_binding_pattern_p(binding)) ? combine([emit_binding_setup(binding), "\n", emit_returning_body(body)]) : emit_returning_body(body))), "\n}"]));
|
|
1854
|
+
}
|
|
601
1855
|
}
|
|
602
1856
|
function emit_finally(node) {
|
|
603
|
-
return
|
|
1857
|
+
return (__eliscript_tdz_read_19())(ir_span(node), combine([" finally {\n", indent(emit_statement_body(children(node))), "\n}"]));
|
|
604
1858
|
}
|
|
605
1859
|
function emit_try(node) {
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
}));
|
|
620
|
-
})(((((parts) ?? [])[1]) ?? null));
|
|
621
|
-
})(((((parts) ?? [])[0]) ?? null));
|
|
622
|
-
})(split_counted_children(node, "bodyCount"));
|
|
1860
|
+
{
|
|
1861
|
+
let parts = split_counted_children(node, "bodyCount");
|
|
1862
|
+
let body = ((((parts) ?? [])[0]) ?? null);
|
|
1863
|
+
let clauses = ((((parts) ?? [])[1]) ?? null);
|
|
1864
|
+
let catch_clause = (clauses)["find"](((clause) => {
|
|
1865
|
+
return (ir_kind(clause) === "catch-clause");
|
|
1866
|
+
}));
|
|
1867
|
+
let finally_clause = (clauses)["find"](((clause) => {
|
|
1868
|
+
return (ir_kind(clause) === "finally-clause");
|
|
1869
|
+
}));
|
|
1870
|
+
let try_block = combine(["try {\n", indent(emit_returning_body(body)), "\n}", (__eliscript_truthy(catch_clause) ? emit_catch(catch_clause) : ""), (__eliscript_truthy(finally_clause) ? emit_finally(finally_clause) : "")]);
|
|
1871
|
+
return emit_iife("", indent(try_block), "", contains_await_p(node));
|
|
1872
|
+
}
|
|
623
1873
|
}
|
|
624
1874
|
function emit_binding_values(bindings) {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
1875
|
+
{
|
|
1876
|
+
const __eliscript_value_178 = [];
|
|
1877
|
+
{
|
|
1878
|
+
let result = __eliscript_value_178;
|
|
1879
|
+
(bindings)["forEach"](((binding) => {
|
|
1880
|
+
{
|
|
1881
|
+
const __eliscript_value_179 = binding_initializer(binding);
|
|
1882
|
+
{
|
|
1883
|
+
let initializer = __eliscript_value_179;
|
|
1884
|
+
return (result)["push"]((__eliscript_truthy(initializer) ? emit_expression(initializer) : binding_default_value(binding)));
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
}));
|
|
1888
|
+
return result;
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
633
1891
|
}
|
|
634
1892
|
function emit_parallel_let(bindings, body) {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
return (
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
}
|
|
644
|
-
return emit_binding_target(binding);
|
|
645
|
-
}), ", "));
|
|
1893
|
+
{
|
|
1894
|
+
let names = join_fragments((bindings)["map"](((binding) => {
|
|
1895
|
+
return emit_binding_target(binding);
|
|
1896
|
+
})), ", ");
|
|
1897
|
+
let values = join_fragments(emit_binding_values(bindings), ", ");
|
|
1898
|
+
let setups = emit_binding_setups(bindings);
|
|
1899
|
+
let body_output = indent(((((setups)["text"])["length"] === 0) ? emit_returning_body(body) : combine([setups, "\n", emit_returning_body(body)])));
|
|
1900
|
+
return emit_iife(names, body_output, values, contains_await_p(body));
|
|
1901
|
+
}
|
|
646
1902
|
}
|
|
647
1903
|
function emit_sequential_let(bindings, body) {
|
|
648
|
-
|
|
649
|
-
return (
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
1904
|
+
if (((bindings)["length"] === 0)) {
|
|
1905
|
+
return emit_do(body);
|
|
1906
|
+
} else {
|
|
1907
|
+
{
|
|
1908
|
+
const __eliscript_value_180 = ((((bindings) ?? [])[0]) ?? null);
|
|
1909
|
+
{
|
|
1910
|
+
let binding = __eliscript_value_180;
|
|
1911
|
+
{
|
|
1912
|
+
let name = emit_binding_target(binding);
|
|
1913
|
+
let initializer = ((((emit_binding_values([binding])) ?? [])[0]) ?? null);
|
|
1914
|
+
let tail = emit_sequential_let((bindings)["slice"](1), body);
|
|
1915
|
+
return emit_iife(name, indent(combine([(__eliscript_truthy(map_binding_pattern_p(binding)) ? combine([emit_binding_setup(binding), "\n"]) : ""), "return ", tail, ";"])), initializer, ((__eliscript_value_181) => (__eliscript_truthy(__eliscript_value_181) ? __eliscript_value_181 : contains_await_p(body)))(contains_await_p((bindings)["slice"](1))));
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
657
1920
|
}
|
|
658
1921
|
function emit_let(node) {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
1922
|
+
{
|
|
1923
|
+
let parts = split_counted_children(node, "bindingCount");
|
|
1924
|
+
let bindings = ((((parts) ?? [])[0]) ?? null);
|
|
1925
|
+
let body = ((((parts) ?? [])[1]) ?? null);
|
|
1926
|
+
if (__eliscript_truthy(ir_property(node, "sequential"))) {
|
|
1927
|
+
return emit_sequential_let(bindings, body);
|
|
1928
|
+
} else {
|
|
1929
|
+
return emit_parallel_let(bindings, body);
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
666
1932
|
}
|
|
667
1933
|
function emit_assignment(node) {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
1934
|
+
{
|
|
1935
|
+
const __eliscript_value_182 = [];
|
|
1936
|
+
{
|
|
1937
|
+
let assignments = __eliscript_value_182;
|
|
1938
|
+
(children(node))["forEach"](((pair) => {
|
|
1939
|
+
return (assignments)["push"]((__eliscript_tdz_read_19())(ir_span(pair), tdz_assignment(pair)));
|
|
1940
|
+
}));
|
|
1941
|
+
if ((ir_value(node) === "set!")) {
|
|
1942
|
+
return ((((assignments) ?? [])[0]) ?? null);
|
|
1943
|
+
} else {
|
|
1944
|
+
return combine(["(", join_fragments(assignments, ", "), ")"]);
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
674
1948
|
}
|
|
675
1949
|
function emit_loop(node) {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
(body)["forEach"]((child) => {
|
|
683
|
-
return (statements)["push"](combine([emit_expression(child), ";"]));
|
|
684
|
-
});
|
|
685
|
-
return emit_iife("", indent(combine(["while (__eliscript_truthy(", test_output, ")) {\n", indent(join_fragments(statements, "\n")), "\n}\nreturn null;"])), "", contains_await_p(nodes));
|
|
686
|
-
})();
|
|
687
|
-
})([]);
|
|
688
|
-
})(emit_expression(test));
|
|
689
|
-
})((nodes)["slice"](1));
|
|
690
|
-
})(((((nodes) ?? [])[0]) ?? null));
|
|
691
|
-
})(children(node));
|
|
1950
|
+
{
|
|
1951
|
+
let nodes = children(node);
|
|
1952
|
+
let test_output = emit_test(((((nodes) ?? [])[0]) ?? null));
|
|
1953
|
+
let body = (nodes)["slice"](1);
|
|
1954
|
+
return emit_iife("", indent(combine(["while (", test_output, ") {\n", indent(emit_statement_body(body)), "\n}\nreturn null;"])), "", contains_await_p(nodes));
|
|
1955
|
+
}
|
|
692
1956
|
}
|
|
693
1957
|
function emit_binding_loop(node) {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
}), ", "));
|
|
710
|
-
})(({"kind": "loop", "bindings": bindings, "label": label}));
|
|
711
|
-
})(fresh_name());
|
|
712
|
-
})(((((parts) ?? [])[1]) ?? null));
|
|
713
|
-
})(((((parts) ?? [])[0]) ?? null));
|
|
714
|
-
})(split_counted_children(node, "bindingCount"));
|
|
1958
|
+
{
|
|
1959
|
+
let parts = split_counted_children(node, "bindingCount");
|
|
1960
|
+
let bindings = ((((parts) ?? [])[0]) ?? null);
|
|
1961
|
+
let body = ((((parts) ?? [])[1]) ?? null);
|
|
1962
|
+
let label = fresh_name();
|
|
1963
|
+
let target = ({"kind": "loop", "bindings": bindings, "label": label});
|
|
1964
|
+
let parameters = join_fragments((bindings)["map"](((binding) => {
|
|
1965
|
+
return emit_binding_target(binding);
|
|
1966
|
+
})), ", ");
|
|
1967
|
+
let initializers = join_fragments((bindings)["map"](((binding) => {
|
|
1968
|
+
return emit_expression(binding_initializer(binding));
|
|
1969
|
+
})), ", ");
|
|
1970
|
+
let setups = emit_binding_setups(bindings);
|
|
1971
|
+
return emit_iife(parameters, indent(combine([label, ": while (true) {\n", indent(((((setups)["text"])["length"] === 0) ? emit_tail_body(body, target) : combine([setups, "\n", emit_tail_body(body, target)]))), "\n}"])), initializers, contains_await_p(body));
|
|
1972
|
+
}
|
|
715
1973
|
}
|
|
716
1974
|
function emit_short_circuit(nodes, kind) {
|
|
717
|
-
|
|
718
|
-
return ((
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
1975
|
+
if (((nodes)["length"] === 0)) {
|
|
1976
|
+
return text_fragment(((kind === "and") ? "true" : "null"));
|
|
1977
|
+
} else {
|
|
1978
|
+
if (((nodes)["length"] === 1)) {
|
|
1979
|
+
return emit_expression(((((nodes) ?? [])[0]) ?? null));
|
|
1980
|
+
} else {
|
|
1981
|
+
if (__eliscript_truthy(((__eliscript_value_183) => (__eliscript_truthy(__eliscript_value_183) ? (!__eliscript_truthy(contains_await_p(nodes))) : __eliscript_value_183))((nodes)["every"](boolean_p)))) {
|
|
1982
|
+
return combine(["(", join_fragments((nodes)["map"](((node) => {
|
|
1983
|
+
return emit_expression(node);
|
|
1984
|
+
})), ((kind === "and") ? " && " : " || ")), ")"]);
|
|
1985
|
+
} else {
|
|
1986
|
+
{
|
|
1987
|
+
const __eliscript_value_184 = fresh_name();
|
|
1988
|
+
const __eliscript_value_185 = emit_expression(((((nodes) ?? [])[0]) ?? null));
|
|
1989
|
+
const __eliscript_value_186 = emit_short_circuit((nodes)["slice"](1), kind);
|
|
1990
|
+
{
|
|
1991
|
+
let temporary = __eliscript_value_184;
|
|
1992
|
+
let first = __eliscript_value_185;
|
|
1993
|
+
let rest = __eliscript_value_186;
|
|
1994
|
+
{
|
|
1995
|
+
const __eliscript_value_187 = combine(["(__eliscript_truthy(", temporary, ") ? ", ((kind === "and") ? rest : temporary), " : ", ((kind === "and") ? temporary : rest), ")"]);
|
|
1996
|
+
{
|
|
1997
|
+
let body = __eliscript_value_187;
|
|
1998
|
+
if (__eliscript_truthy(contains_await_p((nodes)["slice"](1)))) {
|
|
1999
|
+
return combine(["(await (async (", temporary, ") => ", body, ")(", first, "))"]);
|
|
2000
|
+
} else {
|
|
2001
|
+
return combine(["((", temporary, ") => ", body, ")(", first, ")"]);
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
function numeric_operator_tag(operator) {
|
|
2012
|
+
if ((operator === "-")) {
|
|
2013
|
+
return "sub";
|
|
2014
|
+
} else {
|
|
2015
|
+
if ((operator === "*")) {
|
|
2016
|
+
return "mul";
|
|
2017
|
+
} else {
|
|
2018
|
+
if ((operator === "/")) {
|
|
2019
|
+
return "div";
|
|
2020
|
+
} else {
|
|
2021
|
+
if ((operator === "%")) {
|
|
2022
|
+
return "rem";
|
|
2023
|
+
} else {
|
|
2024
|
+
if ((operator === "&")) {
|
|
2025
|
+
return "and";
|
|
2026
|
+
} else {
|
|
2027
|
+
if ((operator === "|")) {
|
|
2028
|
+
return "or";
|
|
2029
|
+
} else {
|
|
2030
|
+
if ((operator === "^")) {
|
|
2031
|
+
return "xor";
|
|
2032
|
+
} else {
|
|
2033
|
+
if ((operator === "<<")) {
|
|
2034
|
+
return "shl";
|
|
2035
|
+
} else {
|
|
2036
|
+
if ((operator === ">>")) {
|
|
2037
|
+
return "shr";
|
|
2038
|
+
} else {
|
|
2039
|
+
if ((operator === ">>>")) {
|
|
2040
|
+
return "ushr";
|
|
2041
|
+
} else {
|
|
2042
|
+
if ((operator === "imul")) {
|
|
2043
|
+
return "imul";
|
|
2044
|
+
} else {
|
|
2045
|
+
return null;
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
function relational_operator_p(operator) {
|
|
2059
|
+
return ((operator === "<") || (operator === "<=") || (operator === ">") || (operator === ">="));
|
|
2060
|
+
}
|
|
2061
|
+
function emit_numeric_binary(operator, left, right) {
|
|
2062
|
+
if (__eliscript_truthy((__eliscript_tdz_read_14()))) {
|
|
2063
|
+
return combine(["(", left, " ", operator, " ", right, ")"]);
|
|
2064
|
+
} else {
|
|
2065
|
+
if (((operator === "-") && ((as_fragment(right))["text"] === "1"))) {
|
|
2066
|
+
return combine(["__eliscript_numeric_decrement(", left, ")"]);
|
|
2067
|
+
} else {
|
|
2068
|
+
if (__eliscript_truthy(relational_operator_p(operator))) {
|
|
2069
|
+
return combine(["__eliscript_numeric_relation(", json_string(operator), ", ", left, ", ", right, ")"]);
|
|
2070
|
+
} else {
|
|
2071
|
+
{
|
|
2072
|
+
const __eliscript_value_188 = numeric_operator_tag(operator);
|
|
2073
|
+
{
|
|
2074
|
+
let tag = __eliscript_value_188;
|
|
2075
|
+
if (__eliscript_truthy(tag)) {
|
|
2076
|
+
return combine(["__eliscript_numeric_", tag, "(", left, ", ", right, ")"]);
|
|
2077
|
+
} else {
|
|
2078
|
+
return combine(["(", left, " ", operator, " ", right, ")"]);
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
function emit_numeric_unary(tag, operand) {
|
|
2087
|
+
return combine(["__eliscript_numeric_", tag, "(", emit_expression(operand), ")"]);
|
|
2088
|
+
}
|
|
2089
|
+
function numeric_coercion_intrinsic_p(name) {
|
|
2090
|
+
return ((__eliscript_value_189) => (__eliscript_truthy(__eliscript_value_189) ? __eliscript_value_189 : ((__eliscript_value_190) => (__eliscript_truthy(__eliscript_value_190) ? __eliscript_value_190 : ((name === "mod") || (name === "1-") || (name === "int32") || (name === "uint32") || (name === "imul32") || (name === "bit-not") || (name === "bit-and") || (name === "bit-or") || (name === "bit-xor") || (name === "bit-shift-left") || (name === "bit-shift-right") || (name === "unsigned-bit-shift-right"))))(relational_operator_p(name))))(numeric_operator_tag(name));
|
|
722
2091
|
}
|
|
723
2092
|
function emit_infix(name, nodes, operator, minimum) {
|
|
724
2093
|
require_arity(name, nodes, minimum, null);
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
2094
|
+
if (__eliscript_truthy(((__eliscript_value_191) => (__eliscript_truthy(__eliscript_value_191) ? ((__eliscript_value_192) => (__eliscript_truthy(__eliscript_value_192) ? __eliscript_numeric_relation(">", ((nodes) ?? []).length, 1) : __eliscript_value_192))(numeric_operator_tag(operator)) : __eliscript_value_191))((!__eliscript_truthy((__eliscript_tdz_read_14())))))) {
|
|
2095
|
+
{
|
|
2096
|
+
const __eliscript_value_193 = emit_expression(((((nodes) ?? [])[0]) ?? null));
|
|
2097
|
+
const __eliscript_value_194 = 1;
|
|
2098
|
+
{
|
|
2099
|
+
let result = __eliscript_value_193;
|
|
2100
|
+
let index = __eliscript_value_194;
|
|
2101
|
+
while (__eliscript_numeric_relation("<", index, ((nodes) ?? []).length)) {
|
|
2102
|
+
((result = emit_numeric_binary(operator, result, emit_expression(((((nodes) ?? [])[index]) ?? null)))));
|
|
2103
|
+
((index = (index + 1)));
|
|
2104
|
+
}
|
|
2105
|
+
return result;
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
} else {
|
|
2109
|
+
return combine(["(", join_fragments((nodes)["map"](((node) => {
|
|
2110
|
+
return emit_expression(node);
|
|
2111
|
+
})), (String(" ") + String(operator) + String(" "))), ")"]);
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
function emit_binary_infix(node, operator) {
|
|
2115
|
+
require_node_arity(node, 2, 2);
|
|
2116
|
+
{
|
|
2117
|
+
const __eliscript_value_195 = children(node);
|
|
2118
|
+
{
|
|
2119
|
+
let nodes = __eliscript_value_195;
|
|
2120
|
+
return emit_numeric_binary(operator, emit_expression(((((nodes) ?? [])[0]) ?? null)), emit_expression(((((nodes) ?? [])[1]) ?? null)));
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
732
2123
|
}
|
|
733
2124
|
function temporary_names(nodes) {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
2125
|
+
{
|
|
2126
|
+
const __eliscript_value_196 = [];
|
|
2127
|
+
{
|
|
2128
|
+
let result = __eliscript_value_196;
|
|
2129
|
+
(nodes)["forEach"](((_node) => {
|
|
2130
|
+
return (result)["push"](fresh_name());
|
|
2131
|
+
}));
|
|
2132
|
+
return result;
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
740
2135
|
}
|
|
741
2136
|
function emit_comparison(name, nodes, operator) {
|
|
742
2137
|
require_arity(name, nodes, 2, null);
|
|
743
|
-
|
|
744
|
-
(()
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
2138
|
+
if (((nodes)["length"] === 2)) {
|
|
2139
|
+
return emit_numeric_binary(operator, emit_expression(((((nodes) ?? [])[0]) ?? null)), emit_expression(((((nodes) ?? [])[1]) ?? null)));
|
|
2140
|
+
} else {
|
|
2141
|
+
{
|
|
2142
|
+
const __eliscript_value_197 = temporary_names(nodes);
|
|
2143
|
+
const __eliscript_value_198 = [];
|
|
2144
|
+
const __eliscript_value_199 = 0;
|
|
2145
|
+
{
|
|
2146
|
+
let parameters = __eliscript_value_197;
|
|
2147
|
+
let comparisons = __eliscript_value_198;
|
|
2148
|
+
let index = __eliscript_value_199;
|
|
2149
|
+
while (__eliscript_numeric_relation("<", index, __eliscript_numeric_decrement((parameters)["length"]))) {
|
|
2150
|
+
(comparisons)["push"]((__eliscript_truthy(((__eliscript_value_200) => (__eliscript_truthy(__eliscript_value_200) ? relational_operator_p(operator) : __eliscript_value_200))((!__eliscript_truthy((__eliscript_tdz_read_14()))))) ? (String("__eliscript_numeric_relation(") + String(json_string(operator)) + String(", ") + String(((((parameters) ?? [])[index]) ?? null)) + String(", ") + String(((((parameters) ?? [])[(index + 1)]) ?? null)) + String(")")) : (String(((((parameters) ?? [])[index]) ?? null)) + String(" ") + String(operator) + String(" ") + String(((((parameters) ?? [])[(index + 1)]) ?? null)))));
|
|
2151
|
+
((index = (index + 1)));
|
|
2152
|
+
}
|
|
2153
|
+
return combine(["((", __eliscript_at_direct(parameters, "join", ", "), ") => (", __eliscript_at_direct(comparisons, "join", " && "), "))(", emit_arguments(nodes), ")"]);
|
|
748
2154
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
return combine(["((", (parameters)["join"](", "), ") => (", (comparisons)["join"](" && "), "))(", emit_arguments(nodes), ")"]);
|
|
752
|
-
})(temporary_names(nodes), [], 0));
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
753
2157
|
}
|
|
754
2158
|
function emit_distinct(name, nodes) {
|
|
755
2159
|
require_arity(name, nodes, 2, null);
|
|
756
|
-
|
|
757
|
-
(
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
2160
|
+
{
|
|
2161
|
+
const __eliscript_value_201 = temporary_names(nodes);
|
|
2162
|
+
const __eliscript_value_202 = [];
|
|
2163
|
+
const __eliscript_value_203 = 0;
|
|
2164
|
+
{
|
|
2165
|
+
let parameters = __eliscript_value_201;
|
|
2166
|
+
let comparisons = __eliscript_value_202;
|
|
2167
|
+
let left = __eliscript_value_203;
|
|
2168
|
+
while (__eliscript_numeric_relation("<", left, (parameters)["length"])) {
|
|
2169
|
+
{
|
|
2170
|
+
const __eliscript_value_204 = (left + 1);
|
|
2171
|
+
{
|
|
2172
|
+
let right = __eliscript_value_204;
|
|
2173
|
+
while (__eliscript_numeric_relation("<", right, (parameters)["length"])) {
|
|
762
2174
|
(comparisons)["push"]((String(((((parameters) ?? [])[left]) ?? null)) + String(" !== ") + String(((((parameters) ?? [])[right]) ?? null))));
|
|
763
2175
|
((right = (right + 1)));
|
|
764
2176
|
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
})((left + 1));
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
768
2179
|
((left = (left + 1)));
|
|
769
2180
|
}
|
|
770
|
-
return
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
})(temporary_names(nodes), [], 0);
|
|
2181
|
+
return combine(["((", __eliscript_at_direct(parameters, "join", ", "), ") => (", __eliscript_at_direct(comparisons, "join", " && "), "))(", emit_arguments(nodes), ")"]);
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
774
2184
|
}
|
|
775
2185
|
function emit_intrinsic(node) {
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
2186
|
+
{
|
|
2187
|
+
const __eliscript_value_205 = ir_value(node);
|
|
2188
|
+
const __eliscript_value_206 = children(node);
|
|
2189
|
+
{
|
|
2190
|
+
let name = __eliscript_value_205;
|
|
2191
|
+
let nodes = __eliscript_value_206;
|
|
2192
|
+
if ((name === "not")) {
|
|
2193
|
+
require_node_arity(node, 1, 1);
|
|
2194
|
+
return combine(["(!", emit_test(((((nodes) ?? [])[0]) ?? null)), ")"]);
|
|
2195
|
+
} else {
|
|
2196
|
+
if ((name === "+")) {
|
|
2197
|
+
if (((nodes)["length"] === 0)) {
|
|
2198
|
+
return text_fragment("0");
|
|
2199
|
+
} else {
|
|
2200
|
+
return combine(["(", join_fragments((nodes)["map"](((node) => {
|
|
2201
|
+
return emit_expression(node);
|
|
2202
|
+
})), " + "), ")"]);
|
|
2203
|
+
}
|
|
2204
|
+
} else {
|
|
2205
|
+
if ((name === "*")) {
|
|
2206
|
+
if (((nodes)["length"] === 0)) {
|
|
2207
|
+
return text_fragment("1");
|
|
2208
|
+
} else {
|
|
2209
|
+
return emit_infix(name, nodes, "*", 1);
|
|
2210
|
+
}
|
|
2211
|
+
} else {
|
|
2212
|
+
if ((name === "-")) {
|
|
2213
|
+
require_node_arity(node, 1, null);
|
|
2214
|
+
if (((nodes)["length"] === 1)) {
|
|
2215
|
+
if (__eliscript_truthy((__eliscript_tdz_read_14()))) {
|
|
2216
|
+
return combine(["(-", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")"]);
|
|
2217
|
+
} else {
|
|
2218
|
+
return emit_numeric_unary("neg", ((((nodes) ?? [])[0]) ?? null));
|
|
2219
|
+
}
|
|
2220
|
+
} else {
|
|
2221
|
+
return emit_infix("-", nodes, "-", 2);
|
|
2222
|
+
}
|
|
2223
|
+
} else {
|
|
2224
|
+
if ((name === "/")) {
|
|
2225
|
+
require_node_arity(node, 1, null);
|
|
2226
|
+
if (((nodes)["length"] === 1)) {
|
|
2227
|
+
return emit_numeric_binary("/", text_fragment("1"), emit_expression(((((nodes) ?? [])[0]) ?? null)));
|
|
2228
|
+
} else {
|
|
2229
|
+
return emit_infix("/", nodes, "/", 2);
|
|
2230
|
+
}
|
|
2231
|
+
} else {
|
|
2232
|
+
if (((name === "%") || (name === "mod"))) {
|
|
2233
|
+
return emit_infix(name, nodes, "%", 2);
|
|
2234
|
+
} else {
|
|
2235
|
+
if ((name === "int32")) {
|
|
2236
|
+
require_node_arity(node, 1, 1);
|
|
2237
|
+
if (__eliscript_truthy((__eliscript_tdz_read_14()))) {
|
|
2238
|
+
return combine(["(", emit_expression(((((nodes) ?? [])[0]) ?? null)), " | 0)"]);
|
|
2239
|
+
} else {
|
|
2240
|
+
return emit_numeric_unary("int32", ((((nodes) ?? [])[0]) ?? null));
|
|
2241
|
+
}
|
|
2242
|
+
} else {
|
|
2243
|
+
if ((name === "uint32")) {
|
|
2244
|
+
require_node_arity(node, 1, 1);
|
|
2245
|
+
if (__eliscript_truthy((__eliscript_tdz_read_14()))) {
|
|
2246
|
+
return combine(["(", emit_expression(((((nodes) ?? [])[0]) ?? null)), " >>> 0)"]);
|
|
2247
|
+
} else {
|
|
2248
|
+
return emit_numeric_unary("uint32", ((((nodes) ?? [])[0]) ?? null));
|
|
2249
|
+
}
|
|
2250
|
+
} else {
|
|
2251
|
+
if ((name === "imul32")) {
|
|
2252
|
+
require_node_arity(node, 2, 2);
|
|
2253
|
+
if (__eliscript_truthy((__eliscript_tdz_read_14()))) {
|
|
2254
|
+
return combine(["Math.imul(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ", ", emit_expression(((((nodes) ?? [])[1]) ?? null)), ")"]);
|
|
2255
|
+
} else {
|
|
2256
|
+
return emit_numeric_binary("imul", emit_expression(((((nodes) ?? [])[0]) ?? null)), emit_expression(((((nodes) ?? [])[1]) ?? null)));
|
|
2257
|
+
}
|
|
2258
|
+
} else {
|
|
2259
|
+
if ((name === "bit-and")) {
|
|
2260
|
+
return emit_binary_infix(node, "&");
|
|
2261
|
+
} else {
|
|
2262
|
+
if ((name === "bit-or")) {
|
|
2263
|
+
return emit_binary_infix(node, "|");
|
|
2264
|
+
} else {
|
|
2265
|
+
if ((name === "bit-xor")) {
|
|
2266
|
+
return emit_binary_infix(node, "^");
|
|
2267
|
+
} else {
|
|
2268
|
+
if ((name === "bit-not")) {
|
|
2269
|
+
require_node_arity(node, 1, 1);
|
|
2270
|
+
if (__eliscript_truthy((__eliscript_tdz_read_14()))) {
|
|
2271
|
+
return combine(["(~", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")"]);
|
|
2272
|
+
} else {
|
|
2273
|
+
return emit_numeric_unary("not", ((((nodes) ?? [])[0]) ?? null));
|
|
2274
|
+
}
|
|
2275
|
+
} else {
|
|
2276
|
+
if ((name === "bit-shift-left")) {
|
|
2277
|
+
return emit_binary_infix(node, "<<");
|
|
2278
|
+
} else {
|
|
2279
|
+
if ((name === "bit-shift-right")) {
|
|
2280
|
+
return emit_binary_infix(node, ">>");
|
|
2281
|
+
} else {
|
|
2282
|
+
if ((name === "unsigned-bit-shift-right")) {
|
|
2283
|
+
return emit_binary_infix(node, ">>>");
|
|
2284
|
+
} else {
|
|
2285
|
+
if ((name === "value-type")) {
|
|
2286
|
+
require_node_arity(node, 1, 1);
|
|
2287
|
+
return combine(["((__eliscript_value) => { if (__eliscript_value === null) return \"null\"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== \"object\" && __eliscript_host_type !== \"function\") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for(\"eliscript.value.type\")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, \"value\") && (__eliscript_type.value === \"keyword\" || __eliscript_type.value === \"symbol\")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, \"kind\"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, \"value\")) { if (__eliscript_kind.value === \"eliscript/keyword\") return \"keyword\"; if (__eliscript_kind.value === \"eliscript/symbol\") return \"symbol\"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")"]);
|
|
2288
|
+
} else {
|
|
2289
|
+
if ((name === "host-identity-token")) {
|
|
2290
|
+
require_node_arity(node, 1, 1);
|
|
2291
|
+
return combine(["__eliscript_host_identity_token(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")"]);
|
|
2292
|
+
} else {
|
|
2293
|
+
if ((name === "string-code-unit-at")) {
|
|
2294
|
+
require_node_arity(node, 2, 2);
|
|
2295
|
+
return combine(["(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ").charCodeAt(", emit_expression(((((nodes) ?? [])[1]) ?? null)), ")"]);
|
|
2296
|
+
} else {
|
|
2297
|
+
if ((name === "string-from-code-unit")) {
|
|
2298
|
+
require_node_arity(node, 1, 1);
|
|
2299
|
+
return combine(["String.fromCharCode(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")"]);
|
|
2300
|
+
} else {
|
|
2301
|
+
if ((name === "string-to-number")) {
|
|
2302
|
+
require_node_arity(node, 1, 1);
|
|
2303
|
+
return combine(["__eliscript_to_number(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")"]);
|
|
2304
|
+
} else {
|
|
2305
|
+
if ((name === "string-to-bigint")) {
|
|
2306
|
+
require_node_arity(node, 1, 1);
|
|
2307
|
+
return combine(["((__eliscript_text) => { try { return BigInt(__eliscript_text); } catch { return null; } })(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")"]);
|
|
2308
|
+
} else {
|
|
2309
|
+
if ((name === "number-float64-words")) {
|
|
2310
|
+
require_node_arity(node, 1, 1);
|
|
2311
|
+
return combine(["((__eliscript_number) => { const __eliscript_bytes = new DataView(new ArrayBuffer(8)); __eliscript_bytes.setFloat64(0, __eliscript_number === 0 ? 0 : __eliscript_number, true); return [__eliscript_bytes.getUint32(0, true), __eliscript_bytes.getUint32(4, true)]; })(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")"]);
|
|
2312
|
+
} else {
|
|
2313
|
+
if ((name === "=")) {
|
|
2314
|
+
return emit_comparison(name, nodes, "===");
|
|
2315
|
+
} else {
|
|
2316
|
+
if (((name === "/=") || (name === "not="))) {
|
|
2317
|
+
return emit_distinct(name, nodes);
|
|
2318
|
+
} else {
|
|
2319
|
+
if ((name === "<")) {
|
|
2320
|
+
return emit_comparison(name, nodes, "<");
|
|
2321
|
+
} else {
|
|
2322
|
+
if ((name === "<=")) {
|
|
2323
|
+
return emit_comparison(name, nodes, "<=");
|
|
2324
|
+
} else {
|
|
2325
|
+
if ((name === ">")) {
|
|
2326
|
+
return emit_comparison(name, nodes, ">");
|
|
2327
|
+
} else {
|
|
2328
|
+
if ((name === ">=")) {
|
|
2329
|
+
return emit_comparison(name, nodes, ">=");
|
|
2330
|
+
} else {
|
|
2331
|
+
if ((name === "1+")) {
|
|
2332
|
+
require_node_arity(node, 1, 1);
|
|
2333
|
+
return combine(["(", emit_expression(((((nodes) ?? [])[0]) ?? null)), " + 1)"]);
|
|
2334
|
+
} else {
|
|
2335
|
+
if ((name === "1-")) {
|
|
2336
|
+
require_node_arity(node, 1, 1);
|
|
2337
|
+
return emit_numeric_binary("-", emit_expression(((((nodes) ?? [])[0]) ?? null)), text_fragment("1"));
|
|
2338
|
+
} else {
|
|
2339
|
+
if ((name === "eq")) {
|
|
2340
|
+
require_node_arity(node, 2, 2);
|
|
2341
|
+
return combine(["(", emit_expression(((((nodes) ?? [])[0]) ?? null)), " === ", emit_expression(((((nodes) ?? [])[1]) ?? null)), ")"]);
|
|
2342
|
+
} else {
|
|
2343
|
+
if ((name === "equal")) {
|
|
2344
|
+
require_node_arity(node, 2, 2);
|
|
2345
|
+
return combine(["__eliscript_equal(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ", ", emit_expression(((((nodes) ?? [])[1]) ?? null)), ")"]);
|
|
2346
|
+
} else {
|
|
2347
|
+
if ((name === "nil?")) {
|
|
2348
|
+
require_node_arity(node, 1, 1);
|
|
2349
|
+
return combine(["(", emit_expression(((((nodes) ?? [])[0]) ?? null)), " === null)"]);
|
|
2350
|
+
} else {
|
|
2351
|
+
if ((name === "undefined?")) {
|
|
2352
|
+
require_node_arity(node, 1, 1);
|
|
2353
|
+
return combine(["(", emit_expression(((((nodes) ?? [])[0]) ?? null)), " === undefined)"]);
|
|
2354
|
+
} else {
|
|
2355
|
+
if (((name === "null") || (name === "nullish?"))) {
|
|
2356
|
+
require_node_arity(node, 1, 1);
|
|
2357
|
+
return combine(["(", emit_expression(((((nodes) ?? [])[0]) ?? null)), " == null)"]);
|
|
2358
|
+
} else {
|
|
2359
|
+
if ((name === "js-array")) {
|
|
2360
|
+
return combine(["[", emit_arguments(nodes), "]"]);
|
|
2361
|
+
} else {
|
|
2362
|
+
if ((name === "car")) {
|
|
2363
|
+
require_node_arity(node, 1, 1);
|
|
2364
|
+
return combine(["__eliscript_first(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")"]);
|
|
2365
|
+
} else {
|
|
2366
|
+
if ((name === "cdr")) {
|
|
2367
|
+
require_node_arity(node, 1, 1);
|
|
2368
|
+
return combine(["__eliscript_rest(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")"]);
|
|
2369
|
+
} else {
|
|
2370
|
+
if ((name === "cons")) {
|
|
2371
|
+
require_node_arity(node, 2, 2);
|
|
2372
|
+
return combine(["__eliscript_cons(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ", ", emit_expression(((((nodes) ?? [])[1]) ?? null)), ")"]);
|
|
2373
|
+
} else {
|
|
2374
|
+
if ((name === "js-cons")) {
|
|
2375
|
+
require_node_arity(node, 2, 2);
|
|
2376
|
+
return combine(["[", emit_expression(((((nodes) ?? [])[0]) ?? null)), ", ...((", emit_expression(((((nodes) ?? [])[1]) ?? null)), ") ?? [])]"]);
|
|
2377
|
+
} else {
|
|
2378
|
+
if ((name === "nth")) {
|
|
2379
|
+
require_node_arity(node, 2, 2);
|
|
2380
|
+
return combine(["__eliscript_nth(", emit_expression(((((nodes) ?? [])[1]) ?? null)), ", ", emit_expression(((((nodes) ?? [])[0]) ?? null)), ", null)"]);
|
|
2381
|
+
} else {
|
|
2382
|
+
if ((name === "js-nth")) {
|
|
2383
|
+
require_node_arity(node, 2, 2);
|
|
2384
|
+
return combine(["((((", emit_expression(((((nodes) ?? [])[1]) ?? null)), ") ?? [])[", emit_expression(((((nodes) ?? [])[0]) ?? null)), "]) ?? null)"]);
|
|
2385
|
+
} else {
|
|
2386
|
+
if ((name === "aref")) {
|
|
2387
|
+
require_node_arity(node, 2, 2);
|
|
2388
|
+
return combine(["(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")[", emit_property_key(((((nodes) ?? [])[1]) ?? null)), "]"]);
|
|
2389
|
+
} else {
|
|
2390
|
+
if ((name === "length")) {
|
|
2391
|
+
require_node_arity(node, 1, 1);
|
|
2392
|
+
return combine(["__eliscript_count(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")"]);
|
|
2393
|
+
} else {
|
|
2394
|
+
if ((name === "js-length")) {
|
|
2395
|
+
require_node_arity(node, 1, 1);
|
|
2396
|
+
return combine(["((", emit_expression(((((nodes) ?? [])[0]) ?? null)), ") ?? []).length"]);
|
|
2397
|
+
} else {
|
|
2398
|
+
if ((name === "__eliscript_arity_error")) {
|
|
2399
|
+
require_node_arity(node, 2, 2);
|
|
2400
|
+
return combine(["((label, arity) => { throw new TypeError(label + \" received unsupported arity: \" + arity); })(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ", ", emit_expression(((((nodes) ?? [])[1]) ?? null)), ")"]);
|
|
2401
|
+
} else {
|
|
2402
|
+
if ((name === "object-keys")) {
|
|
2403
|
+
require_node_arity(node, 1, 1);
|
|
2404
|
+
return combine(["Object.keys((", emit_expression(((((nodes) ?? [])[0]) ?? null)), ") ?? {})"]);
|
|
2405
|
+
} else {
|
|
2406
|
+
if ((name === "object-has?")) {
|
|
2407
|
+
require_node_arity(node, 2, 2);
|
|
2408
|
+
return combine(["Object.prototype.hasOwnProperty.call((", emit_expression(((((nodes) ?? [])[0]) ?? null)), ") ?? {}, ", emit_property_key(((((nodes) ?? [])[1]) ?? null)), ")"]);
|
|
2409
|
+
} else {
|
|
2410
|
+
if ((name === "object-assoc")) {
|
|
2411
|
+
require_node_arity(node, 3, 3);
|
|
2412
|
+
return combine(["({...((", emit_expression(((((nodes) ?? [])[0]) ?? null)), ") ?? {}), [", emit_property_key(((((nodes) ?? [])[1]) ?? null)), "]: ", emit_expression(((((nodes) ?? [])[2]) ?? null)), "})"]);
|
|
2413
|
+
} else {
|
|
2414
|
+
return (__eliscript_tdz_read_16())((String("unknown IR intrinsic: ") + String(name)));
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
885
2467
|
}
|
|
886
2468
|
function emit_object_properties(properties) {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
2469
|
+
{
|
|
2470
|
+
const __eliscript_value_207 = [];
|
|
2471
|
+
{
|
|
2472
|
+
let result = __eliscript_value_207;
|
|
2473
|
+
(properties)["forEach"](((property) => {
|
|
2474
|
+
{
|
|
2475
|
+
const __eliscript_value_208 = children(property);
|
|
2476
|
+
{
|
|
2477
|
+
let nodes = __eliscript_value_208;
|
|
2478
|
+
return (result)["push"]((__eliscript_tdz_read_19())(ir_span(property), (__eliscript_truthy(ir_property(property, "computed")) ? combine(["[", emit_expression(((((nodes) ?? [])[0]) ?? null)), "]: ", emit_expression(((((nodes) ?? [])[1]) ?? null))]) : combine([json_string(ir_value(property)), ": ", emit_expression(((((nodes) ?? [])[0]) ?? null))]))));
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
}));
|
|
2482
|
+
return join_fragments(result, ", ");
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
895
2485
|
}
|
|
896
2486
|
function emit_object(node) {
|
|
897
2487
|
return combine(["({", emit_object_properties(children(node)), "})"]);
|
|
@@ -900,274 +2490,858 @@ function literal_kind(node) {
|
|
|
900
2490
|
return ir_property(node, "literalKind");
|
|
901
2491
|
}
|
|
902
2492
|
function emit_literal(node) {
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
2493
|
+
{
|
|
2494
|
+
const __eliscript_value_209 = ir_value(node);
|
|
2495
|
+
const __eliscript_value_210 = literal_kind(node);
|
|
2496
|
+
{
|
|
2497
|
+
let value = __eliscript_value_209;
|
|
2498
|
+
let kind = __eliscript_value_210;
|
|
2499
|
+
if ((kind === "undefined")) {
|
|
2500
|
+
return text_fragment("undefined");
|
|
2501
|
+
} else {
|
|
2502
|
+
if ((kind === "keyword")) {
|
|
2503
|
+
return combine(["__eliscript_keyword(", json_string(value), ")"]);
|
|
2504
|
+
} else {
|
|
2505
|
+
if ((value == null)) {
|
|
2506
|
+
return text_fragment("null");
|
|
2507
|
+
} else {
|
|
2508
|
+
if ((value === true)) {
|
|
2509
|
+
return text_fragment("true");
|
|
2510
|
+
} else {
|
|
2511
|
+
if ((value === false)) {
|
|
2512
|
+
return text_fragment("false");
|
|
2513
|
+
} else {
|
|
2514
|
+
if ((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(value) === "number")) {
|
|
2515
|
+
if ((!__eliscript_truthy(Number.isFinite(value)))) {
|
|
2516
|
+
(__eliscript_tdz_read_16())((String("non-finite numbers are not supported: ") + String(value)));
|
|
2517
|
+
}
|
|
2518
|
+
return text_fragment((((value === 0) && __eliscript_numeric_relation("<", __eliscript_numeric_div(1, value), 0)) ? "-0.0" : (String(value))));
|
|
2519
|
+
} else {
|
|
2520
|
+
if ((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(value) === "string")) {
|
|
2521
|
+
return text_fragment(json_string(value));
|
|
2522
|
+
} else {
|
|
2523
|
+
return (__eliscript_tdz_read_16())((String("unsupported IR literal: ") + String(value)));
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
909
2533
|
}
|
|
910
2534
|
function datum_kind(value) {
|
|
911
|
-
return ((
|
|
2535
|
+
return ((__eliscript_value_211) => (__eliscript_truthy(__eliscript_value_211) ? ((__eliscript_value_212) => (__eliscript_truthy(__eliscript_value_212) ? (value)["kind"] : __eliscript_value_212))((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(value) === "object")) : __eliscript_value_211))(value);
|
|
912
2536
|
}
|
|
913
2537
|
function emit_quoted(value) {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
2538
|
+
{
|
|
2539
|
+
const __eliscript_value_213 = datum_kind(value);
|
|
2540
|
+
{
|
|
2541
|
+
let kind = __eliscript_value_213;
|
|
2542
|
+
if ((value == null)) {
|
|
2543
|
+
return text_fragment("__eliscript_list()");
|
|
2544
|
+
} else {
|
|
2545
|
+
if ((value === true)) {
|
|
2546
|
+
return text_fragment("true");
|
|
2547
|
+
} else {
|
|
2548
|
+
if ((value === false)) {
|
|
2549
|
+
return text_fragment("__eliscript_symbol(\"false\")");
|
|
2550
|
+
} else {
|
|
2551
|
+
if ((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(value) === "number")) {
|
|
2552
|
+
return text_fragment((((value === 0) && __eliscript_numeric_relation("<", __eliscript_numeric_div(1, value), 0)) ? "-0.0" : (String(value))));
|
|
2553
|
+
} else {
|
|
2554
|
+
if ((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(value) === "string")) {
|
|
2555
|
+
return text_fragment(json_string(value));
|
|
2556
|
+
} else {
|
|
2557
|
+
if ((kind === "undefined")) {
|
|
2558
|
+
return text_fragment("undefined");
|
|
2559
|
+
} else {
|
|
2560
|
+
if ((kind === "symbol")) {
|
|
2561
|
+
return combine(["__eliscript_symbol(", text_fragment(json_string((value)["name"])), ")"]);
|
|
2562
|
+
} else {
|
|
2563
|
+
if ((kind === "keyword")) {
|
|
2564
|
+
return combine(["__eliscript_keyword(", text_fragment(json_string((value)["name"])), ")"]);
|
|
2565
|
+
} else {
|
|
2566
|
+
if ((kind === "list")) {
|
|
2567
|
+
return combine(["__eliscript_list(", join_fragments(((value)["items"])["map"](((item) => {
|
|
2568
|
+
return emit_quoted(item);
|
|
2569
|
+
})), ", "), ")"]);
|
|
2570
|
+
} else {
|
|
2571
|
+
if ((kind === "vector")) {
|
|
2572
|
+
return combine(["__eliscript_vector(", join_fragments(((value)["items"])["map"](((item) => {
|
|
2573
|
+
return emit_quoted(item);
|
|
2574
|
+
})), ", "), ")"]);
|
|
2575
|
+
} else {
|
|
2576
|
+
return (__eliscript_tdz_read_16())("cannot emit quoted IR datum");
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
921
2589
|
}
|
|
922
2590
|
function quoted_uses_literal_runtime_p(value) {
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
2591
|
+
{
|
|
2592
|
+
const __eliscript_value_214 = datum_kind(value);
|
|
2593
|
+
{
|
|
2594
|
+
let kind = __eliscript_value_214;
|
|
2595
|
+
return ((value == null) || (value === false) || (kind === "symbol") || (kind === "keyword") || (kind === "list") || (kind === "vector"));
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
926
2598
|
}
|
|
927
2599
|
function emit_property_key(node) {
|
|
928
|
-
return
|
|
2600
|
+
return (__eliscript_tdz_read_19())(ir_span(node), (((ir_kind(node) === "literal") && ((literal_kind(node) === "keyword") || (((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })((node)["value"]) === "string"))) ? text_fragment(json_string(ir_value(node))) : emit_expression(node)));
|
|
2601
|
+
}
|
|
2602
|
+
function array_text_key_p(node) {
|
|
2603
|
+
return ((!(ir_kind(node) === "literal")) || (ir_value(node) === "join") || (ir_value(node) === "toString") || (ir_value(node) === "call") || (ir_value(node) === "apply") || (ir_value(node) === "bind"));
|
|
2604
|
+
}
|
|
2605
|
+
function primitive_literal_arguments_p(nodes) {
|
|
2606
|
+
return (nodes)["every"](((node) => {
|
|
2607
|
+
return ((ir_kind(node) === "literal") && (!(literal_kind(node) === "keyword")));
|
|
2608
|
+
}));
|
|
929
2609
|
}
|
|
930
2610
|
function emit_expression(node) {
|
|
931
|
-
(
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
(nodes)["
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
2611
|
+
if ((!__eliscript_truthy(node_p(node)))) {
|
|
2612
|
+
(__eliscript_tdz_read_16())("expected an IR expression node");
|
|
2613
|
+
}
|
|
2614
|
+
{
|
|
2615
|
+
const __eliscript_value_215 = ir_kind(node);
|
|
2616
|
+
const __eliscript_value_216 = children(node);
|
|
2617
|
+
{
|
|
2618
|
+
let kind = __eliscript_value_215;
|
|
2619
|
+
let nodes = __eliscript_value_216;
|
|
2620
|
+
return (__eliscript_tdz_read_19())(ir_span(node), ((kind === "literal") ? emit_literal(node) : ((kind === "reference") ? tdz_read(node) : ((kind === "array-literal") ? combine(["[", emit_arguments(nodes), "]"]) : ((kind === "persistent-list-literal") ? combine(["__eliscript_list(", emit_arguments(nodes), ")"]) : ((kind === "persistent-vector-literal") ? combine(["__eliscript_vector(", emit_arguments(nodes), ")"]) : ((kind === "persistent-map-literal") ? combine(["__eliscript_hash_map(", emit_arguments(nodes), ")"]) : ((kind === "persistent-set-literal") ? combine(["__eliscript_hash_set(", emit_arguments(nodes), ")"]) : ((kind === "persistent-queue-literal") ? combine(["__eliscript_queue(", emit_arguments(nodes), ")"]) : ((kind === "quoted-literal") ? emit_quoted(ir_value(node)) : ((kind === "function-expression") ? emit_function(node) : ((kind === "await-expression") ? combine(["await (", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")"]) : ((kind === "throw-expression") ? emit_throw(node) : ((kind === "try-expression") ? emit_try(node) : ((kind === "conditional") ? emit_if(nodes) : ((kind === "conditional-sugar") ? emit_conditional_sugar(node) : ((kind === "conditional-chain") ? emit_cond(nodes) : ((kind === "sequence") ? emit_do(nodes) : ((kind === "lexical-bindings") ? emit_let(node) : ((kind === "assignment") ? emit_assignment(node) : ((kind === "loop") ? emit_loop(node) : ((kind === "binding-loop") ? emit_binding_loop(node) : ((kind === "recur") ? (__eliscript_tdz_read_16())("recur is only valid in an analyzed tail position") : ((kind === "short-circuit") ? emit_short_circuit(nodes, ir_value(node)) : ((kind === "intrinsic") ? emit_intrinsic(node) : ((kind === "object-literal") ? emit_object(node) : ((kind === "property-read") ? ((access) => {
|
|
2621
|
+
if (((nodes)["length"] === 3)) {
|
|
2622
|
+
return combine(["(", access, " ?? ", emit_expression(((((nodes) ?? [])[2]) ?? null)), ")"]);
|
|
2623
|
+
} else {
|
|
2624
|
+
return access;
|
|
2625
|
+
}
|
|
2626
|
+
})(combine(["(", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")[", emit_property_key(((((nodes) ?? [])[1]) ?? null)), "]"])) : ((kind === "property-write") ? combine(["((", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")[", emit_property_key(((((nodes) ?? [])[1]) ?? null)), "] = ", emit_expression(((((nodes) ?? [])[2]) ?? null)), ")"]) : ((kind === "method-call") ? ((arguments$) => {
|
|
2627
|
+
return ((array_text) => {
|
|
2628
|
+
return ((direct) => {
|
|
2629
|
+
return combine([(__eliscript_truthy(direct) ? "__eliscript_at_direct(" : (__eliscript_truthy(array_text) ? "__eliscript_at(" : "(")), emit_expression(((((nodes) ?? [])[0]) ?? null)), (__eliscript_truthy(array_text) ? ", " : ")["), emit_property_key(((((nodes) ?? [])[1]) ?? null)), (__eliscript_truthy(direct) ? (__eliscript_numeric_relation(">", (arguments$)["length"], 0) ? ", " : "") : (__eliscript_truthy(array_text) ? ")(" : "](")), emit_arguments(arguments$), ")"]);
|
|
2630
|
+
})(((__eliscript_value_217) => (__eliscript_truthy(__eliscript_value_217) ? primitive_literal_arguments_p(arguments$) : __eliscript_value_217))(array_text));
|
|
2631
|
+
})(array_text_key_p(((((nodes) ?? [])[1]) ?? null)));
|
|
2632
|
+
})((nodes)["slice"](2)) : ((kind === "constructor-call") ? combine(["new (", emit_expression(((((nodes) ?? [])[0]) ?? null)), ")(", emit_arguments((nodes)["slice"](1)), ")"]) : ((kind === "raw-javascript") ? (() => {
|
|
2633
|
+
require_arity("js*", nodes, 1, 1);
|
|
2634
|
+
if ((!(ir_kind(((((nodes) ?? [])[0]) ?? null)) === "literal"))) {
|
|
2635
|
+
(__eliscript_tdz_read_16())("js* expects a string literal");
|
|
2636
|
+
}
|
|
2637
|
+
return text_fragment(ir_value(((((nodes) ?? [])[0]) ?? null)));
|
|
2638
|
+
})() : ((kind === "print") ? combine(["console.log(", emit_arguments(nodes), ")"]) : ((kind === "string-concat") ? (((nodes)["length"] === 0) ? text_fragment("\"\"") : ((parts) => {
|
|
2639
|
+
(nodes)["forEach"](((child) => {
|
|
2640
|
+
return (parts)["push"](combine(["String(", emit_expression(child), ")"]));
|
|
2641
|
+
}));
|
|
2642
|
+
return combine(["(", join_fragments(parts, " + "), ")"]);
|
|
2643
|
+
})([])) : ((kind === "invoke") ? combine([emit_callee(((((nodes) ?? [])[0]) ?? null)), "(", emit_arguments((nodes)["slice"](1)), ")"]) : ((kind === "apply-call") ? combine([emit_callee(((((nodes) ?? [])[0]) ?? null)), "(...", emit_expression(((((nodes) ?? [])[1]) ?? null)), ")"]) : ((kind === "call") ? combine([emit_callee(((((nodes) ?? [])[0]) ?? null)), "(", emit_arguments((nodes)["slice"](1)), ")"]) : (__eliscript_tdz_read_16())((String("IR node is not valid in expression position: ") + String(kind)))))))))))))))))))))))))))))))))))))));
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
946
2646
|
}
|
|
947
2647
|
function emit_import(node) {
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
(
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
2648
|
+
{
|
|
2649
|
+
const __eliscript_value_218 = null;
|
|
2650
|
+
const __eliscript_value_219 = null;
|
|
2651
|
+
const __eliscript_value_220 = [];
|
|
2652
|
+
{
|
|
2653
|
+
let default_binding = __eliscript_value_218;
|
|
2654
|
+
let namespace_binding = __eliscript_value_219;
|
|
2655
|
+
let named_bindings = __eliscript_value_220;
|
|
2656
|
+
(children(node))["forEach"](((specifier) => {
|
|
2657
|
+
{
|
|
2658
|
+
const __eliscript_value_221 = emit_binding_name(specifier);
|
|
2659
|
+
const __eliscript_value_222 = ir_kind(specifier);
|
|
2660
|
+
{
|
|
2661
|
+
let name = __eliscript_value_221;
|
|
2662
|
+
let kind = __eliscript_value_222;
|
|
2663
|
+
if ((kind === "import-default")) {
|
|
2664
|
+
return ((default_binding = name));
|
|
2665
|
+
} else {
|
|
2666
|
+
if ((kind === "import-namespace")) {
|
|
2667
|
+
return ((namespace_binding = name));
|
|
2668
|
+
} else {
|
|
2669
|
+
if ((kind === "import-named")) {
|
|
2670
|
+
return (named_bindings)["push"](name);
|
|
2671
|
+
} else {
|
|
2672
|
+
return (__eliscript_tdz_read_16())((String("invalid IR import specifier: ") + String(kind)));
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
}));
|
|
2679
|
+
if (__eliscript_truthy(((__eliscript_value_223) => (__eliscript_truthy(__eliscript_value_223) ? __eliscript_numeric_relation(">", (named_bindings)["length"], 0) : __eliscript_value_223))(namespace_binding))) {
|
|
2680
|
+
(__eliscript_tdz_read_16())("namespace and named imports cannot be combined");
|
|
2681
|
+
}
|
|
2682
|
+
{
|
|
2683
|
+
const __eliscript_value_224 = [];
|
|
2684
|
+
{
|
|
2685
|
+
let clauses = __eliscript_value_224;
|
|
2686
|
+
if (__eliscript_truthy(default_binding)) {
|
|
2687
|
+
(clauses)["push"](default_binding);
|
|
2688
|
+
}
|
|
2689
|
+
if (__eliscript_truthy(namespace_binding)) {
|
|
2690
|
+
(clauses)["push"](combine(["* as ", namespace_binding]));
|
|
2691
|
+
}
|
|
2692
|
+
if (__eliscript_numeric_relation(">", (named_bindings)["length"], 0)) {
|
|
2693
|
+
(clauses)["push"](combine(["{", join_fragments(named_bindings, ", "), "}"]));
|
|
2694
|
+
}
|
|
2695
|
+
if (((clauses)["length"] === 0)) {
|
|
2696
|
+
return text_fragment((String("import ") + String(json_string(ir_value(node))) + String(";")));
|
|
2697
|
+
} else {
|
|
2698
|
+
return combine(["import ", join_fragments(clauses, ", "), " from ", json_string(ir_value(node)), ";"]);
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
962
2704
|
}
|
|
963
2705
|
function emit_top_level(node) {
|
|
964
|
-
(
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
})(((((
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
2706
|
+
if ((!__eliscript_truthy(node_p(node)))) {
|
|
2707
|
+
(__eliscript_tdz_read_16())("expected a top-level IR node");
|
|
2708
|
+
}
|
|
2709
|
+
{
|
|
2710
|
+
const __eliscript_value_225 = ir_kind(node);
|
|
2711
|
+
const __eliscript_value_226 = children(node);
|
|
2712
|
+
{
|
|
2713
|
+
let kind = __eliscript_value_225;
|
|
2714
|
+
let nodes = __eliscript_value_226;
|
|
2715
|
+
return (__eliscript_tdz_read_19())(ir_span(node), ((kind === "module-declaration") ? join_fragments((nodes)["map"](((child) => {
|
|
2716
|
+
return emit_top_level(child);
|
|
2717
|
+
})), "\n") : ((kind === "import-declaration") ? emit_import(node) : ((kind === "variable-declaration") ? combine([(__eliscript_truthy(ir_property(node, "mutable")) ? "let " : "const "), binding_name(ir_value(node)), " = ", (__eliscript_numeric_relation(">", (nodes)["length"], 0) ? emit_expression(((((nodes) ?? [])[0]) ?? null)) : "null"), ";", ((record) => {
|
|
2718
|
+
if (__eliscript_truthy(record)) {
|
|
2719
|
+
return (String("\n") + String(tdz_ready_name(record)) + String(" = true;"));
|
|
2720
|
+
} else {
|
|
2721
|
+
return "";
|
|
2722
|
+
}
|
|
2723
|
+
})(((__eliscript_value_227) => (__eliscript_truthy(__eliscript_value_227) ? (((__eliscript_tdz_read_23()))["declarations"])["get"](node) : __eliscript_value_227))((__eliscript_tdz_read_23())))]) : ((kind === "function-declaration") ? ((parts) => {
|
|
2724
|
+
return ((parameters) => {
|
|
2725
|
+
return ((body) => {
|
|
2726
|
+
return ((fragment) => {
|
|
2727
|
+
return function_source_fragment(node, fragment, 0, (((fragment)["text"]) ?? []).length);
|
|
2728
|
+
})(combine([(__eliscript_truthy(ir_property(node, "async")) ? "async " : ""), "function ", binding_name(ir_value(node)), "(", join_fragments((parameters)["map"](((parameter) => {
|
|
2729
|
+
return emit_parameter(parameter);
|
|
2730
|
+
})), ", "), ") {\n", indent(emit_function_body(parameters, body)), "\n}"]));
|
|
2731
|
+
})(((((parts) ?? [])[1]) ?? null));
|
|
2732
|
+
})(((((parts) ?? [])[0]) ?? null));
|
|
2733
|
+
})(split_counted_children(node, "parameterCount")) : ((kind === "export-declaration") ? combine(["export {", join_fragments((nodes)["map"](((reference) => {
|
|
2734
|
+
return emit_binding_name(reference);
|
|
2735
|
+
})), ", "), "};"]) : ((kind === "export-default") ? combine(["export default ", emit_expression(((((nodes) ?? [])[0]) ?? null)), ";"]) : ((kind === "expression-statement") ? combine([emit_expression(((((nodes) ?? [])[0]) ?? null)), ";"]) : (__eliscript_tdz_read_16())((String("IR node is not valid at module top level: ") + String(kind)))))))))));
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
function node_uses_number_conversion_p(node) {
|
|
2740
|
+
if (((ir_kind(node) === "intrinsic") && (ir_value(node) === "string-to-number"))) {
|
|
2741
|
+
return true;
|
|
2742
|
+
} else {
|
|
2743
|
+
{
|
|
2744
|
+
const __eliscript_value_228 = false;
|
|
2745
|
+
{
|
|
2746
|
+
let found = __eliscript_value_228;
|
|
2747
|
+
(children(node))["forEach"](((child) => {
|
|
2748
|
+
if (__eliscript_truthy(node_uses_number_conversion_p(child))) {
|
|
2749
|
+
return ((found = true));
|
|
2750
|
+
} else {
|
|
2751
|
+
return null;
|
|
2752
|
+
}
|
|
2753
|
+
}));
|
|
2754
|
+
return found;
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
980
2758
|
}
|
|
981
2759
|
function node_uses_host_identity_token_p(node) {
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
2760
|
+
if (((ir_kind(node) === "intrinsic") && (ir_value(node) === "host-identity-token"))) {
|
|
2761
|
+
return true;
|
|
2762
|
+
} else {
|
|
2763
|
+
{
|
|
2764
|
+
const __eliscript_value_229 = false;
|
|
2765
|
+
{
|
|
2766
|
+
let found = __eliscript_value_229;
|
|
2767
|
+
(children(node))["forEach"](((child) => {
|
|
2768
|
+
if (__eliscript_truthy(node_uses_host_identity_token_p(child))) {
|
|
2769
|
+
return ((found = true));
|
|
2770
|
+
} else {
|
|
2771
|
+
return null;
|
|
2772
|
+
}
|
|
2773
|
+
}));
|
|
2774
|
+
return found;
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
988
2778
|
}
|
|
989
2779
|
function node_directly_uses_literal_runtime_p(node) {
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
2780
|
+
{
|
|
2781
|
+
const __eliscript_value_230 = ir_kind(node);
|
|
2782
|
+
{
|
|
2783
|
+
let kind = __eliscript_value_230;
|
|
2784
|
+
return ((__eliscript_value_231) => (__eliscript_truthy(__eliscript_value_231) ? __eliscript_value_231 : ((__eliscript_value_232) => (__eliscript_truthy(__eliscript_value_232) ? __eliscript_value_232 : ((__eliscript_value_233) => (__eliscript_truthy(__eliscript_value_233) ? __eliscript_value_233 : ((__eliscript_value_234) => (__eliscript_truthy(__eliscript_value_234) ? __eliscript_value_234 : ((__eliscript_value_235) => (__eliscript_truthy(__eliscript_value_235) ? __eliscript_value_235 : ((__eliscript_value_236) => (__eliscript_truthy(__eliscript_value_236) ? __eliscript_value_236 : ((kind === "literal") && (literal_kind(node) === "keyword"))))(((__eliscript_value_237) => (__eliscript_truthy(__eliscript_value_237) ? quoted_uses_literal_runtime_p(ir_value(node)) : __eliscript_value_237))((kind === "quoted-literal")))))((kind === "persistent-queue-literal"))))((kind === "persistent-set-literal"))))((kind === "persistent-map-literal"))))((kind === "persistent-vector-literal"))))((kind === "persistent-list-literal"));
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
993
2787
|
}
|
|
994
2788
|
function literal_runtime_static_key_index(node) {
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
2789
|
+
{
|
|
2790
|
+
const __eliscript_value_238 = ir_kind(node);
|
|
2791
|
+
{
|
|
2792
|
+
let kind = __eliscript_value_238;
|
|
2793
|
+
if (((kind === "property-read") || (kind === "property-write") || (kind === "method-call"))) {
|
|
2794
|
+
return 1;
|
|
2795
|
+
} else {
|
|
2796
|
+
if (((kind === "intrinsic") && ((ir_value(node) === "aref") || (ir_value(node) === "object-has?") || (ir_value(node) === "object-assoc")))) {
|
|
2797
|
+
return 1;
|
|
2798
|
+
} else {
|
|
2799
|
+
return null;
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
998
2804
|
}
|
|
999
2805
|
function node_uses_literal_runtime_p(node) {
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
2806
|
+
{
|
|
2807
|
+
const __eliscript_value_239 = children(node);
|
|
2808
|
+
{
|
|
2809
|
+
let nodes = __eliscript_value_239;
|
|
2810
|
+
if (__eliscript_truthy(node_directly_uses_literal_runtime_p(node))) {
|
|
2811
|
+
return true;
|
|
2812
|
+
} else {
|
|
2813
|
+
return children_use_literal_runtime_p(nodes, literal_runtime_static_key_index(node));
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
1003
2817
|
}
|
|
1004
2818
|
function children_use_literal_runtime_p(nodes, static_key_index) {
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
2819
|
+
{
|
|
2820
|
+
const __eliscript_value_240 = false;
|
|
2821
|
+
const __eliscript_value_241 = 0;
|
|
2822
|
+
{
|
|
2823
|
+
let found = __eliscript_value_240;
|
|
2824
|
+
let index = __eliscript_value_241;
|
|
2825
|
+
while (__eliscript_numeric_relation("<", index, (nodes)["length"])) {
|
|
2826
|
+
{
|
|
2827
|
+
const __eliscript_value_242 = ((((nodes) ?? [])[index]) ?? null);
|
|
2828
|
+
{
|
|
2829
|
+
let child = __eliscript_value_242;
|
|
2830
|
+
if ((!__eliscript_truthy(((__eliscript_value_243) => (__eliscript_truthy(__eliscript_value_243) ? ((index === static_key_index) && (ir_kind(child) === "literal") && (literal_kind(child) === "keyword")) : __eliscript_value_243))(static_key_index)))) {
|
|
2831
|
+
if (__eliscript_truthy(node_uses_literal_runtime_p(child))) {
|
|
2832
|
+
((found = true));
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
1011
2837
|
((index = (index + 1)));
|
|
1012
2838
|
}
|
|
1013
|
-
return
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
})(false, 0);
|
|
2839
|
+
return found;
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
1017
2842
|
}
|
|
1018
2843
|
function node_uses_collection_runtime_p(node) {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
2844
|
+
if (((ir_kind(node) === "intrinsic") && ((ir_value(node) === "nth") || (ir_value(node) === "length")))) {
|
|
2845
|
+
return true;
|
|
2846
|
+
} else {
|
|
2847
|
+
{
|
|
2848
|
+
const __eliscript_value_244 = false;
|
|
2849
|
+
{
|
|
2850
|
+
let found = __eliscript_value_244;
|
|
2851
|
+
(children(node))["forEach"](((child) => {
|
|
2852
|
+
if (__eliscript_truthy(node_uses_collection_runtime_p(child))) {
|
|
2853
|
+
return ((found = true));
|
|
2854
|
+
} else {
|
|
2855
|
+
return null;
|
|
2856
|
+
}
|
|
2857
|
+
}));
|
|
2858
|
+
return found;
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
1025
2862
|
}
|
|
1026
2863
|
function node_uses_binding_runtime_p(node) {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
2864
|
+
if ((ir_kind(node) === "map-binding-pattern")) {
|
|
2865
|
+
return true;
|
|
2866
|
+
} else {
|
|
2867
|
+
{
|
|
2868
|
+
const __eliscript_value_245 = false;
|
|
2869
|
+
{
|
|
2870
|
+
let found = __eliscript_value_245;
|
|
2871
|
+
(children(node))["forEach"](((child) => {
|
|
2872
|
+
if (__eliscript_truthy(node_uses_binding_runtime_p(child))) {
|
|
2873
|
+
return ((found = true));
|
|
2874
|
+
} else {
|
|
2875
|
+
return null;
|
|
2876
|
+
}
|
|
2877
|
+
}));
|
|
2878
|
+
return found;
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
1033
2882
|
}
|
|
1034
2883
|
function node_uses_list_runtime_p(node) {
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
2884
|
+
if (((ir_kind(node) === "intrinsic") && ((ir_value(node) === "car") || (ir_value(node) === "cdr") || (ir_value(node) === "cons")))) {
|
|
2885
|
+
return true;
|
|
2886
|
+
} else {
|
|
2887
|
+
{
|
|
2888
|
+
const __eliscript_value_246 = false;
|
|
2889
|
+
{
|
|
2890
|
+
let found = __eliscript_value_246;
|
|
2891
|
+
(children(node))["forEach"](((child) => {
|
|
2892
|
+
if (__eliscript_truthy(node_uses_list_runtime_p(child))) {
|
|
2893
|
+
return ((found = true));
|
|
2894
|
+
} else {
|
|
2895
|
+
return null;
|
|
2896
|
+
}
|
|
2897
|
+
}));
|
|
2898
|
+
return found;
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
1041
2902
|
}
|
|
1042
2903
|
function node_uses_value_runtime_p(node) {
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
2904
|
+
if (((ir_kind(node) === "intrinsic") && (ir_value(node) === "equal"))) {
|
|
2905
|
+
return true;
|
|
2906
|
+
} else {
|
|
2907
|
+
{
|
|
2908
|
+
const __eliscript_value_247 = false;
|
|
2909
|
+
{
|
|
2910
|
+
let found = __eliscript_value_247;
|
|
2911
|
+
(children(node))["forEach"](((child) => {
|
|
2912
|
+
if (__eliscript_truthy(node_uses_value_runtime_p(child))) {
|
|
2913
|
+
return ((found = true));
|
|
2914
|
+
} else {
|
|
2915
|
+
return null;
|
|
2916
|
+
}
|
|
2917
|
+
}));
|
|
2918
|
+
return found;
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2923
|
+
function program_uses_number_conversion_p(program) {
|
|
2924
|
+
{
|
|
2925
|
+
const __eliscript_value_248 = false;
|
|
2926
|
+
{
|
|
2927
|
+
let found = __eliscript_value_248;
|
|
2928
|
+
(program_body(program))["forEach"](((node) => {
|
|
2929
|
+
if (__eliscript_truthy(node_uses_number_conversion_p(node))) {
|
|
2930
|
+
return ((found = true));
|
|
2931
|
+
} else {
|
|
2932
|
+
return null;
|
|
2933
|
+
}
|
|
2934
|
+
}));
|
|
2935
|
+
return found;
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
1049
2938
|
}
|
|
1050
2939
|
function program_uses_host_identity_token_p(program) {
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
2940
|
+
{
|
|
2941
|
+
const __eliscript_value_249 = false;
|
|
2942
|
+
{
|
|
2943
|
+
let found = __eliscript_value_249;
|
|
2944
|
+
(program_body(program))["forEach"](((node) => {
|
|
2945
|
+
if (__eliscript_truthy(node_uses_host_identity_token_p(node))) {
|
|
2946
|
+
return ((found = true));
|
|
2947
|
+
} else {
|
|
2948
|
+
return null;
|
|
2949
|
+
}
|
|
2950
|
+
}));
|
|
2951
|
+
return found;
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
1057
2954
|
}
|
|
1058
2955
|
function program_uses_literal_runtime_p(program) {
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
2956
|
+
{
|
|
2957
|
+
const __eliscript_value_250 = false;
|
|
2958
|
+
{
|
|
2959
|
+
let found = __eliscript_value_250;
|
|
2960
|
+
(program_body(program))["forEach"](((node) => {
|
|
2961
|
+
if (__eliscript_truthy(node_uses_literal_runtime_p(node))) {
|
|
2962
|
+
return ((found = true));
|
|
2963
|
+
} else {
|
|
2964
|
+
return null;
|
|
2965
|
+
}
|
|
2966
|
+
}));
|
|
2967
|
+
return found;
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
1065
2970
|
}
|
|
1066
2971
|
function program_uses_collection_runtime_p(program) {
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
2972
|
+
{
|
|
2973
|
+
const __eliscript_value_251 = false;
|
|
2974
|
+
{
|
|
2975
|
+
let found = __eliscript_value_251;
|
|
2976
|
+
(program_body(program))["forEach"](((node) => {
|
|
2977
|
+
if (__eliscript_truthy(node_uses_collection_runtime_p(node))) {
|
|
2978
|
+
return ((found = true));
|
|
2979
|
+
} else {
|
|
2980
|
+
return null;
|
|
2981
|
+
}
|
|
2982
|
+
}));
|
|
2983
|
+
return found;
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
1073
2986
|
}
|
|
1074
2987
|
function program_uses_binding_runtime_p(program) {
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
2988
|
+
{
|
|
2989
|
+
const __eliscript_value_252 = false;
|
|
2990
|
+
{
|
|
2991
|
+
let found = __eliscript_value_252;
|
|
2992
|
+
(program_body(program))["forEach"](((node) => {
|
|
2993
|
+
if (__eliscript_truthy(node_uses_binding_runtime_p(node))) {
|
|
2994
|
+
return ((found = true));
|
|
2995
|
+
} else {
|
|
2996
|
+
return null;
|
|
2997
|
+
}
|
|
2998
|
+
}));
|
|
2999
|
+
return found;
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
1081
3002
|
}
|
|
1082
3003
|
function program_uses_list_runtime_p(program) {
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
3004
|
+
{
|
|
3005
|
+
const __eliscript_value_253 = false;
|
|
3006
|
+
{
|
|
3007
|
+
let found = __eliscript_value_253;
|
|
3008
|
+
(program_body(program))["forEach"](((node) => {
|
|
3009
|
+
if (__eliscript_truthy(node_uses_list_runtime_p(node))) {
|
|
3010
|
+
return ((found = true));
|
|
3011
|
+
} else {
|
|
3012
|
+
return null;
|
|
3013
|
+
}
|
|
3014
|
+
}));
|
|
3015
|
+
return found;
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
1089
3018
|
}
|
|
1090
3019
|
function program_uses_value_runtime_p(program) {
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
3020
|
+
{
|
|
3021
|
+
const __eliscript_value_254 = false;
|
|
3022
|
+
{
|
|
3023
|
+
let found = __eliscript_value_254;
|
|
3024
|
+
(program_body(program))["forEach"](((node) => {
|
|
3025
|
+
if (__eliscript_truthy(node_uses_value_runtime_p(node))) {
|
|
3026
|
+
return ((found = true));
|
|
3027
|
+
} else {
|
|
3028
|
+
return null;
|
|
3029
|
+
}
|
|
3030
|
+
}));
|
|
3031
|
+
return found;
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
function node_uses_array_text_p(node) {
|
|
3036
|
+
{
|
|
3037
|
+
const __eliscript_value_255 = ((__eliscript_value_256) => (__eliscript_truthy(__eliscript_value_256) ? __eliscript_value_256 : ((__eliscript_value_258) => (__eliscript_truthy(__eliscript_value_258) ? qualified_apply_reference_p(((((children(node)) ?? [])[0]) ?? null)) : __eliscript_value_258))((["call", "invoke", "apply-call"])["includes"](ir_kind(node)))))(((__eliscript_value_257) => (__eliscript_truthy(__eliscript_value_257) ? array_text_key_p(((((children(node)) ?? [])[1]) ?? null)) : __eliscript_value_257))((ir_kind(node) === "method-call")));
|
|
3038
|
+
{
|
|
3039
|
+
let found = __eliscript_value_255;
|
|
3040
|
+
(children(node))["forEach"](((child) => {
|
|
3041
|
+
if (__eliscript_truthy(node_uses_array_text_p(child))) {
|
|
3042
|
+
return ((found = true));
|
|
3043
|
+
} else {
|
|
3044
|
+
return null;
|
|
3045
|
+
}
|
|
3046
|
+
}));
|
|
3047
|
+
return found;
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
1097
3050
|
}
|
|
1098
3051
|
function reference_runtime_requirements(program) {
|
|
1099
|
-
return ({"hostIdentityToken": program_uses_host_identity_token_p(program), "literal": program_uses_literal_runtime_p(program), "collection": program_uses_collection_runtime_p(program), "binding": program_uses_binding_runtime_p(program), "list": program_uses_list_runtime_p(program), "value": program_uses_value_runtime_p(program)});
|
|
3052
|
+
return ({"math": (program_body(program))["some"](node_uses_math_runtime_p), "numericCoercion": program_uses_numeric_coercion_p(program), "imul": (program_body(program))["some"](node_uses_imul_p), "arrayText": (program_body(program))["some"](node_uses_array_text_p), "numberConversion": program_uses_number_conversion_p(program), "hostIdentityToken": program_uses_host_identity_token_p(program), "literal": program_uses_literal_runtime_p(program), "collection": program_uses_collection_runtime_p(program), "binding": program_uses_binding_runtime_p(program), "list": program_uses_list_runtime_p(program), "value": program_uses_value_runtime_p(program)});
|
|
3053
|
+
}
|
|
3054
|
+
function math_runtime_reference_p(value) {
|
|
3055
|
+
return ((__eliscript_value_259) => (__eliscript_truthy(__eliscript_value_259) ? ((__eliscript_value_260) => (__eliscript_truthy(__eliscript_value_260) ? __eliscript_value_260 : (["Math/", "Math.", "globalThis/Math/", "globalThis/Math.", "globalThis.Math/", "globalThis.Math."])["some"](((prefix) => {
|
|
3056
|
+
return (value)["startsWith"](prefix);
|
|
3057
|
+
}))))((["Math", "globalThis/Math", "globalThis.Math"])["includes"](value)) : __eliscript_value_259))((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(value) === "string"));
|
|
3058
|
+
}
|
|
3059
|
+
function node_uses_math_runtime_p(node) {
|
|
3060
|
+
return ((__eliscript_value_261) => (__eliscript_truthy(__eliscript_value_261) ? __eliscript_value_261 : (children(node))["some"](node_uses_math_runtime_p)))(((__eliscript_value_262) => (__eliscript_truthy(__eliscript_value_262) ? math_runtime_reference_p(ir_value(node)) : __eliscript_value_262))((["reference", "raw-javascript"])["includes"](ir_kind(node))));
|
|
3061
|
+
}
|
|
3062
|
+
function node_uses_imul_p(node) {
|
|
3063
|
+
return ((__eliscript_value_263) => (__eliscript_truthy(__eliscript_value_263) ? __eliscript_value_263 : (children(node))["some"](node_uses_imul_p)))(((ir_kind(node) === "intrinsic") && (ir_value(node) === "imul32")));
|
|
3064
|
+
}
|
|
3065
|
+
function node_uses_numeric_coercion_p(node) {
|
|
3066
|
+
return ((__eliscript_value_264) => (__eliscript_truthy(__eliscript_value_264) ? __eliscript_value_264 : ((found) => {
|
|
3067
|
+
(children(node))["forEach"](((child) => {
|
|
3068
|
+
if (__eliscript_truthy(node_uses_numeric_coercion_p(child))) {
|
|
3069
|
+
return ((found = true));
|
|
3070
|
+
} else {
|
|
3071
|
+
return null;
|
|
3072
|
+
}
|
|
3073
|
+
}));
|
|
3074
|
+
return found;
|
|
3075
|
+
})(false)))(((__eliscript_value_265) => (__eliscript_truthy(__eliscript_value_265) ? ((__eliscript_value_266) => (__eliscript_truthy(__eliscript_value_266) ? (((__eliscript_value_267, __eliscript_value_268) => (__eliscript_value_267 !== __eliscript_value_268))(ir_value(node), "*") || __eliscript_numeric_relation(">", ((children(node)) ?? []).length, 1)) : __eliscript_value_266))(numeric_coercion_intrinsic_p(ir_value(node))) : __eliscript_value_265))((ir_kind(node) === "intrinsic")));
|
|
3076
|
+
}
|
|
3077
|
+
function program_uses_numeric_coercion_p(program) {
|
|
3078
|
+
{
|
|
3079
|
+
const __eliscript_value_269 = false;
|
|
3080
|
+
{
|
|
3081
|
+
let found = __eliscript_value_269;
|
|
3082
|
+
(program_body(program))["forEach"](((node) => {
|
|
3083
|
+
if (__eliscript_truthy(node_uses_numeric_coercion_p(node))) {
|
|
3084
|
+
return ((found = true));
|
|
3085
|
+
} else {
|
|
3086
|
+
return null;
|
|
3087
|
+
}
|
|
3088
|
+
}));
|
|
3089
|
+
return found;
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
1100
3092
|
}
|
|
1101
3093
|
function static_literal_key_p(node, index, static_key_index) {
|
|
1102
|
-
return ((
|
|
3094
|
+
return ((__eliscript_value_270) => (__eliscript_truthy(__eliscript_value_270) ? ((index === static_key_index) && (ir_kind(node) === "literal") && (literal_kind(node) === "keyword")) : __eliscript_value_270))(static_key_index);
|
|
1103
3095
|
}
|
|
1104
3096
|
function collect_runtime_requirements(node, requirements, suppress_literal) {
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
3097
|
+
{
|
|
3098
|
+
const __eliscript_value_271 = ir_kind(node);
|
|
3099
|
+
const __eliscript_value_272 = ir_value(node);
|
|
3100
|
+
const __eliscript_value_273 = children(node);
|
|
3101
|
+
const __eliscript_value_274 = literal_runtime_static_key_index(node);
|
|
3102
|
+
const __eliscript_value_275 = 0;
|
|
3103
|
+
const __eliscript_value_276 = null;
|
|
3104
|
+
{
|
|
3105
|
+
let kind = __eliscript_value_271;
|
|
3106
|
+
let value = __eliscript_value_272;
|
|
3107
|
+
let nodes = __eliscript_value_273;
|
|
3108
|
+
let static_key_index = __eliscript_value_274;
|
|
3109
|
+
let index = __eliscript_value_275;
|
|
3110
|
+
let child = __eliscript_value_276;
|
|
3111
|
+
if (__eliscript_truthy(((__eliscript_value_277) => (__eliscript_truthy(__eliscript_value_277) ? __eliscript_value_277 : ((__eliscript_value_279) => (__eliscript_truthy(__eliscript_value_279) ? qualified_apply_reference_p(((((nodes) ?? [])[0]) ?? null)) : __eliscript_value_279))((["call", "invoke", "apply-call"])["includes"](kind))))(((__eliscript_value_278) => (__eliscript_truthy(__eliscript_value_278) ? array_text_key_p(((((nodes) ?? [])[1]) ?? null)) : __eliscript_value_278))((kind === "method-call"))))) {
|
|
3112
|
+
((requirements)["arrayText"] = true);
|
|
3113
|
+
}
|
|
3114
|
+
if (__eliscript_truthy(((__eliscript_value_280) => (__eliscript_truthy(__eliscript_value_280) ? math_runtime_reference_p(value) : __eliscript_value_280))((["reference", "raw-javascript"])["includes"](kind)))) {
|
|
3115
|
+
((requirements)["math"] = true);
|
|
3116
|
+
}
|
|
3117
|
+
if ((kind === "map-binding-pattern")) {
|
|
3118
|
+
((requirements)["binding"] = true);
|
|
3119
|
+
} else {
|
|
3120
|
+
if (((!__eliscript_truthy(suppress_literal)) && ((kind === "persistent-list-literal") || (kind === "persistent-vector-literal") || (kind === "persistent-map-literal") || (kind === "persistent-set-literal") || (kind === "persistent-queue-literal")))) {
|
|
3121
|
+
((requirements)["literal"] = true);
|
|
3122
|
+
} else {
|
|
3123
|
+
if (__eliscript_truthy(((__eliscript_value_281) => (__eliscript_truthy(__eliscript_value_281) ? ((__eliscript_value_282) => (__eliscript_truthy(__eliscript_value_282) ? quoted_uses_literal_runtime_p(value) : __eliscript_value_282))((kind === "quoted-literal")) : __eliscript_value_281))((!__eliscript_truthy(suppress_literal))))) {
|
|
3124
|
+
((requirements)["literal"] = true);
|
|
3125
|
+
} else {
|
|
3126
|
+
if (((!__eliscript_truthy(suppress_literal)) && (kind === "literal") && (literal_kind(node) === "keyword"))) {
|
|
3127
|
+
((requirements)["literal"] = true);
|
|
3128
|
+
} else {
|
|
3129
|
+
if ((kind === "intrinsic")) {
|
|
3130
|
+
if ((value === "imul32")) {
|
|
3131
|
+
((requirements)["imul"] = true);
|
|
3132
|
+
}
|
|
3133
|
+
if (__eliscript_truthy(((__eliscript_value_283) => (__eliscript_truthy(__eliscript_value_283) ? (((__eliscript_value_284, __eliscript_value_285) => (__eliscript_value_284 !== __eliscript_value_285))(value, "*") || __eliscript_numeric_relation(">", ((nodes) ?? []).length, 1)) : __eliscript_value_283))(numeric_coercion_intrinsic_p(value)))) {
|
|
3134
|
+
((requirements)["numericCoercion"] = true);
|
|
3135
|
+
}
|
|
3136
|
+
if ((value === "string-to-number")) {
|
|
3137
|
+
((requirements)["numberConversion"] = true);
|
|
3138
|
+
} else {
|
|
3139
|
+
if ((value === "host-identity-token")) {
|
|
3140
|
+
((requirements)["hostIdentityToken"] = true);
|
|
3141
|
+
} else {
|
|
3142
|
+
if (((value === "nth") || (value === "length"))) {
|
|
3143
|
+
((requirements)["collection"] = true);
|
|
3144
|
+
} else {
|
|
3145
|
+
if (((value === "car") || (value === "cdr") || (value === "cons"))) {
|
|
3146
|
+
((requirements)["list"] = true);
|
|
3147
|
+
} else {
|
|
3148
|
+
if ((value === "equal")) {
|
|
3149
|
+
((requirements)["value"] = true);
|
|
3150
|
+
} else {
|
|
3151
|
+
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
} else {
|
|
3158
|
+
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
while (__eliscript_numeric_relation("<", index, (nodes)["length"])) {
|
|
1109
3165
|
((child = ((((nodes) ?? [])[index]) ?? null)));
|
|
1110
|
-
collect_runtime_requirements(child, requirements, ((
|
|
3166
|
+
collect_runtime_requirements(child, requirements, ((__eliscript_value_286) => (__eliscript_truthy(__eliscript_value_286) ? __eliscript_value_286 : static_literal_key_p(child, index, static_key_index)))(suppress_literal));
|
|
1111
3167
|
((index = (index + 1)));
|
|
1112
3168
|
}
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
})(ir_kind(node), ir_value(node), children(node), literal_runtime_static_key_index(node), 0, null);
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
1116
3171
|
return requirements;
|
|
1117
3172
|
}
|
|
1118
3173
|
function runtime_requirements(program) {
|
|
1119
|
-
|
|
1120
|
-
(
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
3174
|
+
{
|
|
3175
|
+
const __eliscript_value_287 = ({"math": false, "numericCoercion": false, "imul": false, "arrayText": false, "numberConversion": false, "hostIdentityToken": false, "literal": false, "collection": false, "binding": false, "list": false, "value": false});
|
|
3176
|
+
{
|
|
3177
|
+
let requirements = __eliscript_value_287;
|
|
3178
|
+
(program_body(program))["forEach"](((node) => {
|
|
3179
|
+
return collect_runtime_requirements(node, requirements, false);
|
|
3180
|
+
}));
|
|
3181
|
+
return requirements;
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
1125
3184
|
}
|
|
1126
3185
|
function collect_portable_metadata(node, portable, exported) {
|
|
1127
|
-
(__eliscript_truthy(((
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
3186
|
+
if (__eliscript_truthy(((__eliscript_value_288) => (__eliscript_truthy(__eliscript_value_288) ? ir_property(node, "portable") : __eliscript_value_288))((ir_kind(node) === "function-declaration")))) {
|
|
3187
|
+
(portable)["push"](node);
|
|
3188
|
+
}
|
|
3189
|
+
if ((ir_kind(node) === "export-declaration")) {
|
|
3190
|
+
(children(node))["forEach"](((reference) => {
|
|
3191
|
+
return (exported)["push"](ir_value(reference));
|
|
3192
|
+
}));
|
|
3193
|
+
}
|
|
3194
|
+
return (children(node))["forEach"](((child) => {
|
|
1132
3195
|
return collect_portable_metadata(child, portable, exported);
|
|
1133
|
-
});
|
|
3196
|
+
}));
|
|
1134
3197
|
}
|
|
1135
3198
|
function emit_portable_manifest(program) {
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
3199
|
+
{
|
|
3200
|
+
const __eliscript_value_289 = [];
|
|
3201
|
+
const __eliscript_value_290 = [];
|
|
3202
|
+
{
|
|
3203
|
+
let portable = __eliscript_value_289;
|
|
3204
|
+
let exported = __eliscript_value_290;
|
|
3205
|
+
(program_body(program))["forEach"](((node) => {
|
|
3206
|
+
return collect_portable_metadata(node, portable, exported);
|
|
3207
|
+
}));
|
|
3208
|
+
if (((portable)["length"] === 0)) {
|
|
3209
|
+
return text_fragment("");
|
|
3210
|
+
} else {
|
|
3211
|
+
{
|
|
3212
|
+
const __eliscript_value_291 = (portable)["filter"](((node) => {
|
|
3213
|
+
return (!__eliscript_truthy((exported)["includes"](ir_value(node))));
|
|
3214
|
+
}));
|
|
3215
|
+
{
|
|
3216
|
+
let implicit = __eliscript_value_291;
|
|
3217
|
+
return combine([(__eliscript_numeric_relation(">", (implicit)["length"], 0) ? combine(["\n\nexport {", join_fragments((implicit)["map"](((node) => {
|
|
3218
|
+
return binding_name(ir_value(node));
|
|
3219
|
+
})), ", "), "};"]) : ""), "\nexport const __eliscript_portable__ = Object.freeze(Object.fromEntries([", join_fragments((portable)["map"](((node) => {
|
|
3220
|
+
return combine(["[", json_string(ir_value(node)), ", ", binding_name(ir_value(node)), "]"]);
|
|
3221
|
+
})), ", "), "]));"]);
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
function node_names_global_root_p(node) {
|
|
3229
|
+
return ((__eliscript_value_292) => (__eliscript_truthy(__eliscript_value_292) ? __eliscript_value_292 : (children(node))["some"](node_names_global_root_p)))(((ir_value(node) === "globalThis") && (!(ir_kind(node) === "literal")) && (!(ir_kind(node) === "raw-javascript"))));
|
|
3230
|
+
}
|
|
3231
|
+
function number_conversion_prologue(program) {
|
|
3232
|
+
if (__eliscript_truthy((program_body(program))["some"](node_names_global_root_p))) {
|
|
3233
|
+
return (String((__eliscript_tdz_read_7())) + String((__eliscript_tdz_read_8())));
|
|
3234
|
+
} else {
|
|
3235
|
+
return (__eliscript_tdz_read_9());
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
3238
|
+
function imul_prologue(program) {
|
|
3239
|
+
return (String((__eliscript_truthy((program_body(program))["some"](node_names_global_root_p)) ? (__eliscript_tdz_read_12()) : (__eliscript_tdz_read_11()))) + String((__eliscript_tdz_read_13())));
|
|
3240
|
+
}
|
|
3241
|
+
function emit_module_artifact_in_profile(program) {
|
|
3242
|
+
{
|
|
3243
|
+
const __eliscript_value_293 = (__eliscript_tdz_read_23());
|
|
3244
|
+
{
|
|
3245
|
+
let previous = __eliscript_value_293;
|
|
3246
|
+
(__eliscript_tdz_write_23(tdz_prepare(program)));
|
|
3247
|
+
return (() => {
|
|
3248
|
+
try {
|
|
3249
|
+
return emit_module_artifact_in_profile_ready(program);
|
|
3250
|
+
} finally {
|
|
3251
|
+
(__eliscript_tdz_write_23(previous));
|
|
3252
|
+
}
|
|
3253
|
+
})();
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
function unicode_bootstrap_capsule_p(program) {
|
|
3258
|
+
{
|
|
3259
|
+
let filename = program_filename(program);
|
|
3260
|
+
let body = program_body(program);
|
|
3261
|
+
let module = ((((body) ?? []).length === 1) ? (body)[0] : null);
|
|
3262
|
+
return ((__eliscript_value_294) => (__eliscript_truthy(__eliscript_value_294) ? ((__eliscript_value_295) => (__eliscript_truthy(__eliscript_value_295) ? ((__eliscript_value_296) => (__eliscript_truthy(__eliscript_value_296) ? ([["runtime/unicode-case.eli", "eliscript.runtime.unicode-case"], ["runtime/unicode-case-data.eli", "eliscript.runtime.unicode-case-data"]])["some"](((entry) => {
|
|
3263
|
+
return ((__eliscript_value_297) => (__eliscript_truthy(__eliscript_value_297) ? ((__eliscript_value_298) => (__eliscript_truthy(__eliscript_value_298) ? __eliscript_value_298 : ((__eliscript_value_299) => (__eliscript_truthy(__eliscript_value_299) ? (filename)["endsWith"](("/" + (entry)[0])) : __eliscript_value_299))((filename)["startsWith"]("/"))))((filename === (entry)[0])) : __eliscript_value_297))((ir_value(module) === (entry)[1]));
|
|
3264
|
+
})) : __eliscript_value_296))((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(filename) === "string")) : __eliscript_value_295))((ir_kind(module) === "module-declaration")) : __eliscript_value_294))(module);
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
function emit_module_artifact_in_profile_ready(program) {
|
|
3268
|
+
(__eliscript_tdz_write_20(0));
|
|
3269
|
+
(__eliscript_tdz_write_21(new (globalThis.Map)()));
|
|
3270
|
+
{
|
|
3271
|
+
const __eliscript_value_300 = runtime_requirements(program);
|
|
3272
|
+
const __eliscript_value_301 = join_fragments((program_body(program))["map"](((node) => {
|
|
3273
|
+
return emit_top_level(node);
|
|
3274
|
+
})), "\n\n");
|
|
3275
|
+
{
|
|
3276
|
+
let requirements = __eliscript_value_300;
|
|
3277
|
+
let body = __eliscript_value_301;
|
|
3278
|
+
return combine(["// Generated by Eliscript. Do not edit.\n", tdz_prologue(), (__eliscript_truthy(unicode_bootstrap_capsule_p(program)) ? "" : "import \"eliscript/runtime/unicode-case.mjs\";\n"), (__eliscript_truthy((requirements)["math"]) ? "import \"eliscript/runtime/math.mjs\";\n" : ""), (__eliscript_truthy((requirements)["arrayText"]) ? (__eliscript_tdz_read_0()) : ""), (__eliscript_truthy((requirements)["literal"]) ? (__eliscript_tdz_read_1()) : ""), (__eliscript_truthy((requirements)["collection"]) ? (__eliscript_tdz_read_2()) : ""), (__eliscript_truthy((requirements)["binding"]) ? (__eliscript_tdz_read_5()) : ""), (__eliscript_truthy((requirements)["list"]) ? (__eliscript_tdz_read_3()) : ""), (__eliscript_truthy((requirements)["value"]) ? (__eliscript_tdz_read_4()) : ""), "const __eliscript_truthy = (value) => value !== false && value != null;\n", (__eliscript_truthy(((__eliscript_value_302) => (__eliscript_truthy(__eliscript_value_302) ? __eliscript_value_302 : ((__eliscript_value_303) => (__eliscript_truthy(__eliscript_value_303) ? (requirements)["numericCoercion"] : __eliscript_value_303))((!__eliscript_truthy((__eliscript_tdz_read_14()))))))((requirements)["numberConversion"])) ? number_conversion_prologue(program) : ""), (__eliscript_truthy(((__eliscript_value_304) => (__eliscript_truthy(__eliscript_value_304) ? (requirements)["numericCoercion"] : __eliscript_value_304))((!__eliscript_truthy((__eliscript_tdz_read_14()))))) ? (__eliscript_tdz_read_10()) : ""), (__eliscript_truthy(((__eliscript_value_305) => (__eliscript_truthy(__eliscript_value_305) ? (requirements)["imul"] : __eliscript_value_305))((!__eliscript_truthy((__eliscript_tdz_read_14()))))) ? imul_prologue(program) : ""), (__eliscript_truthy((requirements)["hostIdentityToken"]) ? (__eliscript_tdz_read_15()) : ""), "\n", body, emit_portable_manifest(program), "\n"]);
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
1150
3281
|
}
|
|
1151
3282
|
function emit_module_artifact(program) {
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
3283
|
+
{
|
|
3284
|
+
const __eliscript_value_306 = (__eliscript_tdz_read_14());
|
|
3285
|
+
{
|
|
3286
|
+
let previous = __eliscript_value_306;
|
|
3287
|
+
(__eliscript_tdz_write_14(false));
|
|
3288
|
+
return (() => {
|
|
3289
|
+
try {
|
|
3290
|
+
return emit_module_artifact_in_profile(program);
|
|
3291
|
+
} finally {
|
|
3292
|
+
(__eliscript_tdz_write_14(previous));
|
|
3293
|
+
}
|
|
3294
|
+
})();
|
|
3295
|
+
}
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3298
|
+
function emit_module_function_sources(program) {
|
|
3299
|
+
{
|
|
3300
|
+
const __eliscript_value_307 = (__eliscript_tdz_read_18());
|
|
3301
|
+
{
|
|
3302
|
+
let previous = __eliscript_value_307;
|
|
3303
|
+
(__eliscript_tdz_write_18(true));
|
|
3304
|
+
return (() => {
|
|
3305
|
+
try {
|
|
3306
|
+
{
|
|
3307
|
+
let artifact = emit_module_artifact(program);
|
|
3308
|
+
let javascript = (artifact)["text"];
|
|
3309
|
+
return ({"javascript": javascript, "functions": (((artifact)["functions"] ?? []))["map"](((record) => {
|
|
3310
|
+
return ({"node": (record)["node"], "start": (record)["start"], "end": (record)["end"], "sourceText": (javascript)["slice"]((record)["start"], (record)["end"])});
|
|
3311
|
+
}))});
|
|
3312
|
+
}
|
|
3313
|
+
} finally {
|
|
3314
|
+
(__eliscript_tdz_write_18(previous));
|
|
3315
|
+
}
|
|
3316
|
+
})();
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
function emit_module_numeric(program) {
|
|
3321
|
+
{
|
|
3322
|
+
const __eliscript_value_308 = (__eliscript_tdz_read_14());
|
|
3323
|
+
{
|
|
3324
|
+
let previous = __eliscript_value_308;
|
|
3325
|
+
(__eliscript_tdz_write_14(true));
|
|
3326
|
+
return (() => {
|
|
3327
|
+
try {
|
|
3328
|
+
return (emit_module_artifact_in_profile(program))["text"];
|
|
3329
|
+
} finally {
|
|
3330
|
+
(__eliscript_tdz_write_14(previous));
|
|
3331
|
+
}
|
|
3332
|
+
})();
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
1159
3335
|
}
|
|
1160
3336
|
function emit_module(program) {
|
|
1161
3337
|
return (emit_module_artifact(program))["text"];
|
|
1162
3338
|
}
|
|
1163
3339
|
function emit_module_with_source_map(program, source, generated_name, source_name) {
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
}
|
|
1172
|
-
export {indent, reference_indent, locate, reference_locate, emit_expression, emit_top_level, emit_module_artifact, emit_module, emit_module_with_source_map, runtime_requirements, reference_runtime_requirements};
|
|
1173
|
-
//# sourceMappingURL=emitter.mjs.map
|
|
3340
|
+
{
|
|
3341
|
+
let artifact = emit_module_artifact(program);
|
|
3342
|
+
let javascript = (artifact)["text"];
|
|
3343
|
+
let resolved_source_name = ((__eliscript_value_309) => (__eliscript_truthy(__eliscript_value_309) ? __eliscript_value_309 : ((__eliscript_value_310) => (__eliscript_truthy(__eliscript_value_310) ? __eliscript_value_310 : "<string>"))(program_filename(program))))(source_name);
|
|
3344
|
+
return ({"javascript": javascript, "sourceMap": create_source_map(javascript, (artifact)["marks"], source, resolved_source_name, generated_name)});
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
export {indent, reference_indent, locate, reference_locate, emit_expression, emit_top_level, emit_module_artifact, emit_module_function_sources, emit_module, emit_module_numeric, emit_module_with_source_map, runtime_requirements, reference_runtime_requirements};
|