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,17 +1,161 @@
|
|
|
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("builtin_operators"); return builtin_operators; }
|
|
5
|
+
function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("builtin_operators"); 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("portable_forbidden_operators"); return portable_forbidden_operators; }
|
|
8
|
+
function __eliscript_tdz_write_1(__eliscript_tdz_value_1) { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("portable_forbidden_operators"); 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("top_level_operators"); return top_level_operators; }
|
|
11
|
+
function __eliscript_tdz_write_2(__eliscript_tdz_value_2) { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("top_level_operators"); 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("fail"); return fail; }
|
|
14
|
+
function __eliscript_tdz_write_3(__eliscript_tdz_value_3) { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("fail"); return __eliscript_const_error(); }
|
|
15
|
+
import "eliscript/runtime/unicode-case.mjs";
|
|
16
|
+
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
17
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
18
|
+
const __eliscript_number_intrinsic = globalThis.Number;
|
|
19
|
+
const __eliscript_bigint_intrinsic = globalThis.BigInt;
|
|
20
|
+
const __eliscript_numeric_apply = globalThis.Reflect.apply;
|
|
21
|
+
const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
|
|
22
|
+
const __eliscript_numeric_error = globalThis.TypeError;
|
|
23
|
+
const __eliscript_numeric_trim = globalThis.String.prototype.trim;
|
|
24
|
+
const __eliscript_numeric_slice = globalThis.String.prototype.slice;
|
|
25
|
+
const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
|
|
26
|
+
const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
|
|
27
|
+
const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
|
|
28
|
+
const __eliscript_numeric_primitive = (value) => {
|
|
29
|
+
if (!__eliscript_numeric_object(value)) return value;
|
|
30
|
+
const exotic = value[__eliscript_numeric_symbol];
|
|
31
|
+
if (exotic !== void 0 && exotic !== null) {
|
|
32
|
+
const result = __eliscript_numeric_apply(exotic, value, ["number"]);
|
|
33
|
+
if (!__eliscript_numeric_object(result)) return result;
|
|
34
|
+
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
35
|
+
}
|
|
36
|
+
for (let index = 0; index < 2; index++) {
|
|
37
|
+
const method = value[index === 0 ? "valueOf" : "toString"];
|
|
38
|
+
if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
|
|
39
|
+
const result = __eliscript_numeric_apply(method, value, []);
|
|
40
|
+
if (!__eliscript_numeric_object(result)) return result;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
44
|
+
};
|
|
45
|
+
const __eliscript_to_number = (value) => {
|
|
46
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
47
|
+
if (typeof primitive === "string") {
|
|
48
|
+
const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
|
|
49
|
+
if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
|
|
50
|
+
let first = 2;
|
|
51
|
+
while (first < text.length && text[first] === "0") first++;
|
|
52
|
+
if (first === text.length) return 0;
|
|
53
|
+
const prefix = text[1];
|
|
54
|
+
const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
|
|
55
|
+
if (text.length - first > limit) return 1 / 0;
|
|
56
|
+
const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
|
|
57
|
+
return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return __eliscript_number_intrinsic(primitive);
|
|
61
|
+
};
|
|
62
|
+
const __eliscript_numeric = (value) => {
|
|
63
|
+
if (typeof value === "number" || typeof value === "bigint") return value;
|
|
64
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
65
|
+
if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
|
|
66
|
+
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
67
|
+
};
|
|
68
|
+
const __eliscript_implicit_number = (value) => {
|
|
69
|
+
if (typeof value === "number") return value;
|
|
70
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
71
|
+
if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
|
|
72
|
+
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
73
|
+
};
|
|
74
|
+
const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
|
|
75
|
+
const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
|
|
76
|
+
const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
|
|
77
|
+
const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
|
|
78
|
+
const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
|
|
79
|
+
const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
|
|
80
|
+
const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
|
|
81
|
+
const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
|
|
82
|
+
const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
|
|
83
|
+
const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
|
|
84
|
+
const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
|
|
85
|
+
const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
|
|
86
|
+
const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
|
|
87
|
+
const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
|
|
88
|
+
const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
|
|
89
|
+
const __eliscript_numeric_relation = (operator, left, right) => {
|
|
90
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
91
|
+
if (operator === "<") return left < right;
|
|
92
|
+
if (operator === "<=") return left <= right;
|
|
93
|
+
if (operator === ">") return left > right;
|
|
94
|
+
return left >= right;
|
|
95
|
+
}
|
|
96
|
+
let a = __eliscript_numeric_primitive(left);
|
|
97
|
+
let b = __eliscript_numeric_primitive(right);
|
|
98
|
+
const x = typeof a, y = typeof b;
|
|
99
|
+
if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
|
|
100
|
+
a = __eliscript_numeric(a);
|
|
101
|
+
b = __eliscript_numeric(b);
|
|
102
|
+
}
|
|
103
|
+
if (operator === "<") return a < b;
|
|
104
|
+
if (operator === "<=") return a <= b;
|
|
105
|
+
if (operator === ">") return a > b;
|
|
106
|
+
return a >= b;
|
|
107
|
+
};
|
|
3
108
|
|
|
4
109
|
import {binding_name, reference_name} from "./symbol.mjs";
|
|
5
110
|
import {node_kind, node_span, node_value, node_name, node_items} from "./syntax.mjs";
|
|
6
111
|
import {analyze_transients} from "./transient-analysis.mjs";
|
|
7
112
|
const builtin_operators = ["if", "when", "unless", "progn", "do", "while", "loop", "recur", "and", "or", "not", "+", "*", "-", "/", "%", "mod", "=", "/=", "not=", "<", "<=", ">", ">=", "1+", "1-", "eq", "equal", "null", "nil?", "undefined?", "nullish?", "int32", "uint32", "imul32", "bit-and", "bit-or", "bit-xor", "bit-not", "bit-shift-left", "bit-shift-right", "unsigned-bit-shift-right", "value-type", "host-identity-token", "string-code-unit-at", "string-from-code-unit", "string-to-number", "string-to-bigint", "number-float64-words", "list", "vector", "hash-map", "hash-set", "queue", "js-array", "car", "cdr", "cons", "js-cons", "nth", "js-nth", "aref", "length", "js-length", "new", "print", "str", "object-keys", "object-has?", "object-assoc", "__eliscript_arity_error", "funcall", "apply"];
|
|
113
|
+
__eliscript_tdz_ready_0 = true;
|
|
8
114
|
const portable_forbidden_operators = ["js*", "print", "put", "js-call", "new", "async", "await", "throw", "try"];
|
|
9
|
-
|
|
10
|
-
const
|
|
115
|
+
__eliscript_tdz_ready_1 = true;
|
|
116
|
+
const top_level_operators = ["defun", "defn", "defportable", "defasync", "defvar", "defconst", "export", "export-default", "import", "import-portable", "module"];
|
|
117
|
+
__eliscript_tdz_ready_2 = true;
|
|
118
|
+
const fail = ((diagnostic) => {
|
|
119
|
+
{
|
|
120
|
+
const __eliscript_value_1 = ((diagnostic)["location"])["start"];
|
|
121
|
+
{
|
|
122
|
+
let p = __eliscript_value_1;
|
|
123
|
+
{
|
|
124
|
+
const __eliscript_value_2 = new (Error)(((file_value) => {
|
|
125
|
+
return ((file) => {
|
|
126
|
+
return ((line_value) => {
|
|
127
|
+
return ((line) => {
|
|
128
|
+
return ((column_value) => {
|
|
129
|
+
return ((column) => {
|
|
130
|
+
return ((message_value) => {
|
|
131
|
+
return ((message) => {
|
|
132
|
+
return (file + ":" + line + ":" + column + ": " + message);
|
|
133
|
+
})(`${message_value}`);
|
|
134
|
+
})((diagnostic)["message"]);
|
|
135
|
+
})(`${column_value}`);
|
|
136
|
+
})((p)["column"]);
|
|
137
|
+
})(`${line_value}`);
|
|
138
|
+
})((p)["line"]);
|
|
139
|
+
})(`${file_value}`);
|
|
140
|
+
})(((diagnostic)["location"])["file"]));
|
|
141
|
+
{
|
|
142
|
+
let error = __eliscript_value_2;
|
|
143
|
+
((error)["eliscriptDiagnostic"] = diagnostic);
|
|
144
|
+
return ((__eliscript_value_3) => { throw __eliscript_value_3; })(error);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
__eliscript_tdz_ready_3 = true;
|
|
11
151
|
function compiler_fail(context, span, code, phase, message) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
152
|
+
{
|
|
153
|
+
const __eliscript_value_4 = ((__eliscript_value_5) => (__eliscript_truthy(__eliscript_value_5) ? __eliscript_value_5 : ((__eliscript_value_6) => (__eliscript_truthy(__eliscript_value_6) ? __eliscript_value_6 : "<input>"))(((__eliscript_value_7) => (__eliscript_truthy(__eliscript_value_7) ? (span)["filename"] : __eliscript_value_7))(span))))((context)["filename"]);
|
|
154
|
+
{
|
|
155
|
+
let file = __eliscript_value_4;
|
|
156
|
+
return (__eliscript_tdz_read_3())(({"format": "eliscript-diagnostic", "version": 1, "code": code, "severity": "error", "phase": phase, "message": message, "location": ({"file": file, "start": ({"offset": (__eliscript_truthy(span) ? (span)["start"] : 0), "line": (__eliscript_truthy(span) ? (span)["line"] : 1), "column": (__eliscript_truthy(span) ? (span)["column"] : 1)}), "end": ({"offset": (__eliscript_truthy(span) ? (span)["end"] : 0), "line": (__eliscript_truthy(span) ? (span)["endLine"] : 1), "column": (__eliscript_truthy(span) ? (span)["endColumn"] : 1)})})}));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
15
159
|
}
|
|
16
160
|
function analyzer_fail(context, span, message) {
|
|
17
161
|
return compiler_fail(context, span, "ELI-A0001", "analysis", message);
|
|
@@ -20,949 +164,1937 @@ function portable_fail(context, span, message) {
|
|
|
20
164
|
return compiler_fail(context, span, "ELI-P0001", "portable-analysis", message);
|
|
21
165
|
}
|
|
22
166
|
function symbol_node_p(node) {
|
|
23
|
-
return ((
|
|
167
|
+
return ((__eliscript_value_8) => (__eliscript_truthy(__eliscript_value_8) ? (node_kind(node) === "symbol") : __eliscript_value_8))(node);
|
|
24
168
|
}
|
|
25
169
|
function keyword_node_p(node) {
|
|
26
|
-
return ((
|
|
170
|
+
return ((__eliscript_value_9) => (__eliscript_truthy(__eliscript_value_9) ? (node_kind(node) === "keyword") : __eliscript_value_9))(node);
|
|
27
171
|
}
|
|
28
172
|
function vector_node_p(node) {
|
|
29
|
-
return ((
|
|
173
|
+
return ((__eliscript_value_10) => (__eliscript_truthy(__eliscript_value_10) ? (node_kind(node) === "vector") : __eliscript_value_10))(node);
|
|
30
174
|
}
|
|
31
175
|
function map_node_p(node) {
|
|
32
|
-
return ((
|
|
176
|
+
return ((__eliscript_value_11) => (__eliscript_truthy(__eliscript_value_11) ? ((__eliscript_value_12) => (__eliscript_truthy(__eliscript_value_12) ? ((__eliscript_value_13) => (__eliscript_truthy(__eliscript_value_13) ? ((__eliscript_value_14) => (__eliscript_truthy(__eliscript_value_14) ? (node_name(((((node_items(node)) ?? [])[0]) ?? null)) === "hash-map") : __eliscript_value_14))(symbol_node_p(((((node_items(node)) ?? [])[0]) ?? null))) : __eliscript_value_13))(__eliscript_numeric_relation(">", (node_items(node))["length"], 0)) : __eliscript_value_12))((node_kind(node) === "list")) : __eliscript_value_11))(node);
|
|
33
177
|
}
|
|
34
178
|
function string_node_p(node) {
|
|
35
|
-
return ((
|
|
179
|
+
return ((__eliscript_value_15) => (__eliscript_truthy(__eliscript_value_15) ? ((node_kind(node) === "literal") && (typeof node.value === "string")) : __eliscript_value_15))(node);
|
|
36
180
|
}
|
|
37
181
|
function null_node_p(node) {
|
|
38
|
-
return ((
|
|
182
|
+
return ((__eliscript_value_16) => (__eliscript_truthy(__eliscript_value_16) ? ((node_kind(node) === "literal") && (node_value(node) == null)) : __eliscript_value_16))(node);
|
|
39
183
|
}
|
|
40
184
|
function list_items(node) {
|
|
41
|
-
|
|
185
|
+
if (__eliscript_truthy(((__eliscript_value_17) => (__eliscript_truthy(__eliscript_value_17) ? (node_kind(node) === "list") : __eliscript_value_17))(node))) {
|
|
186
|
+
return node_items(node);
|
|
187
|
+
} else {
|
|
188
|
+
if (__eliscript_truthy(null_node_p(node))) {
|
|
189
|
+
return [];
|
|
190
|
+
} else {
|
|
191
|
+
return undefined;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
42
194
|
}
|
|
43
195
|
function binding_marker_p(name) {
|
|
44
|
-
return (
|
|
196
|
+
return ((name === "&optional") || (name === "&rest") || (name === "&body"));
|
|
45
197
|
}
|
|
46
198
|
function split_binding_name(name) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
199
|
+
{
|
|
200
|
+
const __eliscript_value_18 = (name)["lastIndexOf"]("/");
|
|
201
|
+
{
|
|
202
|
+
let slash = __eliscript_value_18;
|
|
203
|
+
if (__eliscript_numeric_relation("<", slash, 0)) {
|
|
204
|
+
return ({"namespace": undefined, "local": name});
|
|
205
|
+
} else {
|
|
206
|
+
return ({"namespace": (name)["slice"](0, slash), "local": (name)["slice"]((slash + 1))});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
50
210
|
}
|
|
51
211
|
function map_binding_shortcut(node) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
212
|
+
if (__eliscript_truthy(keyword_node_p(node))) {
|
|
213
|
+
{
|
|
214
|
+
let parts = split_binding_name(node_name(node));
|
|
215
|
+
let kind = (parts)["local"];
|
|
216
|
+
if (((kind === "keys") || (kind === "strs") || (kind === "syms"))) {
|
|
217
|
+
return ({"kind": kind, "namespace": (parts)["namespace"]});
|
|
218
|
+
} else {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
} else {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
57
225
|
}
|
|
58
226
|
function shortcut_entry(shortcut, name_node) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
})(((__eliscript_value_16) => (__eliscript_truthy(__eliscript_value_16) ? __eliscript_value_16 : (parts)["namespace"]))((shortcut)["namespace"]));
|
|
69
|
-
})((parts)["local"]);
|
|
70
|
-
})(split_binding_name(name));
|
|
71
|
-
})(node_name(name_node));
|
|
227
|
+
{
|
|
228
|
+
let name = node_name(name_node);
|
|
229
|
+
let parts = split_binding_name(name);
|
|
230
|
+
let local = (parts)["local"];
|
|
231
|
+
let namespace = ((__eliscript_value_19) => (__eliscript_truthy(__eliscript_value_19) ? __eliscript_value_19 : (parts)["namespace"]))((shortcut)["namespace"]);
|
|
232
|
+
let kind = (shortcut)["kind"];
|
|
233
|
+
let qualified = (__eliscript_truthy(namespace) ? (String(namespace) + String("/") + String(local)) : local);
|
|
234
|
+
return ({"target": ({"kind": "symbol", "name": local, "span": node_span(name_node)}), "keyKind": kind, "keyName": ((kind === "strs") ? name : qualified)});
|
|
235
|
+
}
|
|
72
236
|
}
|
|
73
237
|
function map_binding_key_p(node) {
|
|
74
|
-
return ((
|
|
238
|
+
return ((__eliscript_value_20) => (__eliscript_truthy(__eliscript_value_20) ? __eliscript_value_20 : ((__eliscript_value_21) => (__eliscript_truthy(__eliscript_value_21) ? ((node_kind(node) === "literal") && ((typeof node.value === "string") || (typeof node.value === "number"))) : __eliscript_value_21))(node)))(keyword_node_p(node));
|
|
75
239
|
}
|
|
76
240
|
function map_binding_spec(pattern, context) {
|
|
77
|
-
|
|
78
|
-
(()
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
241
|
+
{
|
|
242
|
+
const __eliscript_value_22 = (node_items(pattern))["slice"](1);
|
|
243
|
+
const __eliscript_value_23 = [];
|
|
244
|
+
const __eliscript_value_24 = new (globalThis.Map)();
|
|
245
|
+
const __eliscript_value_25 = undefined;
|
|
246
|
+
const __eliscript_value_26 = new (globalThis.Set)();
|
|
247
|
+
const __eliscript_value_27 = false;
|
|
248
|
+
const __eliscript_value_28 = false;
|
|
249
|
+
const __eliscript_value_29 = 0;
|
|
250
|
+
{
|
|
251
|
+
let items = __eliscript_value_22;
|
|
252
|
+
let entries = __eliscript_value_23;
|
|
253
|
+
let defaults = __eliscript_value_24;
|
|
254
|
+
let as = __eliscript_value_25;
|
|
255
|
+
let shortcuts_seen = __eliscript_value_26;
|
|
256
|
+
let or_seen = __eliscript_value_27;
|
|
257
|
+
let as_seen = __eliscript_value_28;
|
|
258
|
+
let index = __eliscript_value_29;
|
|
259
|
+
while (__eliscript_numeric_relation("<", index, (items)["length"])) {
|
|
260
|
+
{
|
|
261
|
+
let left = ((((items) ?? [])[index]) ?? null);
|
|
262
|
+
let right = ((((items) ?? [])[(index + 1)]) ?? null);
|
|
263
|
+
let directive = ((__eliscript_value_30) => (__eliscript_truthy(__eliscript_value_30) ? node_name(left) : __eliscript_value_30))(keyword_node_p(left));
|
|
264
|
+
let shortcut = map_binding_shortcut(left);
|
|
265
|
+
if (__eliscript_truthy(shortcut)) {
|
|
266
|
+
{
|
|
267
|
+
const __eliscript_value_31 = (shortcut)["kind"];
|
|
268
|
+
{
|
|
269
|
+
let kind = __eliscript_value_31;
|
|
270
|
+
if (__eliscript_truthy((shortcuts_seen)["has"](directive))) {
|
|
271
|
+
analyzer_fail(context, node_span(left), (String("map binding pattern accepts :") + String(directive) + String(" once")));
|
|
272
|
+
}
|
|
273
|
+
(shortcuts_seen)["add"](directive);
|
|
274
|
+
if ((!__eliscript_truthy(vector_node_p(right)))) {
|
|
275
|
+
analyzer_fail(context, node_span(right), (String("map binding :") + String(kind) + String(" value must be a vector")));
|
|
276
|
+
}
|
|
277
|
+
(node_items(right))["forEach"](((name_node) => {
|
|
278
|
+
{
|
|
279
|
+
const __eliscript_value_32 = ((__eliscript_value_33) => (__eliscript_truthy(__eliscript_value_33) ? node_name(name_node) : __eliscript_value_33))(symbol_node_p(name_node));
|
|
280
|
+
{
|
|
281
|
+
let name = __eliscript_value_32;
|
|
282
|
+
if ((!__eliscript_truthy(((__eliscript_value_34) => (__eliscript_truthy(__eliscript_value_34) ? ((!__eliscript_truthy(binding_marker_p(name))) && __eliscript_numeric_relation(">", ((split_binding_name(name))["local"])["length"], 0)) : __eliscript_value_34))(name)))) {
|
|
283
|
+
analyzer_fail(context, node_span(name_node), (String("map binding :") + String(kind) + String(" entries must be symbols")));
|
|
284
|
+
}
|
|
91
285
|
return (entries)["push"](shortcut_entry(shortcut, name_node));
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}));
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
} else {
|
|
292
|
+
if ((directive === "or")) {
|
|
293
|
+
if (__eliscript_truthy(or_seen)) {
|
|
294
|
+
analyzer_fail(context, node_span(left), "map binding pattern accepts :or once");
|
|
295
|
+
}
|
|
296
|
+
((or_seen = true));
|
|
297
|
+
if ((!__eliscript_truthy(map_node_p(right)))) {
|
|
298
|
+
analyzer_fail(context, node_span(right), "map binding :or value must be a map");
|
|
299
|
+
}
|
|
300
|
+
{
|
|
301
|
+
const __eliscript_value_35 = (node_items(right))["slice"](1);
|
|
302
|
+
const __eliscript_value_36 = 0;
|
|
303
|
+
{
|
|
304
|
+
let pairs = __eliscript_value_35;
|
|
305
|
+
let default_index = __eliscript_value_36;
|
|
306
|
+
while (__eliscript_numeric_relation("<", default_index, (pairs)["length"])) {
|
|
307
|
+
{
|
|
308
|
+
let name_node = ((((pairs) ?? [])[default_index]) ?? null);
|
|
309
|
+
let default$ = ((((pairs) ?? [])[(default_index + 1)]) ?? null);
|
|
310
|
+
let name = ((__eliscript_value_37) => (__eliscript_truthy(__eliscript_value_37) ? node_name(name_node) : __eliscript_value_37))(symbol_node_p(name_node));
|
|
311
|
+
if ((!__eliscript_truthy(((__eliscript_value_38) => (__eliscript_truthy(__eliscript_value_38) ? (!__eliscript_truthy(binding_marker_p(name))) : __eliscript_value_38))(name)))) {
|
|
312
|
+
analyzer_fail(context, node_span(name_node), "map binding :or keys must be binding symbols");
|
|
113
313
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
314
|
+
if (__eliscript_truthy((defaults)["has"](name))) {
|
|
315
|
+
analyzer_fail(context, node_span(name_node), "duplicate map binding :or default");
|
|
316
|
+
}
|
|
317
|
+
(defaults)["set"](name, default$);
|
|
318
|
+
}
|
|
319
|
+
((default_index = (default_index + 2)));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
} else {
|
|
324
|
+
if ((directive === "as")) {
|
|
325
|
+
if (__eliscript_truthy(as_seen)) {
|
|
326
|
+
analyzer_fail(context, node_span(left), "map binding pattern accepts :as once");
|
|
327
|
+
}
|
|
328
|
+
((as_seen = true));
|
|
329
|
+
if ((!__eliscript_truthy(((__eliscript_value_39) => (__eliscript_truthy(__eliscript_value_39) ? (!__eliscript_truthy(binding_marker_p(node_name(right)))) : __eliscript_value_39))(symbol_node_p(right))))) {
|
|
330
|
+
analyzer_fail(context, node_span(right), "map binding :as value must be a symbol");
|
|
331
|
+
}
|
|
332
|
+
((as = right));
|
|
333
|
+
} else {
|
|
334
|
+
if (__eliscript_truthy(directive)) {
|
|
335
|
+
analyzer_fail(context, node_span(left), (String("unknown map binding directive: :") + String(directive)));
|
|
336
|
+
} else {
|
|
337
|
+
if ((!__eliscript_truthy(binding_pattern_p(left)))) {
|
|
338
|
+
analyzer_fail(context, node_span(left), "map binding entry target must be a binding pattern");
|
|
339
|
+
}
|
|
340
|
+
if ((!__eliscript_truthy(map_binding_key_p(right)))) {
|
|
341
|
+
analyzer_fail(context, node_span(right), "map binding entry key must be a keyword, string, or number");
|
|
342
|
+
}
|
|
343
|
+
(entries)["push"](({"target": left, "key": right}));
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
131
349
|
((index = (index + 2)));
|
|
132
350
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
351
|
+
(defaults)["forEach"](((default$, name) => {
|
|
352
|
+
{
|
|
353
|
+
const __eliscript_value_40 = (entries)["find"](((candidate) => {
|
|
354
|
+
return ((__eliscript_value_41) => (__eliscript_truthy(__eliscript_value_41) ? (node_name((candidate)["target"]) === name) : __eliscript_value_41))(symbol_node_p((candidate)["target"]));
|
|
355
|
+
}));
|
|
356
|
+
{
|
|
357
|
+
let entry = __eliscript_value_40;
|
|
358
|
+
if ((!__eliscript_truthy(entry))) {
|
|
359
|
+
analyzer_fail(context, node_span(default$), (String("map binding :or has no scalar target: ") + String(name)));
|
|
360
|
+
}
|
|
361
|
+
((entry)["default"] = default$);
|
|
362
|
+
return ((entry)["hasDefault"] = true);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
142
365
|
}));
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
366
|
+
return ({"entries": entries, "as": as});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
146
369
|
}
|
|
147
370
|
function binding_nodes(pattern, context) {
|
|
148
|
-
|
|
149
|
-
(
|
|
150
|
-
return ((
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
371
|
+
if (__eliscript_truthy(symbol_node_p(pattern))) {
|
|
372
|
+
if (__eliscript_truthy(binding_marker_p(node_name(pattern)))) {
|
|
373
|
+
return analyzer_fail(context, node_span(pattern), "invalid binding pattern marker");
|
|
374
|
+
} else {
|
|
375
|
+
return [pattern];
|
|
376
|
+
}
|
|
377
|
+
} else {
|
|
378
|
+
if (__eliscript_truthy(vector_node_p(pattern))) {
|
|
379
|
+
{
|
|
380
|
+
const __eliscript_value_42 = [];
|
|
381
|
+
const __eliscript_value_43 = false;
|
|
382
|
+
const __eliscript_value_44 = false;
|
|
383
|
+
{
|
|
384
|
+
let result = __eliscript_value_42;
|
|
385
|
+
let rest_seen = __eliscript_value_43;
|
|
386
|
+
let rest_done = __eliscript_value_44;
|
|
387
|
+
(node_items(pattern))["forEach"](((element) => {
|
|
388
|
+
{
|
|
389
|
+
const __eliscript_value_45 = ((__eliscript_value_46) => (__eliscript_truthy(__eliscript_value_46) ? node_name(element) : __eliscript_value_46))(symbol_node_p(element));
|
|
390
|
+
{
|
|
391
|
+
let name = __eliscript_value_45;
|
|
392
|
+
if ((name === "&rest")) {
|
|
393
|
+
if (__eliscript_truthy(((__eliscript_value_47) => (__eliscript_truthy(__eliscript_value_47) ? __eliscript_value_47 : rest_done))(rest_seen))) {
|
|
394
|
+
analyzer_fail(context, node_span(element), "invalid vector binding pattern");
|
|
395
|
+
}
|
|
396
|
+
return ((rest_seen = true));
|
|
397
|
+
} else {
|
|
398
|
+
if (__eliscript_truthy(rest_seen)) {
|
|
399
|
+
if ((!__eliscript_truthy(((__eliscript_value_48) => (__eliscript_truthy(__eliscript_value_48) ? (!__eliscript_truthy(binding_marker_p(name))) : __eliscript_value_48))(name)))) {
|
|
400
|
+
analyzer_fail(context, node_span(element), "vector &rest binding must be a symbol");
|
|
401
|
+
}
|
|
402
|
+
(result)["push"](element);
|
|
403
|
+
((rest_seen = false));
|
|
404
|
+
return ((rest_done = true));
|
|
405
|
+
} else {
|
|
406
|
+
if (__eliscript_truthy(rest_done)) {
|
|
407
|
+
return analyzer_fail(context, node_span(element), "vector &rest binding must be final");
|
|
408
|
+
} else {
|
|
409
|
+
if (__eliscript_truthy(null_node_p(element))) {
|
|
410
|
+
return null;
|
|
411
|
+
} else {
|
|
412
|
+
return (binding_nodes(element, context))["forEach"](((binding) => {
|
|
413
|
+
return (result)["push"](binding);
|
|
414
|
+
}));
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}));
|
|
422
|
+
if (__eliscript_truthy(rest_seen)) {
|
|
423
|
+
analyzer_fail(context, node_span(pattern), "vector &rest requires a binding");
|
|
424
|
+
}
|
|
425
|
+
return result;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
} else {
|
|
429
|
+
if (__eliscript_truthy(map_node_p(pattern))) {
|
|
430
|
+
{
|
|
431
|
+
let spec = map_binding_spec(pattern, context);
|
|
432
|
+
let result = [];
|
|
433
|
+
((spec)["entries"])["forEach"](((entry) => {
|
|
434
|
+
return (binding_nodes((entry)["target"], context))["forEach"](((binding) => {
|
|
435
|
+
return (result)["push"](binding);
|
|
436
|
+
}));
|
|
437
|
+
}));
|
|
438
|
+
if (__eliscript_truthy((spec)["as"])) {
|
|
439
|
+
(result)["push"]((spec)["as"]);
|
|
440
|
+
}
|
|
441
|
+
return result;
|
|
442
|
+
}
|
|
443
|
+
} else {
|
|
444
|
+
return analyzer_fail(context, ((__eliscript_value_49) => (__eliscript_truthy(__eliscript_value_49) ? node_span(pattern) : __eliscript_value_49))(pattern), (String("binding pattern must be a symbol, vector, or map: ") + String(node_display(pattern))));
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
179
448
|
}
|
|
180
449
|
function binding_pattern_p(node) {
|
|
181
|
-
return ((
|
|
450
|
+
return ((__eliscript_value_50) => (__eliscript_truthy(__eliscript_value_50) ? __eliscript_value_50 : ((__eliscript_value_52) => (__eliscript_truthy(__eliscript_value_52) ? __eliscript_value_52 : map_node_p(node)))(vector_node_p(node))))(((__eliscript_value_51) => (__eliscript_truthy(__eliscript_value_51) ? (!__eliscript_truthy(binding_marker_p(node_name(node)))) : __eliscript_value_51))(symbol_node_p(node)));
|
|
182
451
|
}
|
|
183
452
|
function function_parameters(parameters, context) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
453
|
+
{
|
|
454
|
+
const __eliscript_value_53 = list_items(parameters);
|
|
455
|
+
const __eliscript_value_54 = [];
|
|
456
|
+
const __eliscript_value_55 = "required";
|
|
457
|
+
const __eliscript_value_56 = 0;
|
|
458
|
+
{
|
|
459
|
+
let items = __eliscript_value_53;
|
|
460
|
+
let parsed = __eliscript_value_54;
|
|
461
|
+
let mode = __eliscript_value_55;
|
|
462
|
+
let index = __eliscript_value_56;
|
|
463
|
+
if ((items === undefined)) {
|
|
464
|
+
analyzer_fail(context, node_span(parameters), "function arguments must be a list");
|
|
465
|
+
}
|
|
466
|
+
while (__eliscript_numeric_relation("<", index, (items)["length"])) {
|
|
467
|
+
{
|
|
468
|
+
let parameter = ((((items) ?? [])[index]) ?? null);
|
|
469
|
+
let name = ((__eliscript_value_57) => (__eliscript_truthy(__eliscript_value_57) ? node_name(parameter) : __eliscript_value_57))(symbol_node_p(parameter));
|
|
470
|
+
if ((name === "&optional")) {
|
|
471
|
+
if ((!(mode === "required"))) {
|
|
472
|
+
analyzer_fail(context, node_span(parameter), "invalid function parameter list");
|
|
473
|
+
}
|
|
474
|
+
((mode = "optional"));
|
|
475
|
+
} else {
|
|
476
|
+
if ((name === "&rest")) {
|
|
477
|
+
if ((!((mode === "required") || (mode === "optional")))) {
|
|
478
|
+
analyzer_fail(context, node_span(parameter), "invalid function parameter list");
|
|
479
|
+
}
|
|
480
|
+
((mode = "rest"));
|
|
481
|
+
} else {
|
|
482
|
+
if ((name === "&body")) {
|
|
483
|
+
analyzer_fail(context, node_span(parameter), "invalid function parameter list");
|
|
484
|
+
} else {
|
|
485
|
+
if ((mode === "rest")) {
|
|
486
|
+
if ((!__eliscript_truthy(((__eliscript_value_58) => (__eliscript_truthy(__eliscript_value_58) ? (!__eliscript_truthy(binding_marker_p(name))) : __eliscript_value_58))(name)))) {
|
|
487
|
+
analyzer_fail(context, node_span(parameter), "function &rest parameter must be a symbol");
|
|
488
|
+
}
|
|
489
|
+
(parsed)["push"](({"kind": "rest", "node": parameter, "bindings": [parameter]}));
|
|
490
|
+
((mode = "done"));
|
|
491
|
+
} else {
|
|
492
|
+
if ((mode === "done")) {
|
|
493
|
+
analyzer_fail(context, node_span(parameter), "invalid function parameter list");
|
|
494
|
+
} else {
|
|
495
|
+
if (__eliscript_truthy(binding_pattern_p(parameter))) {
|
|
496
|
+
(parsed)["push"](({"kind": mode, "node": parameter, "bindings": binding_nodes(parameter, context)}));
|
|
497
|
+
} else {
|
|
498
|
+
analyzer_fail(context, node_span(parameter), (String("function arguments must be symbols, vectors, or maps: ") + String(node_display(parameters))));
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
203
506
|
((index = (index + 1)));
|
|
204
507
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
508
|
+
if ((mode === "rest")) {
|
|
509
|
+
analyzer_fail(context, node_span(parameters), "invalid function parameter list");
|
|
510
|
+
}
|
|
511
|
+
return parsed;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
210
514
|
}
|
|
211
515
|
function node_display(node) {
|
|
212
|
-
|
|
213
|
-
return
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return
|
|
217
|
-
}
|
|
218
|
-
|
|
516
|
+
if ((!__eliscript_truthy(node))) {
|
|
517
|
+
return "nil";
|
|
518
|
+
} else {
|
|
519
|
+
if ((node_kind(node) === "undefined")) {
|
|
520
|
+
return "undefined";
|
|
521
|
+
} else {
|
|
522
|
+
if ((node_kind(node) === "symbol")) {
|
|
523
|
+
return node_name(node);
|
|
524
|
+
} else {
|
|
525
|
+
if ((node_kind(node) === "keyword")) {
|
|
526
|
+
return (String(":") + String(node_name(node)));
|
|
527
|
+
} else {
|
|
528
|
+
if ((node_kind(node) === "literal")) {
|
|
529
|
+
{
|
|
530
|
+
const __eliscript_value_59 = node_value(node);
|
|
531
|
+
{
|
|
532
|
+
let value = __eliscript_value_59;
|
|
533
|
+
if ((value == null)) {
|
|
534
|
+
return "nil";
|
|
535
|
+
} else {
|
|
536
|
+
if ((value === true)) {
|
|
537
|
+
return "t";
|
|
538
|
+
} else {
|
|
539
|
+
if ((value === false)) {
|
|
540
|
+
return "false";
|
|
541
|
+
} else {
|
|
542
|
+
if ((typeof value === "string")) {
|
|
543
|
+
return (JSON)["stringify"](value);
|
|
544
|
+
} else {
|
|
545
|
+
return (String(value));
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
} else {
|
|
553
|
+
if (((node_kind(node) === "list") || (node_kind(node) === "vector"))) {
|
|
554
|
+
{
|
|
555
|
+
let items = node_items(node);
|
|
556
|
+
let contents = __eliscript_at_direct((items)["map"](node_display), "join", " ");
|
|
557
|
+
if (__eliscript_truthy(((__eliscript_value_60) => (__eliscript_truthy(__eliscript_value_60) ? ((__eliscript_value_61) => (__eliscript_truthy(__eliscript_value_61) ? ((__eliscript_value_62) => (__eliscript_truthy(__eliscript_value_62) ? (node_name(((((items) ?? [])[0]) ?? null)) === "quote") : __eliscript_value_62))(symbol_node_p(((((items) ?? [])[0]) ?? null))) : __eliscript_value_61))(((items)["length"] === 2)) : __eliscript_value_60))((node_kind(node) === "list")))) {
|
|
558
|
+
return (String("'") + String(node_display(((((items) ?? [])[1]) ?? null))));
|
|
559
|
+
} else {
|
|
560
|
+
if ((node_kind(node) === "list")) {
|
|
561
|
+
return (String("(") + String(contents) + String(")"));
|
|
562
|
+
} else {
|
|
563
|
+
return (String("[") + String(contents) + String("]"));
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
} else {
|
|
568
|
+
return "<unsupported>";
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
219
575
|
}
|
|
220
576
|
function make_scope(parent, function_context = null) {
|
|
221
|
-
return ({"parent": parent, "names":
|
|
577
|
+
return ({"parent": parent, "names": null, "outputs": null, "bindingEpoch": (__eliscript_truthy(parent) ? (parent)["bindingEpoch"] : ({"value": 0})), "lookupCache": undefined, "lookupEpoch": -1, "functionContext": ((__eliscript_value_63) => (__eliscript_truthy(__eliscript_value_63) ? __eliscript_value_63 : ((__eliscript_value_64) => (__eliscript_truthy(__eliscript_value_64) ? (parent)["functionContext"] : __eliscript_value_64))(parent)))(function_context)});
|
|
222
578
|
}
|
|
223
579
|
function async_function_p(scope) {
|
|
224
|
-
return ((
|
|
225
|
-
(() => {
|
|
226
|
-
while (__eliscript_truthy(((__eliscript_value_43) => (__eliscript_truthy(__eliscript_value_43) ? (!__eliscript_truthy(function_context)) : __eliscript_value_43))(current))) {
|
|
227
|
-
((function_context = (current)["functionContext"]));
|
|
228
|
-
((current = (current)["parent"]));
|
|
229
|
-
}
|
|
230
|
-
return null;
|
|
231
|
-
})();
|
|
232
|
-
return (function_context === "async");
|
|
233
|
-
})(scope, null);
|
|
580
|
+
return ((scope)["functionContext"] === "async");
|
|
234
581
|
}
|
|
235
582
|
function guarded_binding_name(name, context, span) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
583
|
+
{
|
|
584
|
+
let cache = (context)["bindingNames"];
|
|
585
|
+
let cached = ((__eliscript_value_65) => (__eliscript_truthy(__eliscript_value_65) ? (cache)["get"](name) : __eliscript_value_65))(cache);
|
|
586
|
+
if (__eliscript_truthy(cached)) {
|
|
587
|
+
return cached;
|
|
588
|
+
} else {
|
|
589
|
+
{
|
|
590
|
+
const __eliscript_value_66 = (() => {
|
|
591
|
+
try {
|
|
592
|
+
return binding_name(name);
|
|
593
|
+
} catch (error) {
|
|
594
|
+
return analyzer_fail(context, span, (error)["message"]);
|
|
595
|
+
}
|
|
596
|
+
})();
|
|
597
|
+
{
|
|
598
|
+
let result = __eliscript_value_66;
|
|
599
|
+
if ((typeof name === "string")) {
|
|
600
|
+
if ((!__eliscript_truthy(cache))) {
|
|
601
|
+
((cache = new (Map)()));
|
|
602
|
+
((context)["bindingNames"] = cache);
|
|
603
|
+
}
|
|
604
|
+
(cache)["set"](name, result);
|
|
605
|
+
}
|
|
606
|
+
return result;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
241
611
|
}
|
|
242
612
|
function guarded_reference_name(name, context, span) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
613
|
+
{
|
|
614
|
+
let cache = (context)["referenceNames"];
|
|
615
|
+
let cached = ((__eliscript_value_67) => (__eliscript_truthy(__eliscript_value_67) ? (cache)["get"](name) : __eliscript_value_67))(cache);
|
|
616
|
+
if (__eliscript_truthy(cached)) {
|
|
617
|
+
return cached;
|
|
618
|
+
} else {
|
|
619
|
+
{
|
|
620
|
+
const __eliscript_value_68 = (() => {
|
|
621
|
+
try {
|
|
622
|
+
return reference_name(name);
|
|
623
|
+
} catch (error) {
|
|
624
|
+
return analyzer_fail(context, span, (error)["message"]);
|
|
625
|
+
}
|
|
626
|
+
})();
|
|
627
|
+
{
|
|
628
|
+
let result = __eliscript_value_68;
|
|
629
|
+
if ((typeof name === "string")) {
|
|
630
|
+
if ((!__eliscript_truthy(cache))) {
|
|
631
|
+
((cache = new (Map)()));
|
|
632
|
+
((context)["referenceNames"] = cache);
|
|
633
|
+
}
|
|
634
|
+
(cache)["set"](name, result);
|
|
635
|
+
}
|
|
636
|
+
return result;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
248
641
|
}
|
|
249
642
|
function declare_binding(scope, name_node, kind, mutable, context) {
|
|
250
|
-
(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
643
|
+
if ((!__eliscript_truthy(symbol_node_p(name_node)))) {
|
|
644
|
+
analyzer_fail(context, ((__eliscript_value_69) => (__eliscript_truthy(__eliscript_value_69) ? node_span(name_node) : __eliscript_value_69))(name_node), (String("expected binding name, got ") + String(node_display(name_node))));
|
|
645
|
+
}
|
|
646
|
+
{
|
|
647
|
+
let name = node_name(name_node);
|
|
648
|
+
let span = node_span(name_node);
|
|
649
|
+
let names = (scope)["names"];
|
|
650
|
+
let outputs = (scope)["outputs"];
|
|
651
|
+
let output_name = guarded_binding_name(name, context, span);
|
|
652
|
+
let existing_name = ((__eliscript_value_70) => (__eliscript_truthy(__eliscript_value_70) ? (names)["get"](name) : __eliscript_value_70))(names);
|
|
653
|
+
let existing_output = ((__eliscript_value_71) => (__eliscript_truthy(__eliscript_value_71) ? (outputs)["get"](output_name) : __eliscript_value_71))(outputs);
|
|
654
|
+
if (__eliscript_truthy(existing_name)) {
|
|
655
|
+
analyzer_fail(context, span, (String("duplicate ") + String(kind) + String(" binding: ") + String(name)));
|
|
656
|
+
}
|
|
657
|
+
if (__eliscript_truthy(existing_output)) {
|
|
658
|
+
analyzer_fail(context, span, (String("binding ") + String(name) + String(" emits ") + String(output_name) + String(", which collides with ") + String((existing_output)["name"])));
|
|
659
|
+
}
|
|
660
|
+
{
|
|
661
|
+
const __eliscript_value_72 = ({"name": name, "outputName": output_name, "kind": kind, "mutable": mutable});
|
|
662
|
+
{
|
|
663
|
+
let binding = __eliscript_value_72;
|
|
664
|
+
if ((!__eliscript_truthy(names))) {
|
|
665
|
+
((names = new (Map)()));
|
|
666
|
+
((scope)["names"] = names);
|
|
667
|
+
((outputs = new (Map)()));
|
|
668
|
+
((scope)["outputs"] = outputs);
|
|
669
|
+
}
|
|
670
|
+
(names)["set"](name, binding);
|
|
671
|
+
(outputs)["set"](output_name, binding);
|
|
672
|
+
{
|
|
673
|
+
const __eliscript_value_73 = (scope)["bindingEpoch"];
|
|
674
|
+
{
|
|
675
|
+
let epoch = __eliscript_value_73;
|
|
676
|
+
((epoch)["value"] = ((epoch)["value"] + 1));
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
return binding;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
274
683
|
}
|
|
275
684
|
function declare_pattern(scope, pattern, kind, mutable, context) {
|
|
276
|
-
|
|
277
|
-
return declare_binding(scope,
|
|
278
|
-
}
|
|
685
|
+
if (__eliscript_truthy(((__eliscript_value_74) => (__eliscript_truthy(__eliscript_value_74) ? (!__eliscript_truthy(binding_marker_p(node_name(pattern)))) : __eliscript_value_74))(symbol_node_p(pattern)))) {
|
|
686
|
+
return declare_binding(scope, pattern, kind, mutable, context);
|
|
687
|
+
} else {
|
|
688
|
+
{
|
|
689
|
+
const __eliscript_value_75 = binding_nodes(pattern, context);
|
|
690
|
+
const __eliscript_value_76 = 0;
|
|
691
|
+
{
|
|
692
|
+
let bindings = __eliscript_value_75;
|
|
693
|
+
let index = __eliscript_value_76;
|
|
694
|
+
while (__eliscript_numeric_relation("<", index, (bindings)["length"])) {
|
|
695
|
+
declare_binding(scope, ((((bindings) ?? [])[index]) ?? null), kind, mutable, context);
|
|
696
|
+
((index = (index + 1)));
|
|
697
|
+
}
|
|
698
|
+
return null;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
279
702
|
}
|
|
280
703
|
function lookup_binding(scope, name) {
|
|
281
|
-
|
|
282
|
-
(
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
704
|
+
{
|
|
705
|
+
let names = (scope)["names"];
|
|
706
|
+
let binding = ((__eliscript_value_77) => (__eliscript_truthy(__eliscript_value_77) ? (names)["get"](name) : __eliscript_value_77))(names);
|
|
707
|
+
let current = (scope)["parent"];
|
|
708
|
+
if (__eliscript_truthy(((__eliscript_value_78) => (__eliscript_truthy(__eliscript_value_78) ? __eliscript_value_78 : (!__eliscript_truthy(current))))(binding))) {
|
|
709
|
+
return binding;
|
|
710
|
+
} else {
|
|
711
|
+
{
|
|
712
|
+
let epoch = ((scope)["bindingEpoch"])["value"];
|
|
713
|
+
let cache = (scope)["lookupCache"];
|
|
714
|
+
if (__eliscript_truthy(((__eliscript_value_79) => (__eliscript_truthy(__eliscript_value_79) ? (!(epoch === (scope)["lookupEpoch"])) : __eliscript_value_79))(cache))) {
|
|
715
|
+
(cache)["clear"]();
|
|
716
|
+
((scope)["lookupEpoch"] = epoch);
|
|
717
|
+
}
|
|
718
|
+
((binding = ((__eliscript_value_80) => (__eliscript_truthy(__eliscript_value_80) ? (cache)["get"](name) : __eliscript_value_80))(cache)));
|
|
719
|
+
if ((!__eliscript_truthy(binding))) {
|
|
720
|
+
while (__eliscript_truthy(((__eliscript_value_81) => (__eliscript_truthy(__eliscript_value_81) ? (!__eliscript_truthy(binding)) : __eliscript_value_81))(current))) {
|
|
721
|
+
{
|
|
722
|
+
const __eliscript_value_82 = (current)["names"];
|
|
723
|
+
{
|
|
724
|
+
let parent_names = __eliscript_value_82;
|
|
725
|
+
if (__eliscript_truthy(parent_names)) {
|
|
726
|
+
((binding = (parent_names)["get"](name)));
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
((current = (current)["parent"]));
|
|
731
|
+
}
|
|
732
|
+
if (__eliscript_truthy(binding)) {
|
|
733
|
+
if ((!__eliscript_truthy(cache))) {
|
|
734
|
+
((cache = new (Map)()));
|
|
735
|
+
((scope)["lookupCache"] = cache);
|
|
736
|
+
((scope)["lookupEpoch"] = epoch);
|
|
737
|
+
}
|
|
738
|
+
(cache)["set"](name, binding);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
return binding;
|
|
286
742
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
return binding;
|
|
290
|
-
})(scope, undefined);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
291
745
|
}
|
|
292
746
|
function require_binding(scope, node, context) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
747
|
+
{
|
|
748
|
+
let name = node_name(node);
|
|
749
|
+
let binding = lookup_binding(scope, name);
|
|
750
|
+
return ((__eliscript_value_83) => (__eliscript_truthy(__eliscript_value_83) ? __eliscript_value_83 : analyzer_fail(context, node_span(node), (String("unbound symbol: ") + String(name)))))(binding);
|
|
751
|
+
}
|
|
298
752
|
}
|
|
299
753
|
function qualified_name_p(name) {
|
|
300
|
-
return ((
|
|
754
|
+
return ((__eliscript_value_84) => (__eliscript_truthy(__eliscript_value_84) ? __eliscript_value_84 : (name)["includes"]("/")))((name)["includes"]("."));
|
|
301
755
|
}
|
|
302
756
|
function analyze_sequence(forms, scope, context) {
|
|
303
|
-
|
|
304
|
-
(
|
|
305
|
-
|
|
306
|
-
|
|
757
|
+
{
|
|
758
|
+
const __eliscript_value_85 = (context)["tailPosition"];
|
|
759
|
+
const __eliscript_value_86 = 0;
|
|
760
|
+
{
|
|
761
|
+
let tail_position = __eliscript_value_85;
|
|
762
|
+
let index = __eliscript_value_86;
|
|
763
|
+
if (__eliscript_truthy(((__eliscript_value_87) => (__eliscript_truthy(__eliscript_value_87) ? __eliscript_numeric_relation(">", (forms)["length"], 1) : __eliscript_value_87))(tail_position))) {
|
|
764
|
+
((context)["tailPosition"] = false);
|
|
765
|
+
}
|
|
766
|
+
while (__eliscript_numeric_relation("<", index, (forms)["length"])) {
|
|
767
|
+
if (__eliscript_truthy(((__eliscript_value_88) => (__eliscript_truthy(__eliscript_value_88) ? (index === __eliscript_numeric_decrement((forms)["length"])) : __eliscript_value_88))(tail_position))) {
|
|
768
|
+
((context)["tailPosition"] = tail_position);
|
|
769
|
+
}
|
|
307
770
|
analyze_expression(((((forms) ?? [])[index]) ?? null), scope, context);
|
|
308
771
|
((index = (index + 1)));
|
|
309
772
|
}
|
|
310
773
|
return null;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
})((context)["tailPosition"], 0);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
314
776
|
}
|
|
315
777
|
function analyze_non_tail(form, scope, context) {
|
|
316
|
-
|
|
317
|
-
(
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
778
|
+
{
|
|
779
|
+
const __eliscript_value_89 = (context)["tailPosition"];
|
|
780
|
+
{
|
|
781
|
+
let tail_position = __eliscript_value_89;
|
|
782
|
+
if (__eliscript_truthy(tail_position)) {
|
|
783
|
+
((context)["tailPosition"] = false);
|
|
784
|
+
analyze_expression(form, scope, context);
|
|
785
|
+
return ((context)["tailPosition"] = tail_position);
|
|
786
|
+
} else {
|
|
787
|
+
return analyze_expression(form, scope, context);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
321
791
|
}
|
|
322
792
|
function analyze_pattern_defaults(pattern, scope, context) {
|
|
323
|
-
|
|
324
|
-
return (
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
793
|
+
if (__eliscript_truthy(vector_node_p(pattern))) {
|
|
794
|
+
return (node_items(pattern))["forEach"](((element) => {
|
|
795
|
+
if ((!__eliscript_truthy(((__eliscript_value_90) => (__eliscript_truthy(__eliscript_value_90) ? __eliscript_value_90 : ((__eliscript_value_91) => (__eliscript_truthy(__eliscript_value_91) ? (node_name(element) === "&rest") : __eliscript_value_91))(symbol_node_p(element))))(null_node_p(element))))) {
|
|
796
|
+
return analyze_pattern_defaults(element, scope, context);
|
|
797
|
+
} else {
|
|
798
|
+
return null;
|
|
799
|
+
}
|
|
800
|
+
}));
|
|
801
|
+
} else {
|
|
802
|
+
if (__eliscript_truthy(map_node_p(pattern))) {
|
|
803
|
+
{
|
|
804
|
+
const __eliscript_value_92 = map_binding_spec(pattern, context);
|
|
805
|
+
{
|
|
806
|
+
let spec = __eliscript_value_92;
|
|
807
|
+
return ((spec)["entries"])["forEach"](((entry) => {
|
|
808
|
+
if (__eliscript_truthy((entry)["hasDefault"])) {
|
|
809
|
+
analyze_non_tail((entry)["default"], scope, context);
|
|
810
|
+
}
|
|
811
|
+
return analyze_pattern_defaults((entry)["target"], scope, context);
|
|
812
|
+
}));
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
} else {
|
|
816
|
+
return null;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
331
819
|
}
|
|
332
820
|
function analyze_non_tail_sequence(forms, scope, context) {
|
|
333
|
-
|
|
334
|
-
(
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
821
|
+
{
|
|
822
|
+
const __eliscript_value_93 = (context)["tailPosition"];
|
|
823
|
+
{
|
|
824
|
+
let tail_position = __eliscript_value_93;
|
|
825
|
+
if (__eliscript_truthy(tail_position)) {
|
|
826
|
+
((context)["tailPosition"] = false);
|
|
827
|
+
analyze_sequence(forms, scope, context);
|
|
828
|
+
return ((context)["tailPosition"] = tail_position);
|
|
829
|
+
} else {
|
|
830
|
+
return analyze_sequence(forms, scope, context);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
338
834
|
}
|
|
339
835
|
function binding_pair(binding, context) {
|
|
340
|
-
|
|
341
|
-
|
|
836
|
+
if (__eliscript_truthy(binding_pattern_p(binding))) {
|
|
837
|
+
if ((!__eliscript_truthy(symbol_node_p(binding)))) {
|
|
838
|
+
binding_nodes(binding, context);
|
|
839
|
+
}
|
|
342
840
|
return [binding, undefined];
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
841
|
+
} else {
|
|
842
|
+
{
|
|
843
|
+
const __eliscript_value_94 = list_items(binding);
|
|
844
|
+
{
|
|
845
|
+
let items = __eliscript_value_94;
|
|
846
|
+
if (__eliscript_truthy(((__eliscript_value_95) => (__eliscript_truthy(__eliscript_value_95) ? ((__eliscript_value_96) => (__eliscript_truthy(__eliscript_value_96) ? ((__eliscript_value_97) => (__eliscript_truthy(__eliscript_value_97) ? binding_pattern_p(((((items) ?? [])[0]) ?? null)) : __eliscript_value_97))(__eliscript_numeric_relation("<=", (items)["length"], 2)) : __eliscript_value_96))(__eliscript_numeric_relation(">=", (items)["length"], 1)) : __eliscript_value_95))((!(items === undefined))))) {
|
|
847
|
+
if ((!__eliscript_truthy(symbol_node_p(((((items) ?? [])[0]) ?? null))))) {
|
|
848
|
+
binding_nodes(((((items) ?? [])[0]) ?? null), context);
|
|
849
|
+
}
|
|
850
|
+
return [((((items) ?? [])[0]) ?? null), ((((items) ?? [])[1]) ?? null)];
|
|
851
|
+
} else {
|
|
852
|
+
return analyzer_fail(context, node_span(binding), (String("invalid let binding: ") + String(node_display(binding))));
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
}
|
|
349
857
|
}
|
|
350
858
|
function analyze_let(args, scope, sequential, context, form_span) {
|
|
351
|
-
(
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
859
|
+
if (((args)["length"] === 0)) {
|
|
860
|
+
analyzer_fail(context, form_span, (String((__eliscript_truthy(sequential) ? "let*" : "let")) + String(" requires a binding list")));
|
|
861
|
+
}
|
|
862
|
+
{
|
|
863
|
+
let bindings_form = ((((args) ?? [])[0]) ?? null);
|
|
864
|
+
let bindings = list_items(bindings_form);
|
|
865
|
+
let body = (args)["slice"](1);
|
|
866
|
+
let child = make_scope(scope);
|
|
867
|
+
let index = 0;
|
|
868
|
+
if ((bindings === undefined)) {
|
|
869
|
+
analyzer_fail(context, node_span(bindings_form), "let bindings must be a list");
|
|
870
|
+
}
|
|
871
|
+
if (__eliscript_truthy(sequential)) {
|
|
872
|
+
while (__eliscript_numeric_relation("<", index, (bindings)["length"])) {
|
|
873
|
+
{
|
|
874
|
+
const __eliscript_value_98 = binding_pair(((((bindings) ?? [])[index]) ?? null), context);
|
|
875
|
+
{
|
|
876
|
+
let pair = __eliscript_value_98;
|
|
877
|
+
analyze_non_tail(((((pair) ?? [])[1]) ?? null), child, context);
|
|
878
|
+
analyze_pattern_defaults(((((pair) ?? [])[0]) ?? null), child, context);
|
|
879
|
+
declare_pattern(child, ((((pair) ?? [])[0]) ?? null), "local", true, context);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
((index = (index + 1)));
|
|
883
|
+
}
|
|
884
|
+
} else {
|
|
885
|
+
{
|
|
886
|
+
const __eliscript_value_99 = [];
|
|
887
|
+
{
|
|
888
|
+
let parsed = __eliscript_value_99;
|
|
889
|
+
while (__eliscript_numeric_relation("<", index, (bindings)["length"])) {
|
|
890
|
+
(parsed)["push"](binding_pair(((((bindings) ?? [])[index]) ?? null), context));
|
|
891
|
+
((index = (index + 1)));
|
|
892
|
+
}
|
|
893
|
+
((index = 0));
|
|
894
|
+
while (__eliscript_numeric_relation("<", index, (parsed)["length"])) {
|
|
895
|
+
{
|
|
896
|
+
const __eliscript_value_100 = ((((parsed) ?? [])[index]) ?? null);
|
|
897
|
+
{
|
|
898
|
+
let pair = __eliscript_value_100;
|
|
366
899
|
analyze_non_tail(((((pair) ?? [])[1]) ?? null), scope, context);
|
|
367
|
-
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
900
|
+
analyze_pattern_defaults(((((pair) ?? [])[0]) ?? null), scope, context);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
((index = (index + 1)));
|
|
904
|
+
}
|
|
905
|
+
((index = 0));
|
|
906
|
+
while (__eliscript_numeric_relation("<", index, (parsed)["length"])) {
|
|
907
|
+
{
|
|
908
|
+
const __eliscript_value_101 = ((((parsed) ?? [])[index]) ?? null);
|
|
909
|
+
{
|
|
910
|
+
let pair = __eliscript_value_101;
|
|
911
|
+
declare_pattern(child, ((((pair) ?? [])[0]) ?? null), "local", true, context);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
((index = (index + 1)));
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
return analyze_sequence(body, child, context);
|
|
920
|
+
}
|
|
381
921
|
}
|
|
382
922
|
function analyze_function(parameters, body, scope, context, asynchronous = null) {
|
|
383
|
-
|
|
384
|
-
(
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
((
|
|
923
|
+
{
|
|
924
|
+
const __eliscript_value_102 = function_parameters(parameters, context);
|
|
925
|
+
const __eliscript_value_103 = 0;
|
|
926
|
+
{
|
|
927
|
+
let parameter_items = __eliscript_value_102;
|
|
928
|
+
let index = __eliscript_value_103;
|
|
929
|
+
while (__eliscript_numeric_relation("<", index, (parameter_items)["length"])) {
|
|
930
|
+
analyze_pattern_defaults((((((parameter_items) ?? [])[index]) ?? null))["node"], scope, context);
|
|
931
|
+
((index = (index + 1)));
|
|
932
|
+
}
|
|
933
|
+
{
|
|
934
|
+
const __eliscript_value_104 = make_scope(scope, (__eliscript_truthy(asynchronous) ? "async" : "sync"));
|
|
935
|
+
{
|
|
936
|
+
let child = __eliscript_value_104;
|
|
937
|
+
((index = 0));
|
|
938
|
+
while (__eliscript_numeric_relation("<", index, (parameter_items)["length"])) {
|
|
939
|
+
{
|
|
940
|
+
const __eliscript_value_105 = (((((parameter_items) ?? [])[index]) ?? null))["bindings"];
|
|
941
|
+
const __eliscript_value_106 = 0;
|
|
942
|
+
{
|
|
943
|
+
let bindings = __eliscript_value_105;
|
|
944
|
+
let binding_index = __eliscript_value_106;
|
|
945
|
+
while (__eliscript_numeric_relation("<", binding_index, (bindings)["length"])) {
|
|
946
|
+
declare_binding(child, ((((bindings) ?? [])[binding_index]) ?? null), "parameter", true, context);
|
|
947
|
+
((binding_index = (binding_index + 1)));
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
((index = (index + 1)));
|
|
952
|
+
}
|
|
953
|
+
{
|
|
954
|
+
const __eliscript_value_107 = (context)["recurTargets"];
|
|
955
|
+
const __eliscript_value_108 = (context)["tailPosition"];
|
|
956
|
+
const __eliscript_value_109 = (context)["recurBarrier"];
|
|
957
|
+
{
|
|
958
|
+
let recur_targets = __eliscript_value_107;
|
|
959
|
+
let tail_position = __eliscript_value_108;
|
|
960
|
+
let recur_barrier = __eliscript_value_109;
|
|
961
|
+
((context)["recurTargets"] = [({"kind": "function", "arity": (parameter_items)["length"]})]);
|
|
962
|
+
((context)["tailPosition"] = true);
|
|
963
|
+
((context)["recurBarrier"] = false);
|
|
964
|
+
analyze_sequence(body, child, context);
|
|
965
|
+
((context)["recurTargets"] = recur_targets);
|
|
966
|
+
((context)["tailPosition"] = tail_position);
|
|
967
|
+
return ((context)["recurBarrier"] = recur_barrier);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
function analyze_loop(args, scope, context, form_span) {
|
|
976
|
+
if (((args)["length"] === 0)) {
|
|
977
|
+
analyzer_fail(context, form_span, "loop requires a binding list");
|
|
978
|
+
}
|
|
979
|
+
{
|
|
980
|
+
let bindings_form = ((((args) ?? [])[0]) ?? null);
|
|
981
|
+
let bindings = list_items(bindings_form);
|
|
982
|
+
let body = (args)["slice"](1);
|
|
983
|
+
let child = make_scope(scope);
|
|
984
|
+
let parsed = [];
|
|
985
|
+
if ((bindings === undefined)) {
|
|
986
|
+
analyzer_fail(context, node_span(bindings_form), "loop bindings must be a list");
|
|
987
|
+
}
|
|
988
|
+
(bindings)["forEach"](((binding) => {
|
|
989
|
+
{
|
|
990
|
+
const __eliscript_value_110 = list_items(binding);
|
|
991
|
+
{
|
|
992
|
+
let items = __eliscript_value_110;
|
|
993
|
+
if ((!((!(items === undefined)) && ((items)["length"] === 2)))) {
|
|
994
|
+
analyzer_fail(context, node_span(binding), (String("loop bindings require exactly one initializer: ") + String(node_display(binding))));
|
|
995
|
+
}
|
|
996
|
+
return (parsed)["push"](binding_pair(binding, context));
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
}));
|
|
1000
|
+
(parsed)["forEach"](((pair) => {
|
|
1001
|
+
analyze_non_tail(((((pair) ?? [])[1]) ?? null), scope, context);
|
|
1002
|
+
return analyze_pattern_defaults(((((pair) ?? [])[0]) ?? null), scope, context);
|
|
1003
|
+
}));
|
|
1004
|
+
(parsed)["forEach"](((pair) => {
|
|
1005
|
+
return declare_pattern(child, ((((pair) ?? [])[0]) ?? null), "loop", true, context);
|
|
1006
|
+
}));
|
|
1007
|
+
{
|
|
1008
|
+
const __eliscript_value_111 = (context)["recurTargets"];
|
|
1009
|
+
const __eliscript_value_112 = (context)["tailPosition"];
|
|
1010
|
+
const __eliscript_value_113 = (context)["recurBarrier"];
|
|
1011
|
+
const __eliscript_value_114 = [];
|
|
1012
|
+
{
|
|
1013
|
+
let recur_targets = __eliscript_value_111;
|
|
1014
|
+
let tail_position = __eliscript_value_112;
|
|
1015
|
+
let recur_barrier = __eliscript_value_113;
|
|
1016
|
+
let targets = __eliscript_value_114;
|
|
1017
|
+
(targets)["push"](({"kind": "loop", "arity": (parsed)["length"]}));
|
|
1018
|
+
(recur_targets)["forEach"](((target) => {
|
|
1019
|
+
return (targets)["push"](target);
|
|
1020
|
+
}));
|
|
1021
|
+
((context)["recurTargets"] = targets);
|
|
395
1022
|
((context)["tailPosition"] = true);
|
|
396
1023
|
((context)["recurBarrier"] = false);
|
|
397
1024
|
analyze_sequence(body, child, context);
|
|
398
1025
|
((context)["recurTargets"] = recur_targets);
|
|
399
1026
|
((context)["tailPosition"] = tail_position);
|
|
400
1027
|
return ((context)["recurBarrier"] = recur_barrier);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
function analyze_loop(args, scope, context, form_span) {
|
|
406
|
-
(__eliscript_truthy(((args)["length"] === 0)) ? analyzer_fail(context, form_span, "loop requires a binding list") : null);
|
|
407
|
-
return ((bindings_form) => {
|
|
408
|
-
return ((bindings) => {
|
|
409
|
-
return ((body) => {
|
|
410
|
-
return ((child) => {
|
|
411
|
-
return ((parsed) => {
|
|
412
|
-
return (() => {
|
|
413
|
-
(__eliscript_truthy((bindings === undefined)) ? analyzer_fail(context, node_span(bindings_form), "loop bindings must be a list") : null);
|
|
414
|
-
(bindings)["forEach"]((binding) => {
|
|
415
|
-
return ((items) => {
|
|
416
|
-
(__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_54) => (__eliscript_truthy(__eliscript_value_54) ? ((items)["length"] === 2) : __eliscript_value_54))((!__eliscript_truthy((items === undefined))))))) ? analyzer_fail(context, node_span(binding), (String("loop bindings require exactly one initializer: ") + String(node_display(binding)))) : null);
|
|
417
|
-
return (parsed)["push"](binding_pair(binding, context));
|
|
418
|
-
})(list_items(binding));
|
|
419
|
-
});
|
|
420
|
-
(parsed)["forEach"]((pair) => {
|
|
421
|
-
analyze_non_tail(((((pair) ?? [])[1]) ?? null), scope, context);
|
|
422
|
-
return analyze_pattern_defaults(((((pair) ?? [])[0]) ?? null), scope, context);
|
|
423
|
-
});
|
|
424
|
-
(parsed)["forEach"]((pair) => {
|
|
425
|
-
return declare_pattern(child, ((((pair) ?? [])[0]) ?? null), "loop", true, context);
|
|
426
|
-
});
|
|
427
|
-
return ((recur_targets, tail_position, recur_barrier, targets) => {
|
|
428
|
-
(targets)["push"](({"kind": "loop", "arity": (parsed)["length"]}));
|
|
429
|
-
(recur_targets)["forEach"]((target) => {
|
|
430
|
-
return (targets)["push"](target);
|
|
431
|
-
});
|
|
432
|
-
((context)["recurTargets"] = targets);
|
|
433
|
-
((context)["tailPosition"] = true);
|
|
434
|
-
((context)["recurBarrier"] = false);
|
|
435
|
-
analyze_sequence(body, child, context);
|
|
436
|
-
((context)["recurTargets"] = recur_targets);
|
|
437
|
-
((context)["tailPosition"] = tail_position);
|
|
438
|
-
return ((context)["recurBarrier"] = recur_barrier);
|
|
439
|
-
})((context)["recurTargets"], (context)["tailPosition"], (context)["recurBarrier"], []);
|
|
440
|
-
})();
|
|
441
|
-
})([]);
|
|
442
|
-
})(make_scope(scope));
|
|
443
|
-
})((args)["slice"](1));
|
|
444
|
-
})(list_items(bindings_form));
|
|
445
|
-
})(((((args) ?? [])[0]) ?? null));
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
446
1031
|
}
|
|
447
1032
|
function analyze_recur(args, scope, context, form_span) {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
1033
|
+
{
|
|
1034
|
+
let targets = (context)["recurTargets"];
|
|
1035
|
+
let target = ((__eliscript_value_115) => (__eliscript_truthy(__eliscript_value_115) ? ((((targets) ?? [])[0]) ?? null) : __eliscript_value_115))(__eliscript_numeric_relation(">", (targets)["length"], 0));
|
|
1036
|
+
if ((!__eliscript_truthy(target))) {
|
|
1037
|
+
analyzer_fail(context, form_span, "recur is only valid inside a function or loop");
|
|
1038
|
+
}
|
|
1039
|
+
if (__eliscript_truthy((context)["recurBarrier"])) {
|
|
1040
|
+
analyzer_fail(context, form_span, "recur cannot cross a try boundary");
|
|
1041
|
+
}
|
|
1042
|
+
if ((!__eliscript_truthy((context)["tailPosition"]))) {
|
|
1043
|
+
analyzer_fail(context, form_span, "recur is only valid in tail position");
|
|
1044
|
+
}
|
|
1045
|
+
if ((!((args)["length"] === (target)["arity"]))) {
|
|
1046
|
+
analyzer_fail(context, form_span, (String("recur expects ") + String((target)["arity"]) + String(" arguments for the current ") + String((target)["kind"]) + String(", got ") + String((args)["length"])));
|
|
1047
|
+
}
|
|
1048
|
+
return analyze_non_tail_sequence(args, scope, context);
|
|
1049
|
+
}
|
|
459
1050
|
}
|
|
460
1051
|
function analyze_assignment(args, scope, form_name, context, form_span) {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
475
|
-
|
|
1052
|
+
if ((((args)["length"] === 0) || (__eliscript_numeric_rem((args)["length"], 2) === 1))) {
|
|
1053
|
+
analyzer_fail(context, form_span, (String(form_name) + String(" expects one or more name/value pairs")));
|
|
1054
|
+
}
|
|
1055
|
+
{
|
|
1056
|
+
const __eliscript_value_116 = 0;
|
|
1057
|
+
{
|
|
1058
|
+
let index = __eliscript_value_116;
|
|
1059
|
+
while (__eliscript_numeric_relation("<", index, (args)["length"])) {
|
|
1060
|
+
{
|
|
1061
|
+
let name_node = ((((args) ?? [])[index]) ?? null);
|
|
1062
|
+
let value = ((((args) ?? [])[(index + 1)]) ?? null);
|
|
1063
|
+
if ((!__eliscript_truthy(symbol_node_p(name_node)))) {
|
|
1064
|
+
analyzer_fail(context, form_span, (String("assignment target must be a symbol: ") + String(node_display(name_node))));
|
|
1065
|
+
}
|
|
1066
|
+
{
|
|
1067
|
+
const __eliscript_value_117 = require_binding(scope, name_node, context);
|
|
1068
|
+
{
|
|
1069
|
+
let binding = __eliscript_value_117;
|
|
1070
|
+
if ((!__eliscript_truthy((binding)["mutable"]))) {
|
|
1071
|
+
analyzer_fail(context, node_span(name_node), (String("cannot assign to immutable binding: ") + String(node_name(name_node))));
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
analyze_non_tail(value, scope, context);
|
|
1076
|
+
}
|
|
476
1077
|
((index = (index + 2)));
|
|
477
1078
|
}
|
|
478
1079
|
return null;
|
|
479
|
-
}
|
|
480
|
-
}
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
481
1082
|
}
|
|
482
1083
|
function analyze_object(args, scope, context, form_span, form_name) {
|
|
483
|
-
(
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
1084
|
+
if ((__eliscript_numeric_rem((args)["length"], 2) === 1)) {
|
|
1085
|
+
analyzer_fail(context, form_span, (String(form_name) + String(" expects key/value pairs")));
|
|
1086
|
+
}
|
|
1087
|
+
{
|
|
1088
|
+
const __eliscript_value_118 = 0;
|
|
1089
|
+
{
|
|
1090
|
+
let index = __eliscript_value_118;
|
|
1091
|
+
while (__eliscript_numeric_relation("<", index, (args)["length"])) {
|
|
1092
|
+
{
|
|
1093
|
+
const __eliscript_value_119 = ((((args) ?? [])[index]) ?? null);
|
|
1094
|
+
const __eliscript_value_120 = ((((args) ?? [])[(index + 1)]) ?? null);
|
|
1095
|
+
{
|
|
1096
|
+
let key = __eliscript_value_119;
|
|
1097
|
+
let value = __eliscript_value_120;
|
|
1098
|
+
if ((!__eliscript_truthy(((__eliscript_value_121) => (__eliscript_truthy(__eliscript_value_121) ? __eliscript_value_121 : ((__eliscript_value_122) => (__eliscript_truthy(__eliscript_value_122) ? __eliscript_value_122 : symbol_node_p(key)))(string_node_p(key))))(keyword_node_p(key))))) {
|
|
1099
|
+
analyze_non_tail(key, scope, context);
|
|
1100
|
+
}
|
|
1101
|
+
analyze_non_tail(value, scope, context);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
491
1104
|
((index = (index + 2)));
|
|
492
1105
|
}
|
|
493
1106
|
return null;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
496
1109
|
}
|
|
497
1110
|
function analyze_property_call(operator, args, scope, context, form_span) {
|
|
498
|
-
(
|
|
1111
|
+
if ((operator === "get")) {
|
|
1112
|
+
if ((__eliscript_numeric_relation("<", (args)["length"], 2) || __eliscript_numeric_relation(">", (args)["length"], 3))) {
|
|
1113
|
+
analyzer_fail(context, form_span, "get expects 2..3 arguments");
|
|
1114
|
+
}
|
|
1115
|
+
} else {
|
|
1116
|
+
if ((operator === "put")) {
|
|
1117
|
+
if ((!((args)["length"] === 3))) {
|
|
1118
|
+
analyzer_fail(context, form_span, "put expects 3 arguments");
|
|
1119
|
+
}
|
|
1120
|
+
} else {
|
|
1121
|
+
if ((operator === "js-call")) {
|
|
1122
|
+
if (__eliscript_numeric_relation("<", (args)["length"], 2)) {
|
|
1123
|
+
analyzer_fail(context, form_span, "js-call expects 2+ arguments");
|
|
1124
|
+
}
|
|
1125
|
+
} else {
|
|
1126
|
+
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
499
1130
|
analyze_non_tail(((((args) ?? [])[0]) ?? null), scope, context);
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
1131
|
+
{
|
|
1132
|
+
const __eliscript_value_123 = ((((args) ?? [])[1]) ?? null);
|
|
1133
|
+
{
|
|
1134
|
+
let key = __eliscript_value_123;
|
|
1135
|
+
if ((!__eliscript_truthy(((__eliscript_value_124) => (__eliscript_truthy(__eliscript_value_124) ? __eliscript_value_124 : string_node_p(key)))(keyword_node_p(key))))) {
|
|
1136
|
+
analyze_non_tail(key, scope, context);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
503
1140
|
return analyze_non_tail_sequence((args)["slice"](2), scope, context);
|
|
504
1141
|
}
|
|
505
1142
|
function analyze_cond(clauses, scope, context) {
|
|
506
|
-
return (clauses)["forEach"]((clause) => {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
1143
|
+
return (clauses)["forEach"](((clause) => {
|
|
1144
|
+
{
|
|
1145
|
+
const __eliscript_value_125 = list_items(clause);
|
|
1146
|
+
{
|
|
1147
|
+
let items = __eliscript_value_125;
|
|
1148
|
+
if (((items === undefined) || ((items)["length"] === 0))) {
|
|
1149
|
+
analyzer_fail(context, node_span(clause), (String("invalid cond clause: ") + String(node_display(clause))));
|
|
1150
|
+
}
|
|
1151
|
+
analyze_non_tail(((((items) ?? [])[0]) ?? null), scope, context);
|
|
1152
|
+
return analyze_sequence((items)["slice"](1), scope, context);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}));
|
|
513
1156
|
}
|
|
514
1157
|
function clause_operator(form) {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
1158
|
+
{
|
|
1159
|
+
const __eliscript_value_126 = list_items(form);
|
|
1160
|
+
{
|
|
1161
|
+
let items = __eliscript_value_126;
|
|
1162
|
+
return ((__eliscript_value_127) => (__eliscript_truthy(__eliscript_value_127) ? ((__eliscript_value_128) => (__eliscript_truthy(__eliscript_value_128) ? ((__eliscript_value_129) => (__eliscript_truthy(__eliscript_value_129) ? node_name(((((items) ?? [])[0]) ?? null)) : __eliscript_value_129))(symbol_node_p(((((items) ?? [])[0]) ?? null))) : __eliscript_value_128))(__eliscript_numeric_relation(">", (items)["length"], 0)) : __eliscript_value_127))((!(items === undefined)));
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
518
1165
|
}
|
|
519
1166
|
function analyze_try(args, scope, context, form_span) {
|
|
520
|
-
|
|
521
|
-
(
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
1167
|
+
{
|
|
1168
|
+
const __eliscript_value_130 = (context)["recurBarrier"];
|
|
1169
|
+
const __eliscript_value_131 = false;
|
|
1170
|
+
const __eliscript_value_132 = false;
|
|
1171
|
+
const __eliscript_value_133 = false;
|
|
1172
|
+
{
|
|
1173
|
+
let recur_barrier = __eliscript_value_130;
|
|
1174
|
+
let clauses_started = __eliscript_value_131;
|
|
1175
|
+
let catch_seen = __eliscript_value_132;
|
|
1176
|
+
let finally_seen = __eliscript_value_133;
|
|
1177
|
+
((context)["recurBarrier"] = true);
|
|
1178
|
+
(args)["forEach"](((argument) => {
|
|
1179
|
+
{
|
|
1180
|
+
const __eliscript_value_134 = clause_operator(argument);
|
|
1181
|
+
{
|
|
1182
|
+
let operator = __eliscript_value_134;
|
|
1183
|
+
if ((operator === "catch")) {
|
|
1184
|
+
if (__eliscript_truthy(catch_seen)) {
|
|
1185
|
+
analyzer_fail(context, form_span, "try accepts at most one catch clause");
|
|
1186
|
+
}
|
|
1187
|
+
if (__eliscript_truthy(finally_seen)) {
|
|
1188
|
+
analyzer_fail(context, form_span, "catch must precede finally");
|
|
1189
|
+
}
|
|
1190
|
+
((clauses_started = true));
|
|
1191
|
+
((catch_seen = true));
|
|
1192
|
+
{
|
|
1193
|
+
let items = list_items(argument);
|
|
1194
|
+
let binding = ((((items) ?? [])[1]) ?? null);
|
|
1195
|
+
if ((!__eliscript_truthy(binding_pattern_p(binding)))) {
|
|
1196
|
+
analyzer_fail(context, node_span(argument), "catch requires a binding symbol, vector, or map");
|
|
1197
|
+
}
|
|
533
1198
|
analyze_pattern_defaults(binding, scope, context);
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
1199
|
+
{
|
|
1200
|
+
const __eliscript_value_135 = make_scope(scope);
|
|
1201
|
+
{
|
|
1202
|
+
let child = __eliscript_value_135;
|
|
1203
|
+
declare_pattern(child, binding, "catch", true, context);
|
|
1204
|
+
return analyze_sequence((items)["slice"](2), child, context);
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
} else {
|
|
1209
|
+
if ((operator === "finally")) {
|
|
1210
|
+
if (__eliscript_truthy(finally_seen)) {
|
|
1211
|
+
analyzer_fail(context, form_span, "try accepts at most one finally clause");
|
|
1212
|
+
}
|
|
1213
|
+
((clauses_started = true));
|
|
1214
|
+
((finally_seen = true));
|
|
1215
|
+
return analyze_sequence((list_items(argument))["slice"](1), scope, context);
|
|
1216
|
+
} else {
|
|
1217
|
+
if (__eliscript_truthy(clauses_started)) {
|
|
1218
|
+
return analyzer_fail(context, node_span(argument), "try body forms must precede catch and finally clauses");
|
|
1219
|
+
} else {
|
|
1220
|
+
return analyze_expression(argument, scope, context);
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}));
|
|
1227
|
+
if ((!__eliscript_truthy(((__eliscript_value_136) => (__eliscript_truthy(__eliscript_value_136) ? __eliscript_value_136 : finally_seen))(catch_seen)))) {
|
|
1228
|
+
analyzer_fail(context, form_span, "try requires a catch or finally clause");
|
|
1229
|
+
}
|
|
1230
|
+
return ((context)["recurBarrier"] = recur_barrier);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
552
1233
|
}
|
|
553
1234
|
function analyze_call(form, scope, context) {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
return
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
1235
|
+
{
|
|
1236
|
+
let items = node_items(form);
|
|
1237
|
+
let operator_node = ((((items) ?? [])[0]) ?? null);
|
|
1238
|
+
let operator = ((__eliscript_value_137) => (__eliscript_truthy(__eliscript_value_137) ? node_name(operator_node) : __eliscript_value_137))(symbol_node_p(operator_node));
|
|
1239
|
+
let args = (items)["slice"](1);
|
|
1240
|
+
let form_span = node_span(form);
|
|
1241
|
+
if (((operator === "lambda") || (operator === "fn"))) {
|
|
1242
|
+
if (((args)["length"] === 0)) {
|
|
1243
|
+
analyzer_fail(context, form_span, (String(operator) + String(" requires an argument list")));
|
|
1244
|
+
}
|
|
1245
|
+
return analyze_function(((((args) ?? [])[0]) ?? null), (args)["slice"](1), scope, context);
|
|
1246
|
+
} else {
|
|
1247
|
+
if ((operator === "async")) {
|
|
1248
|
+
if (((args)["length"] === 0)) {
|
|
1249
|
+
analyzer_fail(context, form_span, "async requires an argument list");
|
|
1250
|
+
}
|
|
1251
|
+
return analyze_function(((((args) ?? [])[0]) ?? null), (args)["slice"](1), scope, context, true);
|
|
1252
|
+
} else {
|
|
1253
|
+
if ((operator === "await")) {
|
|
1254
|
+
if ((!((args)["length"] === 1))) {
|
|
1255
|
+
analyzer_fail(context, form_span, "await expects 1 argument");
|
|
1256
|
+
}
|
|
1257
|
+
if ((!__eliscript_truthy(async_function_p(scope)))) {
|
|
1258
|
+
analyzer_fail(context, form_span, "await is only valid inside an async function");
|
|
1259
|
+
}
|
|
1260
|
+
return analyze_non_tail(((((args) ?? [])[0]) ?? null), scope, context);
|
|
1261
|
+
} else {
|
|
1262
|
+
if ((operator === "throw")) {
|
|
1263
|
+
if ((!((args)["length"] === 1))) {
|
|
1264
|
+
analyzer_fail(context, form_span, "throw expects 1 argument");
|
|
1265
|
+
}
|
|
1266
|
+
return analyze_non_tail(((((args) ?? [])[0]) ?? null), scope, context);
|
|
1267
|
+
} else {
|
|
1268
|
+
if ((operator === "try")) {
|
|
1269
|
+
return analyze_try(args, scope, context, form_span);
|
|
1270
|
+
} else {
|
|
1271
|
+
if (((operator === "catch") || (operator === "finally"))) {
|
|
1272
|
+
return analyzer_fail(context, form_span, (String(operator) + String(" is only valid as a try clause")));
|
|
1273
|
+
} else {
|
|
1274
|
+
if ((operator === "let")) {
|
|
1275
|
+
return analyze_let(args, scope, false, context, form_span);
|
|
1276
|
+
} else {
|
|
1277
|
+
if ((operator === "let*")) {
|
|
1278
|
+
return analyze_let(args, scope, true, context, form_span);
|
|
1279
|
+
} else {
|
|
1280
|
+
if ((operator === "loop")) {
|
|
1281
|
+
return analyze_loop(args, scope, context, form_span);
|
|
1282
|
+
} else {
|
|
1283
|
+
if ((operator === "recur")) {
|
|
1284
|
+
return analyze_recur(args, scope, context, form_span);
|
|
1285
|
+
} else {
|
|
1286
|
+
if ((operator === "setq")) {
|
|
1287
|
+
return analyze_assignment(args, scope, "setq", context, form_span);
|
|
1288
|
+
} else {
|
|
1289
|
+
if ((operator === "set!")) {
|
|
1290
|
+
if ((!((args)["length"] === 2))) {
|
|
1291
|
+
analyzer_fail(context, form_span, "set! expects 2 arguments");
|
|
1292
|
+
}
|
|
1293
|
+
return analyze_assignment(args, scope, "set!", context, form_span);
|
|
1294
|
+
} else {
|
|
1295
|
+
if ((operator === "cond")) {
|
|
1296
|
+
return analyze_cond(args, scope, context);
|
|
1297
|
+
} else {
|
|
1298
|
+
if ((operator === "if")) {
|
|
1299
|
+
if ((!(__eliscript_numeric_relation(">=", (args)["length"], 2) && __eliscript_numeric_relation("<=", (args)["length"], 3)))) {
|
|
1300
|
+
analyzer_fail(context, form_span, "if expects 2..3 arguments");
|
|
1301
|
+
}
|
|
1302
|
+
analyze_non_tail(((((args) ?? [])[0]) ?? null), scope, context);
|
|
1303
|
+
{
|
|
1304
|
+
const __eliscript_value_138 = 1;
|
|
1305
|
+
{
|
|
1306
|
+
let index = __eliscript_value_138;
|
|
1307
|
+
while (__eliscript_numeric_relation("<", index, (args)["length"])) {
|
|
1308
|
+
analyze_expression(((((args) ?? [])[index]) ?? null), scope, context);
|
|
1309
|
+
((index = (index + 1)));
|
|
1310
|
+
}
|
|
1311
|
+
return null;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
} else {
|
|
1315
|
+
if (((operator === "when") || (operator === "unless"))) {
|
|
1316
|
+
if (((args)["length"] === 0)) {
|
|
1317
|
+
analyzer_fail(context, form_span, (String(operator) + String(" expects 1+ arguments")));
|
|
1318
|
+
}
|
|
1319
|
+
analyze_non_tail(((((args) ?? [])[0]) ?? null), scope, context);
|
|
1320
|
+
return analyze_sequence((args)["slice"](1), scope, context);
|
|
1321
|
+
} else {
|
|
1322
|
+
if (((operator === "progn") || (operator === "do") || (operator === "and") || (operator === "or"))) {
|
|
1323
|
+
return analyze_sequence(args, scope, context);
|
|
1324
|
+
} else {
|
|
1325
|
+
if ((operator === "while")) {
|
|
1326
|
+
if (((args)["length"] === 0)) {
|
|
1327
|
+
analyzer_fail(context, form_span, "while expects 1+ arguments");
|
|
1328
|
+
}
|
|
1329
|
+
return analyze_non_tail_sequence(args, scope, context);
|
|
1330
|
+
} else {
|
|
1331
|
+
if ((operator === "quote")) {
|
|
1332
|
+
return null;
|
|
1333
|
+
} else {
|
|
1334
|
+
if ((operator === "js-object")) {
|
|
1335
|
+
return analyze_object(args, scope, context, form_span, operator);
|
|
1336
|
+
} else {
|
|
1337
|
+
if ((operator === "hash-map")) {
|
|
1338
|
+
if ((__eliscript_numeric_rem((args)["length"], 2) === 1)) {
|
|
1339
|
+
analyzer_fail(context, form_span, "hash-map expects complete key/value pairs");
|
|
1340
|
+
}
|
|
1341
|
+
return analyze_non_tail_sequence(args, scope, context);
|
|
1342
|
+
} else {
|
|
1343
|
+
if (((operator === "get") || (operator === "put") || (operator === "js-call"))) {
|
|
1344
|
+
return analyze_property_call(operator, args, scope, context, form_span);
|
|
1345
|
+
} else {
|
|
1346
|
+
if ((operator === "js*")) {
|
|
1347
|
+
return null;
|
|
1348
|
+
} else {
|
|
1349
|
+
if (__eliscript_truthy(((__eliscript_tdz_read_0()))["includes"](operator))) {
|
|
1350
|
+
return analyze_non_tail_sequence(args, scope, context);
|
|
1351
|
+
} else {
|
|
1352
|
+
if (__eliscript_truthy(((__eliscript_tdz_read_2()))["includes"](operator))) {
|
|
1353
|
+
return analyzer_fail(context, form_span, (String(operator) + String(" is only valid at module top level")));
|
|
1354
|
+
} else {
|
|
1355
|
+
analyze_non_tail(operator_node, scope, context);
|
|
1356
|
+
return analyze_non_tail_sequence(args, scope, context);
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
598
1382
|
}
|
|
599
1383
|
function analyze_expression(form, scope, context) {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
1384
|
+
if (__eliscript_truthy(form)) {
|
|
1385
|
+
if (((node_kind(form) === "literal") || (node_kind(form) === "undefined") || (node_kind(form) === "keyword"))) {
|
|
1386
|
+
return null;
|
|
1387
|
+
} else {
|
|
1388
|
+
if ((node_kind(form) === "symbol")) {
|
|
1389
|
+
{
|
|
1390
|
+
const __eliscript_value_139 = node_name(form);
|
|
1391
|
+
{
|
|
1392
|
+
let name = __eliscript_value_139;
|
|
1393
|
+
if (__eliscript_truthy(qualified_name_p(name))) {
|
|
1394
|
+
return guarded_reference_name(name, context, node_span(form));
|
|
1395
|
+
} else {
|
|
1396
|
+
return require_binding(scope, form, context);
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
} else {
|
|
1401
|
+
if ((node_kind(form) === "vector")) {
|
|
1402
|
+
return analyze_non_tail_sequence(node_items(form), scope, context);
|
|
1403
|
+
} else {
|
|
1404
|
+
if ((node_kind(form) === "list")) {
|
|
1405
|
+
return analyze_call(form, scope, context);
|
|
1406
|
+
} else {
|
|
1407
|
+
return analyzer_fail(context, node_span(form), (String("unsupported form: ") + String(node_display(form))));
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
} else {
|
|
1413
|
+
return null;
|
|
1414
|
+
}
|
|
603
1415
|
}
|
|
604
1416
|
function import_bindings(args, context, form_span, portable) {
|
|
605
|
-
(
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
1417
|
+
if ((!__eliscript_truthy(((__eliscript_value_140) => (__eliscript_truthy(__eliscript_value_140) ? string_node_p(((((args) ?? [])[0]) ?? null)) : __eliscript_value_140))(__eliscript_numeric_relation(">", (args)["length"], 0))))) {
|
|
1418
|
+
analyzer_fail(context, form_span, "import module must be a string");
|
|
1419
|
+
}
|
|
1420
|
+
{
|
|
1421
|
+
const __eliscript_value_141 = [];
|
|
1422
|
+
const __eliscript_value_142 = 1;
|
|
1423
|
+
const __eliscript_value_143 = false;
|
|
1424
|
+
const __eliscript_value_144 = false;
|
|
1425
|
+
const __eliscript_value_145 = false;
|
|
1426
|
+
{
|
|
1427
|
+
let bindings = __eliscript_value_141;
|
|
1428
|
+
let index = __eliscript_value_142;
|
|
1429
|
+
let default_seen = __eliscript_value_143;
|
|
1430
|
+
let namespace_seen = __eliscript_value_144;
|
|
1431
|
+
let named_seen = __eliscript_value_145;
|
|
1432
|
+
while (__eliscript_numeric_relation("<", index, (args)["length"])) {
|
|
1433
|
+
{
|
|
1434
|
+
const __eliscript_value_146 = ((((args) ?? [])[index]) ?? null);
|
|
1435
|
+
{
|
|
1436
|
+
let specifier = __eliscript_value_146;
|
|
1437
|
+
if (__eliscript_truthy(((__eliscript_value_147) => (__eliscript_truthy(__eliscript_value_147) ? (node_name(specifier) === "default") : __eliscript_value_147))(keyword_node_p(specifier)))) {
|
|
1438
|
+
if (__eliscript_truthy(portable)) {
|
|
1439
|
+
analyzer_fail(context, form_span, "import-portable only supports named imports");
|
|
1440
|
+
}
|
|
1441
|
+
if (__eliscript_truthy(default_seen)) {
|
|
1442
|
+
analyzer_fail(context, form_span, "duplicate :default import");
|
|
1443
|
+
}
|
|
1444
|
+
if (__eliscript_numeric_relation(">=", (index + 1), (args)["length"])) {
|
|
1445
|
+
analyzer_fail(context, form_span, ":default requires a binding");
|
|
1446
|
+
}
|
|
1447
|
+
((default_seen = true));
|
|
1448
|
+
((index = (index + 1)));
|
|
1449
|
+
(bindings)["push"](((((args) ?? [])[index]) ?? null));
|
|
1450
|
+
} else {
|
|
1451
|
+
if (__eliscript_truthy(((__eliscript_value_148) => (__eliscript_truthy(__eliscript_value_148) ? (node_name(specifier) === "as") : __eliscript_value_148))(keyword_node_p(specifier)))) {
|
|
1452
|
+
if (__eliscript_truthy(portable)) {
|
|
1453
|
+
analyzer_fail(context, form_span, "import-portable only supports named imports");
|
|
1454
|
+
}
|
|
1455
|
+
if (__eliscript_truthy(namespace_seen)) {
|
|
1456
|
+
analyzer_fail(context, form_span, "duplicate :as import");
|
|
1457
|
+
}
|
|
1458
|
+
if (__eliscript_numeric_relation(">=", (index + 1), (args)["length"])) {
|
|
1459
|
+
analyzer_fail(context, form_span, ":as requires a namespace binding");
|
|
1460
|
+
}
|
|
1461
|
+
((namespace_seen = true));
|
|
1462
|
+
((index = (index + 1)));
|
|
1463
|
+
(bindings)["push"](((((args) ?? [])[index]) ?? null));
|
|
1464
|
+
} else {
|
|
1465
|
+
if (__eliscript_truthy(symbol_node_p(specifier))) {
|
|
1466
|
+
((named_seen = true));
|
|
1467
|
+
(bindings)["push"](specifier);
|
|
1468
|
+
} else {
|
|
1469
|
+
analyzer_fail(context, form_span, (String("invalid import specifier: ") + String(node_display(specifier))));
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
622
1473
|
((index = (index + 1)));
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
((named_seen = true));
|
|
626
|
-
return (bindings)["push"](specifier);
|
|
627
|
-
})() : analyzer_fail(context, form_span, (String("invalid import specifier: ") + String(node_display(specifier)))))));
|
|
628
|
-
return ((index = (index + 1)));
|
|
629
|
-
})(((((args) ?? [])[index]) ?? null));
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
630
1476
|
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
1477
|
+
if (__eliscript_truthy(((__eliscript_value_149) => (__eliscript_truthy(__eliscript_value_149) ? named_seen : __eliscript_value_149))(namespace_seen))) {
|
|
1478
|
+
analyzer_fail(context, form_span, "namespace and named imports cannot be combined");
|
|
1479
|
+
}
|
|
1480
|
+
if (__eliscript_truthy(((__eliscript_value_150) => (__eliscript_truthy(__eliscript_value_150) ? ((bindings)["length"] === 0) : __eliscript_value_150))(portable))) {
|
|
1481
|
+
analyzer_fail(context, form_span, "import-portable expects one or more bindings");
|
|
1482
|
+
}
|
|
1483
|
+
return bindings;
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
637
1486
|
}
|
|
638
1487
|
function append_flattened_modules(forms, result, context) {
|
|
639
|
-
return (forms)["forEach"]((form) => {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
1488
|
+
return (forms)["forEach"](((form) => {
|
|
1489
|
+
if (__eliscript_truthy(((__eliscript_value_151) => (__eliscript_truthy(__eliscript_value_151) ? ((__eliscript_value_152) => (__eliscript_truthy(__eliscript_value_152) ? (node_name(((((node_items(form)) ?? [])[0]) ?? null)) === "module") : __eliscript_value_152))(symbol_node_p(((((node_items(form)) ?? [])[0]) ?? null))) : __eliscript_value_151))((node_kind(form) === "list")))) {
|
|
1490
|
+
{
|
|
1491
|
+
const __eliscript_value_153 = node_items(form);
|
|
1492
|
+
{
|
|
1493
|
+
let items = __eliscript_value_153;
|
|
1494
|
+
if ((!__eliscript_truthy(((__eliscript_value_154) => (__eliscript_truthy(__eliscript_value_154) ? symbol_node_p(((((items) ?? [])[1]) ?? null)) : __eliscript_value_154))(__eliscript_numeric_relation(">", (items)["length"], 1))))) {
|
|
1495
|
+
analyzer_fail(context, node_span(form), "module name must be a symbol");
|
|
1496
|
+
}
|
|
1497
|
+
return append_flattened_modules((items)["slice"](2), result, context);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
} else {
|
|
1501
|
+
return (result)["push"](form);
|
|
1502
|
+
}
|
|
1503
|
+
}));
|
|
645
1504
|
}
|
|
646
1505
|
function flatten_modules(forms, context) {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
1506
|
+
{
|
|
1507
|
+
const __eliscript_value_155 = [];
|
|
1508
|
+
{
|
|
1509
|
+
let result = __eliscript_value_155;
|
|
1510
|
+
append_flattened_modules(forms, result, context);
|
|
1511
|
+
return result;
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
651
1514
|
}
|
|
652
1515
|
function predeclare_top_level(forms, scope, context) {
|
|
653
|
-
return (forms)["forEach"]((form) => {
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
1516
|
+
return (forms)["forEach"](((form) => {
|
|
1517
|
+
if ((node_kind(form) === "list")) {
|
|
1518
|
+
{
|
|
1519
|
+
let items = node_items(form);
|
|
1520
|
+
let operator_node = ((((items) ?? [])[0]) ?? null);
|
|
1521
|
+
let operator = ((__eliscript_value_156) => (__eliscript_truthy(__eliscript_value_156) ? node_name(operator_node) : __eliscript_value_156))(symbol_node_p(operator_node));
|
|
1522
|
+
let args = (items)["slice"](1);
|
|
1523
|
+
let count = (args)["length"];
|
|
1524
|
+
if (((operator === "import") || (operator === "import-portable"))) {
|
|
1525
|
+
if ((count === 0)) {
|
|
1526
|
+
analyzer_fail(context, node_span(form), (String(operator) + String(" expects a module name")));
|
|
1527
|
+
}
|
|
1528
|
+
return (import_bindings(args, context, node_span(form), (operator === "import-portable")))["forEach"](((name) => {
|
|
1529
|
+
return declare_binding(scope, name, "import", false, context);
|
|
1530
|
+
}));
|
|
1531
|
+
} else {
|
|
1532
|
+
if ((operator === "defvar")) {
|
|
1533
|
+
if ((!(__eliscript_numeric_relation(">=", count, 1) && __eliscript_numeric_relation("<=", count, 2)))) {
|
|
1534
|
+
analyzer_fail(context, node_span(form), "defvar expects 1..2 arguments");
|
|
1535
|
+
}
|
|
1536
|
+
return declare_binding(scope, ((((args) ?? [])[0]) ?? null), "variable", true, context);
|
|
1537
|
+
} else {
|
|
1538
|
+
if ((operator === "defconst")) {
|
|
1539
|
+
if ((!(__eliscript_numeric_relation(">=", count, 1) && __eliscript_numeric_relation("<=", count, 2)))) {
|
|
1540
|
+
analyzer_fail(context, node_span(form), "defconst expects 1..2 arguments");
|
|
1541
|
+
}
|
|
1542
|
+
return declare_binding(scope, ((((args) ?? [])[0]) ?? null), "constant", false, context);
|
|
1543
|
+
} else {
|
|
1544
|
+
if (((operator === "defun") || (operator === "defn") || (operator === "defportable") || (operator === "defasync"))) {
|
|
1545
|
+
if ((!__eliscript_numeric_relation(">=", count, 2))) {
|
|
1546
|
+
analyzer_fail(context, node_span(form), (String(operator) + String(" expects 2+ arguments")));
|
|
1547
|
+
}
|
|
1548
|
+
declare_binding(scope, ((((args) ?? [])[0]) ?? null), "function", false, context);
|
|
1549
|
+
if ((operator === "defportable")) {
|
|
1550
|
+
return ((context)["hasPortable"] = true);
|
|
1551
|
+
} else {
|
|
1552
|
+
return null;
|
|
1553
|
+
}
|
|
1554
|
+
} else {
|
|
1555
|
+
return null;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
} else {
|
|
1562
|
+
return null;
|
|
1563
|
+
}
|
|
1564
|
+
}));
|
|
680
1565
|
}
|
|
681
1566
|
function analyze_top_level(form, scope, context) {
|
|
682
|
-
|
|
683
|
-
return (
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
1567
|
+
if ((!(node_kind(form) === "list"))) {
|
|
1568
|
+
return analyze_expression(form, scope, context);
|
|
1569
|
+
} else {
|
|
1570
|
+
{
|
|
1571
|
+
let items = node_items(form);
|
|
1572
|
+
let operator_node = ((((items) ?? [])[0]) ?? null);
|
|
1573
|
+
let operator = ((__eliscript_value_157) => (__eliscript_truthy(__eliscript_value_157) ? node_name(operator_node) : __eliscript_value_157))(symbol_node_p(operator_node));
|
|
1574
|
+
let args = (items)["slice"](1);
|
|
1575
|
+
let count = (args)["length"];
|
|
1576
|
+
if (((operator === "import") || (operator === "import-portable"))) {
|
|
1577
|
+
return null;
|
|
1578
|
+
} else {
|
|
1579
|
+
if (((operator === "defvar") || (operator === "defconst"))) {
|
|
1580
|
+
if (__eliscript_numeric_relation(">", count, 2)) {
|
|
1581
|
+
analyzer_fail(context, node_span(form), (String(operator) + String(" expects 1..2 arguments")));
|
|
1582
|
+
}
|
|
1583
|
+
return analyze_expression(((((args) ?? [])[1]) ?? null), scope, context);
|
|
1584
|
+
} else {
|
|
1585
|
+
if (((operator === "defun") || (operator === "defn") || (operator === "defportable") || (operator === "defasync"))) {
|
|
1586
|
+
if ((!__eliscript_numeric_relation(">=", count, 2))) {
|
|
1587
|
+
analyzer_fail(context, node_span(form), (String(operator) + String(" expects 2+ arguments")));
|
|
1588
|
+
}
|
|
1589
|
+
return analyze_function(((((args) ?? [])[1]) ?? null), (args)["slice"](2), scope, context, (operator === "defasync"));
|
|
1590
|
+
} else {
|
|
1591
|
+
if ((operator === "export")) {
|
|
1592
|
+
if ((count === 0)) {
|
|
1593
|
+
analyzer_fail(context, node_span(form), "export expects one or more bindings");
|
|
1594
|
+
}
|
|
1595
|
+
return (args)["forEach"](((name) => {
|
|
1596
|
+
if ((!__eliscript_truthy(symbol_node_p(name)))) {
|
|
1597
|
+
analyzer_fail(context, node_span(name), (String("export name must be a symbol: ") + String(node_display(name))));
|
|
1598
|
+
}
|
|
697
1599
|
return require_binding(scope, name, context);
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
(
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
1600
|
+
}));
|
|
1601
|
+
} else {
|
|
1602
|
+
if ((operator === "export-default")) {
|
|
1603
|
+
if ((!(count === 1))) {
|
|
1604
|
+
analyzer_fail(context, node_span(form), "export-default expects 1 argument");
|
|
1605
|
+
}
|
|
1606
|
+
return analyze_expression(((((args) ?? [])[0]) ?? null), scope, context);
|
|
1607
|
+
} else {
|
|
1608
|
+
return analyze_expression(form, scope, context);
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
708
1616
|
}
|
|
709
1617
|
function portable_declarations(forms, context) {
|
|
710
|
-
|
|
711
|
-
(
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
1618
|
+
{
|
|
1619
|
+
const __eliscript_value_158 = new (Map)();
|
|
1620
|
+
{
|
|
1621
|
+
let declarations = __eliscript_value_158;
|
|
1622
|
+
(forms)["forEach"](((form) => {
|
|
1623
|
+
if ((node_kind(form) === "list")) {
|
|
1624
|
+
{
|
|
1625
|
+
let items = node_items(form);
|
|
1626
|
+
let operator_node = ((((items) ?? [])[0]) ?? null);
|
|
1627
|
+
let operator = ((__eliscript_value_159) => (__eliscript_truthy(__eliscript_value_159) ? node_name(operator_node) : __eliscript_value_159))(symbol_node_p(operator_node));
|
|
1628
|
+
let args = (items)["slice"](1);
|
|
1629
|
+
if ((operator === "defconst")) {
|
|
1630
|
+
return (declarations)["set"](node_name(((((args) ?? [])[0]) ?? null)), ({"kind": "constant", "form": form, "initializer": ((((args) ?? [])[1]) ?? null)}));
|
|
1631
|
+
} else {
|
|
1632
|
+
if ((operator === "defvar")) {
|
|
1633
|
+
return (declarations)["set"](node_name(((((args) ?? [])[0]) ?? null)), ({"kind": "variable", "form": form}));
|
|
1634
|
+
} else {
|
|
1635
|
+
if (((operator === "defun") || (operator === "defn") || (operator === "defportable") || (operator === "defasync"))) {
|
|
1636
|
+
return (declarations)["set"](node_name(((((args) ?? [])[0]) ?? null)), ({"kind": ((operator === "defportable") ? "portable" : "function"), "form": form, "parameters": ((((args) ?? [])[1]) ?? null), "body": (args)["slice"](2)}));
|
|
1637
|
+
} else {
|
|
1638
|
+
if (((operator === "import") || (operator === "import-portable"))) {
|
|
1639
|
+
return (import_bindings(args, context, node_span(form), (operator === "import-portable")))["forEach"](((name) => {
|
|
1640
|
+
return (declarations)["set"](node_name(name), ({"kind": ((operator === "import-portable") ? "portable-import" : "import"), "form": form}));
|
|
1641
|
+
}));
|
|
1642
|
+
} else {
|
|
1643
|
+
return null;
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
} else {
|
|
1650
|
+
return null;
|
|
1651
|
+
}
|
|
1652
|
+
}));
|
|
1653
|
+
return declarations;
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
726
1656
|
}
|
|
727
1657
|
function portable_scope(parameters, context) {
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
1658
|
+
{
|
|
1659
|
+
const __eliscript_value_160 = new (Set)();
|
|
1660
|
+
{
|
|
1661
|
+
let scope = __eliscript_value_160;
|
|
1662
|
+
if (__eliscript_truthy(parameters)) {
|
|
1663
|
+
(function_parameters(parameters, context))["forEach"](((parameter) => {
|
|
1664
|
+
return ((parameter)["bindings"])["forEach"](((binding) => {
|
|
1665
|
+
return (scope)["add"](node_name(binding));
|
|
1666
|
+
}));
|
|
1667
|
+
}));
|
|
1668
|
+
}
|
|
1669
|
+
return scope;
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
736
1672
|
}
|
|
737
1673
|
function copy_portable_scope(scope) {
|
|
738
|
-
return new Set(scope);
|
|
1674
|
+
return new (Set)(scope);
|
|
739
1675
|
}
|
|
740
1676
|
function add_portable_pattern(pattern, scope, context) {
|
|
741
|
-
return (binding_nodes(pattern, context))["forEach"]((binding) => {
|
|
1677
|
+
return (binding_nodes(pattern, context))["forEach"](((binding) => {
|
|
742
1678
|
return (scope)["add"](node_name(binding));
|
|
743
|
-
});
|
|
1679
|
+
}));
|
|
744
1680
|
}
|
|
745
1681
|
function portable_reference(node, scope, declarations, dependencies, entry, context) {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
1682
|
+
{
|
|
1683
|
+
const __eliscript_value_161 = node_name(node);
|
|
1684
|
+
{
|
|
1685
|
+
let name = __eliscript_value_161;
|
|
1686
|
+
if ((!__eliscript_truthy((scope)["has"](name)))) {
|
|
1687
|
+
if (__eliscript_truthy(qualified_name_p(name))) {
|
|
1688
|
+
portable_fail(context, node_span(node), (String("portable function ") + String(entry) + String(" uses qualified host reference: ") + String(name)));
|
|
1689
|
+
}
|
|
1690
|
+
{
|
|
1691
|
+
const __eliscript_value_162 = (declarations)["get"](name);
|
|
1692
|
+
{
|
|
1693
|
+
let declaration = __eliscript_value_162;
|
|
1694
|
+
if (__eliscript_truthy(declaration)) {
|
|
1695
|
+
{
|
|
1696
|
+
const __eliscript_value_163 = (declaration)["kind"];
|
|
1697
|
+
{
|
|
1698
|
+
let kind = __eliscript_value_163;
|
|
1699
|
+
if (((kind === "portable") || (kind === "constant") || (kind === "portable-import"))) {
|
|
1700
|
+
return (dependencies)["add"](name);
|
|
1701
|
+
} else {
|
|
1702
|
+
return portable_fail(context, node_span(node), (String("portable function ") + String(entry) + String(" depends on non-portable ") + String(kind) + String(": ") + String(name)));
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
} else {
|
|
1707
|
+
return null;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
} else {
|
|
1712
|
+
return null;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
756
1716
|
}
|
|
757
1717
|
function portable_sequence(forms, scope, declarations, dependencies, entry, context) {
|
|
758
|
-
return (forms)["forEach"]((form) => {
|
|
1718
|
+
return (forms)["forEach"](((form) => {
|
|
759
1719
|
return portable_expression(form, scope, declarations, dependencies, entry, context);
|
|
760
|
-
});
|
|
1720
|
+
}));
|
|
761
1721
|
}
|
|
762
1722
|
function portable_function_expression(args, scope, declarations, dependencies, entry, context) {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
1723
|
+
{
|
|
1724
|
+
const __eliscript_value_164 = copy_portable_scope(scope);
|
|
1725
|
+
{
|
|
1726
|
+
let child = __eliscript_value_164;
|
|
1727
|
+
(function_parameters(((((args) ?? [])[0]) ?? null), context))["forEach"](((parameter) => {
|
|
1728
|
+
return ((parameter)["bindings"])["forEach"](((binding) => {
|
|
1729
|
+
return (child)["add"](node_name(binding));
|
|
1730
|
+
}));
|
|
1731
|
+
}));
|
|
1732
|
+
return portable_sequence((args)["slice"](1), child, declarations, dependencies, entry, context);
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
771
1735
|
}
|
|
772
1736
|
function portable_let_expression(args, scope, sequential, declarations, dependencies, entry, context) {
|
|
773
|
-
|
|
774
|
-
(
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
1737
|
+
{
|
|
1738
|
+
const __eliscript_value_165 = list_items(((((args) ?? [])[0]) ?? null));
|
|
1739
|
+
const __eliscript_value_166 = copy_portable_scope(scope);
|
|
1740
|
+
{
|
|
1741
|
+
let bindings = __eliscript_value_165;
|
|
1742
|
+
let child = __eliscript_value_166;
|
|
1743
|
+
if (__eliscript_truthy(sequential)) {
|
|
1744
|
+
(bindings)["forEach"](((binding) => {
|
|
1745
|
+
{
|
|
1746
|
+
let items = list_items(binding);
|
|
1747
|
+
let name = (__eliscript_truthy(items) ? ((((items) ?? [])[0]) ?? null) : binding);
|
|
1748
|
+
let initializer = ((__eliscript_value_167) => (__eliscript_truthy(__eliscript_value_167) ? ((((items) ?? [])[1]) ?? null) : __eliscript_value_167))(items);
|
|
1749
|
+
portable_expression(initializer, child, declarations, dependencies, entry, context);
|
|
1750
|
+
return add_portable_pattern(name, child, context);
|
|
1751
|
+
}
|
|
1752
|
+
}));
|
|
1753
|
+
} else {
|
|
1754
|
+
(bindings)["forEach"](((binding) => {
|
|
1755
|
+
{
|
|
1756
|
+
const __eliscript_value_168 = list_items(binding);
|
|
1757
|
+
{
|
|
1758
|
+
let items = __eliscript_value_168;
|
|
1759
|
+
if (__eliscript_truthy(items)) {
|
|
1760
|
+
return portable_expression(((((items) ?? [])[1]) ?? null), scope, declarations, dependencies, entry, context);
|
|
1761
|
+
} else {
|
|
1762
|
+
return null;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
}));
|
|
1767
|
+
(bindings)["forEach"](((binding) => {
|
|
1768
|
+
{
|
|
1769
|
+
const __eliscript_value_169 = list_items(binding);
|
|
1770
|
+
{
|
|
1771
|
+
let items = __eliscript_value_169;
|
|
1772
|
+
return add_portable_pattern((__eliscript_truthy(items) ? ((((items) ?? [])[0]) ?? null) : binding), child, context);
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
}));
|
|
1776
|
+
}
|
|
1777
|
+
return portable_sequence((args)["slice"](1), child, declarations, dependencies, entry, context);
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
799
1780
|
}
|
|
800
1781
|
function portable_loop_expression(args, scope, declarations, dependencies, entry, context) {
|
|
801
|
-
|
|
802
|
-
(
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
1782
|
+
{
|
|
1783
|
+
const __eliscript_value_170 = list_items(((((args) ?? [])[0]) ?? null));
|
|
1784
|
+
const __eliscript_value_171 = copy_portable_scope(scope);
|
|
1785
|
+
{
|
|
1786
|
+
let bindings = __eliscript_value_170;
|
|
1787
|
+
let child = __eliscript_value_171;
|
|
1788
|
+
(bindings)["forEach"](((binding) => {
|
|
1789
|
+
{
|
|
1790
|
+
const __eliscript_value_172 = list_items(binding);
|
|
1791
|
+
{
|
|
1792
|
+
let items = __eliscript_value_172;
|
|
1793
|
+
return portable_expression(((((items) ?? [])[1]) ?? null), scope, declarations, dependencies, entry, context);
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
}));
|
|
1797
|
+
(bindings)["forEach"](((binding) => {
|
|
1798
|
+
return add_portable_pattern(((((list_items(binding)) ?? [])[0]) ?? null), child, context);
|
|
1799
|
+
}));
|
|
1800
|
+
return portable_sequence((args)["slice"](1), child, declarations, dependencies, entry, context);
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
812
1803
|
}
|
|
813
1804
|
function portable_assignment(args, scope, declarations, dependencies, entry, context) {
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
1805
|
+
{
|
|
1806
|
+
const __eliscript_value_173 = 0;
|
|
1807
|
+
{
|
|
1808
|
+
let index = __eliscript_value_173;
|
|
1809
|
+
while (__eliscript_numeric_relation("<", index, (args)["length"])) {
|
|
1810
|
+
{
|
|
1811
|
+
const __eliscript_value_174 = ((((args) ?? [])[index]) ?? null);
|
|
1812
|
+
const __eliscript_value_175 = ((((args) ?? [])[(index + 1)]) ?? null);
|
|
1813
|
+
{
|
|
1814
|
+
let name = __eliscript_value_174;
|
|
1815
|
+
let value = __eliscript_value_175;
|
|
1816
|
+
if ((!__eliscript_truthy((scope)["has"](node_name(name))))) {
|
|
1817
|
+
portable_fail(context, node_span(name), (String("portable function ") + String(entry) + String(" may only assign local bindings: ") + String(node_name(name))));
|
|
1818
|
+
}
|
|
1819
|
+
portable_expression(value, scope, declarations, dependencies, entry, context);
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
821
1822
|
((index = (index + 2)));
|
|
822
1823
|
}
|
|
823
1824
|
return null;
|
|
824
|
-
}
|
|
825
|
-
}
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
826
1827
|
}
|
|
827
1828
|
function portable_object(args, scope, declarations, dependencies, entry, context) {
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
1829
|
+
{
|
|
1830
|
+
const __eliscript_value_176 = 0;
|
|
1831
|
+
{
|
|
1832
|
+
let index = __eliscript_value_176;
|
|
1833
|
+
while (__eliscript_numeric_relation("<", index, (args)["length"])) {
|
|
1834
|
+
{
|
|
1835
|
+
const __eliscript_value_177 = ((((args) ?? [])[index]) ?? null);
|
|
1836
|
+
const __eliscript_value_178 = ((((args) ?? [])[(index + 1)]) ?? null);
|
|
1837
|
+
{
|
|
1838
|
+
let key = __eliscript_value_177;
|
|
1839
|
+
let value = __eliscript_value_178;
|
|
1840
|
+
if ((!__eliscript_truthy(((__eliscript_value_179) => (__eliscript_truthy(__eliscript_value_179) ? __eliscript_value_179 : ((__eliscript_value_180) => (__eliscript_truthy(__eliscript_value_180) ? __eliscript_value_180 : symbol_node_p(key)))(string_node_p(key))))(keyword_node_p(key))))) {
|
|
1841
|
+
portable_expression(key, scope, declarations, dependencies, entry, context);
|
|
1842
|
+
}
|
|
1843
|
+
portable_expression(value, scope, declarations, dependencies, entry, context);
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
835
1846
|
((index = (index + 2)));
|
|
836
1847
|
}
|
|
837
1848
|
return null;
|
|
838
|
-
}
|
|
839
|
-
}
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
840
1851
|
}
|
|
841
1852
|
function portable_host_key_call(args, scope, declarations, dependencies, entry, context) {
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
1853
|
+
{
|
|
1854
|
+
const __eliscript_value_181 = 0;
|
|
1855
|
+
{
|
|
1856
|
+
let index = __eliscript_value_181;
|
|
1857
|
+
while (__eliscript_numeric_relation("<", index, (args)["length"])) {
|
|
1858
|
+
{
|
|
1859
|
+
const __eliscript_value_182 = ((((args) ?? [])[index]) ?? null);
|
|
1860
|
+
{
|
|
1861
|
+
let argument = __eliscript_value_182;
|
|
1862
|
+
if ((!__eliscript_truthy(((__eliscript_value_183) => (__eliscript_truthy(__eliscript_value_183) ? keyword_node_p(argument) : __eliscript_value_183))((index === 1))))) {
|
|
1863
|
+
portable_expression(argument, scope, declarations, dependencies, entry, context);
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
848
1867
|
((index = (index + 1)));
|
|
849
1868
|
}
|
|
850
1869
|
return null;
|
|
851
|
-
}
|
|
852
|
-
}
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
853
1872
|
}
|
|
854
1873
|
function portable_call(form, scope, declarations, dependencies, entry, context) {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
1874
|
+
{
|
|
1875
|
+
let items = node_items(form);
|
|
1876
|
+
let operator_node = ((((items) ?? [])[0]) ?? null);
|
|
1877
|
+
let operator = ((__eliscript_value_184) => (__eliscript_truthy(__eliscript_value_184) ? node_name(operator_node) : __eliscript_value_184))(symbol_node_p(operator_node));
|
|
1878
|
+
let args = (items)["slice"](1);
|
|
1879
|
+
if (__eliscript_truthy(((__eliscript_tdz_read_1()))["includes"](operator))) {
|
|
1880
|
+
portable_fail(context, node_span(form), (String("portable function ") + String(entry) + String(" cannot use ") + String(operator) + String(" (") + String(((operator === "js*") ? "raw JavaScript" : ((operator === "print") ? "console output" : ((operator === "put") ? "object mutation" : ((operator === "js-call") ? "host method calls" : ((operator === "new") ? "host constructors" : ((operator === "async") ? "asynchronous functions" : ((operator === "await") ? "asynchronous suspension" : (((operator === "throw") || (operator === "try")) ? "exception control flow" : "unsupported host capability"))))))))) + String(")")));
|
|
1881
|
+
}
|
|
1882
|
+
if ((operator === "quote")) {
|
|
1883
|
+
return null;
|
|
1884
|
+
} else {
|
|
1885
|
+
if (((operator === "lambda") || (operator === "fn"))) {
|
|
1886
|
+
return portable_function_expression(args, scope, declarations, dependencies, entry, context);
|
|
1887
|
+
} else {
|
|
1888
|
+
if ((operator === "let")) {
|
|
1889
|
+
return portable_let_expression(args, scope, false, declarations, dependencies, entry, context);
|
|
1890
|
+
} else {
|
|
1891
|
+
if ((operator === "let*")) {
|
|
1892
|
+
return portable_let_expression(args, scope, true, declarations, dependencies, entry, context);
|
|
1893
|
+
} else {
|
|
1894
|
+
if ((operator === "loop")) {
|
|
1895
|
+
return portable_loop_expression(args, scope, declarations, dependencies, entry, context);
|
|
1896
|
+
} else {
|
|
1897
|
+
if (((operator === "setq") || (operator === "set!"))) {
|
|
1898
|
+
return portable_assignment(args, scope, declarations, dependencies, entry, context);
|
|
1899
|
+
} else {
|
|
1900
|
+
if ((operator === "js-object")) {
|
|
1901
|
+
return portable_object(args, scope, declarations, dependencies, entry, context);
|
|
1902
|
+
} else {
|
|
1903
|
+
if (((operator === "get") || (operator === "aref") || (operator === "object-has?") || (operator === "object-assoc"))) {
|
|
1904
|
+
return portable_host_key_call(args, scope, declarations, dependencies, entry, context);
|
|
1905
|
+
} else {
|
|
1906
|
+
if ((!__eliscript_truthy(((__eliscript_tdz_read_0()))["includes"](operator)))) {
|
|
1907
|
+
portable_expression(operator_node, scope, declarations, dependencies, entry, context);
|
|
1908
|
+
}
|
|
1909
|
+
return portable_sequence(args, scope, declarations, dependencies, entry, context);
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
870
1919
|
}
|
|
871
1920
|
function portable_expression(form, scope, declarations, dependencies, entry, context) {
|
|
872
|
-
|
|
1921
|
+
if (__eliscript_truthy(form)) {
|
|
1922
|
+
if (((node_kind(form) === "literal") || (node_kind(form) === "undefined"))) {
|
|
1923
|
+
return null;
|
|
1924
|
+
} else {
|
|
1925
|
+
if ((node_kind(form) === "keyword")) {
|
|
1926
|
+
return null;
|
|
1927
|
+
} else {
|
|
1928
|
+
if ((node_kind(form) === "symbol")) {
|
|
1929
|
+
return portable_reference(form, scope, declarations, dependencies, entry, context);
|
|
1930
|
+
} else {
|
|
1931
|
+
if ((node_kind(form) === "vector")) {
|
|
1932
|
+
return portable_sequence(node_items(form), scope, declarations, dependencies, entry, context);
|
|
1933
|
+
} else {
|
|
1934
|
+
if ((node_kind(form) === "list")) {
|
|
1935
|
+
return portable_call(form, scope, declarations, dependencies, entry, context);
|
|
1936
|
+
} else {
|
|
1937
|
+
return null;
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
} else {
|
|
1944
|
+
return null;
|
|
1945
|
+
}
|
|
873
1946
|
}
|
|
874
1947
|
function portable_dependencies(declaration, declarations, entry, context) {
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
1948
|
+
{
|
|
1949
|
+
const __eliscript_value_185 = new (Set)();
|
|
1950
|
+
const __eliscript_value_186 = portable_scope((declaration)["parameters"], context);
|
|
1951
|
+
{
|
|
1952
|
+
let dependencies = __eliscript_value_185;
|
|
1953
|
+
let scope = __eliscript_value_186;
|
|
1954
|
+
if (((declaration)["kind"] === "portable")) {
|
|
1955
|
+
portable_sequence((declaration)["body"], scope, declarations, dependencies, entry, context);
|
|
1956
|
+
} else {
|
|
1957
|
+
portable_expression((declaration)["initializer"], scope, declarations, dependencies, entry, context);
|
|
1958
|
+
}
|
|
1959
|
+
return dependencies;
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
879
1962
|
}
|
|
880
1963
|
function validate_portable_module(forms, context) {
|
|
881
|
-
|
|
882
|
-
(
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
1964
|
+
{
|
|
1965
|
+
const __eliscript_value_187 = portable_declarations(forms, context);
|
|
1966
|
+
const __eliscript_value_188 = [];
|
|
1967
|
+
const __eliscript_value_189 = new (Set)();
|
|
1968
|
+
{
|
|
1969
|
+
let declarations = __eliscript_value_187;
|
|
1970
|
+
let pending = __eliscript_value_188;
|
|
1971
|
+
let visited = __eliscript_value_189;
|
|
1972
|
+
(declarations)["forEach"](((declaration, name) => {
|
|
1973
|
+
if (((declaration)["kind"] === "portable")) {
|
|
1974
|
+
return (pending)["push"](name);
|
|
1975
|
+
} else {
|
|
1976
|
+
return null;
|
|
1977
|
+
}
|
|
1978
|
+
}));
|
|
1979
|
+
while (__eliscript_numeric_relation(">", (pending)["length"], 0)) {
|
|
1980
|
+
{
|
|
1981
|
+
const __eliscript_value_190 = (pending)["pop"]();
|
|
1982
|
+
{
|
|
1983
|
+
let name = __eliscript_value_190;
|
|
1984
|
+
if ((!__eliscript_truthy((visited)["has"](name)))) {
|
|
1985
|
+
(visited)["add"](name);
|
|
1986
|
+
{
|
|
1987
|
+
const __eliscript_value_191 = (declarations)["get"](name);
|
|
1988
|
+
{
|
|
1989
|
+
let declaration = __eliscript_value_191;
|
|
1990
|
+
(portable_dependencies(declaration, declarations, name, context))["forEach"](((dependency) => {
|
|
1991
|
+
return (pending)["push"](dependency);
|
|
1992
|
+
}));
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
897
1998
|
}
|
|
898
|
-
return
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
})(portable_declarations(forms, context), [], new Set());
|
|
1999
|
+
return forms;
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
902
2002
|
}
|
|
903
2003
|
function select_portable_module(forms, entries, filename, allow_project_imports = null) {
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
2004
|
+
{
|
|
2005
|
+
const __eliscript_value_192 = ({"filename": filename});
|
|
2006
|
+
{
|
|
2007
|
+
let context = __eliscript_value_192;
|
|
2008
|
+
{
|
|
2009
|
+
const __eliscript_value_193 = flatten_modules(forms, context);
|
|
2010
|
+
{
|
|
2011
|
+
let flattened = __eliscript_value_193;
|
|
2012
|
+
{
|
|
2013
|
+
const __eliscript_value_194 = portable_declarations(flattened, context);
|
|
2014
|
+
{
|
|
2015
|
+
let declarations = __eliscript_value_194;
|
|
2016
|
+
{
|
|
2017
|
+
const __eliscript_value_195 = [];
|
|
2018
|
+
{
|
|
2019
|
+
let pending = __eliscript_value_195;
|
|
2020
|
+
{
|
|
2021
|
+
const __eliscript_value_196 = new (Set)();
|
|
2022
|
+
{
|
|
2023
|
+
let selected = __eliscript_value_196;
|
|
2024
|
+
(entries)["forEach"](((entry) => {
|
|
2025
|
+
{
|
|
2026
|
+
const __eliscript_value_197 = (declarations)["get"](entry);
|
|
2027
|
+
{
|
|
2028
|
+
let declaration = __eliscript_value_197;
|
|
2029
|
+
if ((!__eliscript_truthy(((__eliscript_value_198) => (__eliscript_truthy(__eliscript_value_198) ? ((declaration)["kind"] === "portable") : __eliscript_value_198))(declaration)))) {
|
|
2030
|
+
portable_fail(context, null, (String("portable entry ") + String(entry) + String(" is not declared with defportable")));
|
|
2031
|
+
}
|
|
2032
|
+
return (pending)["push"](entry);
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
}));
|
|
2036
|
+
while (__eliscript_numeric_relation(">", (pending)["length"], 0)) {
|
|
2037
|
+
{
|
|
2038
|
+
const __eliscript_value_199 = (pending)["pop"]();
|
|
2039
|
+
{
|
|
2040
|
+
let name = __eliscript_value_199;
|
|
2041
|
+
if ((!__eliscript_truthy((selected)["has"](name)))) {
|
|
2042
|
+
(selected)["add"](name);
|
|
2043
|
+
{
|
|
2044
|
+
const __eliscript_value_200 = (declarations)["get"](name);
|
|
2045
|
+
{
|
|
2046
|
+
let declaration = __eliscript_value_200;
|
|
2047
|
+
if ((((declaration)["kind"] === "portable-import") && (!__eliscript_truthy(allow_project_imports)))) {
|
|
2048
|
+
portable_fail(context, node_span((declaration)["form"]), (String("portable import ") + String(name) + String(" requires a project build")));
|
|
2049
|
+
}
|
|
2050
|
+
(portable_dependencies(declaration, declarations, name, context))["forEach"](((dependency) => {
|
|
2051
|
+
return (pending)["push"](dependency);
|
|
2052
|
+
}));
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
return (flattened)["filter"](((form) => {
|
|
2060
|
+
if ((node_kind(form) === "list")) {
|
|
2061
|
+
{
|
|
2062
|
+
let items = node_items(form);
|
|
2063
|
+
let operator = ((__eliscript_value_201) => (__eliscript_truthy(__eliscript_value_201) ? node_name(((((items) ?? [])[0]) ?? null)) : __eliscript_value_201))(symbol_node_p(((((items) ?? [])[0]) ?? null)));
|
|
2064
|
+
let name = ((__eliscript_value_202) => (__eliscript_truthy(__eliscript_value_202) ? ((__eliscript_value_203) => (__eliscript_truthy(__eliscript_value_203) ? node_name(((((items) ?? [])[1]) ?? null)) : __eliscript_value_203))(symbol_node_p(((((items) ?? [])[1]) ?? null))) : __eliscript_value_202))(__eliscript_numeric_relation(">", (items)["length"], 1));
|
|
2065
|
+
return ((__eliscript_value_204) => (__eliscript_truthy(__eliscript_value_204) ? __eliscript_value_204 : ((__eliscript_value_206) => (__eliscript_truthy(__eliscript_value_206) ? ((items)["slice"](2))["some"](((imported) => {
|
|
2066
|
+
return (selected)["has"](node_name(imported));
|
|
2067
|
+
})) : __eliscript_value_206))((operator === "import-portable"))))(((__eliscript_value_205) => (__eliscript_truthy(__eliscript_value_205) ? (selected)["has"](name) : __eliscript_value_205))(((operator === "defconst") || (operator === "defportable"))));
|
|
2068
|
+
}
|
|
2069
|
+
} else {
|
|
2070
|
+
return null;
|
|
2071
|
+
}
|
|
2072
|
+
}));
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
929
2075
|
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
return (selected)["has"](node_name(imported));
|
|
938
|
-
}) : __eliscript_value_126))((operator === "import-portable"))))(((__eliscript_value_124) => (__eliscript_truthy(__eliscript_value_124) ? (selected)["has"](name) : __eliscript_value_124))(((__eliscript_value_125) => (__eliscript_truthy(__eliscript_value_125) ? __eliscript_value_125 : (operator === "defportable")))((operator === "defconst"))));
|
|
939
|
-
})(((__eliscript_value_121) => (__eliscript_truthy(__eliscript_value_121) ? ((__eliscript_value_122) => (__eliscript_truthy(__eliscript_value_122) ? node_name(((((items) ?? [])[1]) ?? null)) : __eliscript_value_122))(symbol_node_p(((((items) ?? [])[1]) ?? null))) : __eliscript_value_121))(((items)["length"] > 1)));
|
|
940
|
-
})(((__eliscript_value_120) => (__eliscript_truthy(__eliscript_value_120) ? node_name(((((items) ?? [])[0]) ?? null)) : __eliscript_value_120))(symbol_node_p(((((items) ?? [])[0]) ?? null))));
|
|
941
|
-
})(node_items(form)) : null);
|
|
942
|
-
});
|
|
943
|
-
})();
|
|
944
|
-
})(new Set());
|
|
945
|
-
})([]);
|
|
946
|
-
})(portable_declarations(flattened, context));
|
|
947
|
-
})(flatten_modules(forms, context));
|
|
948
|
-
})(({"filename": filename}));
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
949
2083
|
}
|
|
950
2084
|
function analyze_module(forms, filename) {
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
})(({"filename": filename, "tailPosition": false, "recurTargets": [], "recurBarrier": false}));
|
|
2085
|
+
{
|
|
2086
|
+
let context = ({"filename": filename, "tailPosition": false, "recurTargets": [], "recurBarrier": false});
|
|
2087
|
+
let flattened = flatten_modules(forms, context);
|
|
2088
|
+
let scope = make_scope(null);
|
|
2089
|
+
predeclare_top_level(flattened, scope, context);
|
|
2090
|
+
(flattened)["forEach"](((form) => {
|
|
2091
|
+
return analyze_top_level(form, scope, context);
|
|
2092
|
+
}));
|
|
2093
|
+
analyze_transients(forms, filename);
|
|
2094
|
+
if (__eliscript_truthy(((context)["hasPortable"] ?? false))) {
|
|
2095
|
+
validate_portable_module(flattened, context);
|
|
2096
|
+
}
|
|
2097
|
+
return forms;
|
|
2098
|
+
}
|
|
966
2099
|
}
|
|
967
2100
|
export {analyze_module, select_portable_module};
|
|
968
|
-
//# sourceMappingURL=analyzer.mjs.map
|