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.
Files changed (417) hide show
  1. package/README.md +59 -0
  2. package/bootstrap/README.md +26 -0
  3. package/bootstrap/backends/README.md +515 -0
  4. package/bootstrap/backends/async.eli +230 -0
  5. package/bootstrap/backends/binary.eli +173 -0
  6. package/bootstrap/backends/capabilities.eli +74 -0
  7. package/bootstrap/backends/elf.eli +246 -0
  8. package/bootstrap/backends/managed.eli +5976 -0
  9. package/bootstrap/backends/memory.eli +100 -0
  10. package/bootstrap/backends/native.eli +2000 -0
  11. package/bootstrap/backends/numeric.eli +1362 -0
  12. package/bootstrap/backends/optimize.eli +79 -0
  13. package/bootstrap/backends/regexp.eli +2263 -0
  14. package/bootstrap/backends/sha256.eli +138 -0
  15. package/bootstrap/backends/wasm.eli +1161 -0
  16. package/bootstrap/compiler/analyzer.eli +165 -77
  17. package/bootstrap/compiler/compiler.eli +43 -19
  18. package/bootstrap/compiler/emitter.eli +780 -170
  19. package/bootstrap/compiler/expander.eli +136 -45
  20. package/bootstrap/compiler/formatter.eli +8 -1
  21. package/bootstrap/compiler/ir.eli +148 -45
  22. package/bootstrap/compiler/lower.eli +29 -2
  23. package/bootstrap/compiler/project.eli +51 -21
  24. package/bootstrap/compiler/reader.eli +128 -36
  25. package/bootstrap/compiler/source-map.eli +46 -4
  26. package/bootstrap/compiler/symbol.eli +2 -1
  27. package/bootstrap/compiler/syntax.eli +47 -12
  28. package/bootstrap/compiler/transient-analysis.eli +40 -4
  29. package/bootstrap/host/check-cli-legacy.mjs +163 -0
  30. package/bootstrap/host/check-cli.mjs +59 -158
  31. package/bootstrap/host/check-cli.mjs.map +1 -0
  32. package/bootstrap/host/compiler-session.eli +1579 -0
  33. package/bootstrap/host/compiler-tools.eli +513 -0
  34. package/bootstrap/host/eliscript-cli-legacy.mjs +37 -0
  35. package/bootstrap/host/eliscript-cli.mjs +53 -33
  36. package/bootstrap/host/eliscript-cli.mjs.map +1 -0
  37. package/bootstrap/host/project-cli-legacy.mjs +295 -0
  38. package/bootstrap/host/project-cli.mjs +74 -289
  39. package/bootstrap/host/project-cli.mjs.map +1 -0
  40. package/bootstrap/host/project-legacy.mjs +1080 -0
  41. package/bootstrap/host/project.mjs +210 -1060
  42. package/bootstrap/host/project.mjs.map +1 -0
  43. package/bootstrap/runtime/UNICODE-LICENSE.txt +39 -0
  44. package/bootstrap/runtime/memory.eli +30379 -0
  45. package/browser/host.mjs +89 -0
  46. package/compiler/eliscript-analyzer.el +371 -4
  47. package/compiler/eliscript-cli.el +84 -1
  48. package/compiler/eliscript-emitter.el +1189 -256
  49. package/compiler/eliscript-expander.el +147 -10
  50. package/compiler/eliscript-ir-emitter.el +725 -208
  51. package/compiler/eliscript-lower.el +127 -1
  52. package/compiler/eliscript-portable.el +177 -51
  53. package/compiler/eliscript-project.el +20 -2
  54. package/compiler/eliscript-reader.el +141 -57
  55. package/compiler/eliscript-source-map.el +26 -12
  56. package/compiler/eliscript-transient-analysis.el +382 -19
  57. package/dist/backends/async.mjs +561 -0
  58. package/dist/backends/async.mjs.macro-origins.json +1 -0
  59. package/dist/backends/async.mjs.map +1 -0
  60. package/dist/backends/binary.mjs +381 -0
  61. package/dist/backends/binary.mjs.macro-origins.json +1 -0
  62. package/dist/backends/binary.mjs.map +1 -0
  63. package/dist/backends/capabilities.mjs +237 -0
  64. package/dist/backends/capabilities.mjs.macro-origins.json +1 -0
  65. package/dist/backends/capabilities.mjs.map +1 -0
  66. package/dist/backends/elf.mjs +540 -0
  67. package/dist/backends/elf.mjs.macro-origins.json +1 -0
  68. package/dist/backends/elf.mjs.map +1 -0
  69. package/dist/backends/managed.mjs +10616 -0
  70. package/dist/backends/managed.mjs.macro-origins.json +1 -0
  71. package/dist/backends/managed.mjs.map +1 -0
  72. package/dist/backends/memory.mjs +278 -0
  73. package/dist/backends/memory.mjs.macro-origins.json +1 -0
  74. package/dist/backends/memory.mjs.map +1 -0
  75. package/dist/backends/native.mjs +4099 -0
  76. package/dist/backends/native.mjs.macro-origins.json +1 -0
  77. package/dist/backends/native.mjs.map +1 -0
  78. package/dist/backends/numeric.mjs +2458 -0
  79. package/dist/backends/numeric.mjs.macro-origins.json +1 -0
  80. package/dist/backends/numeric.mjs.map +1 -0
  81. package/dist/backends/optimize.mjs +204 -0
  82. package/dist/backends/optimize.mjs.macro-origins.json +1 -0
  83. package/dist/backends/optimize.mjs.map +1 -0
  84. package/dist/backends/regexp.mjs +2033 -0
  85. package/dist/backends/regexp.mjs.macro-origins.json +1 -0
  86. package/dist/backends/regexp.mjs.map +1 -0
  87. package/dist/backends/sha256.mjs +310 -0
  88. package/dist/backends/sha256.mjs.macro-origins.json +1 -0
  89. package/dist/backends/sha256.mjs.map +1 -0
  90. package/dist/backends/wasm.mjs +2258 -0
  91. package/dist/backends/wasm.mjs.macro-origins.json +1 -0
  92. package/dist/backends/wasm.mjs.map +1 -0
  93. package/dist/bootstrap/analyzer.mjs +1908 -776
  94. package/dist/bootstrap/analyzer.mjs.macro-origins.json +1 -0
  95. package/dist/bootstrap/analyzer.mjs.map +1 -1
  96. package/dist/bootstrap/compiler.mjs +450 -142
  97. package/dist/bootstrap/compiler.mjs.macro-origins.json +1 -0
  98. package/dist/bootstrap/compiler.mjs.map +1 -1
  99. package/dist/bootstrap/emitter.mjs +3083 -909
  100. package/dist/bootstrap/emitter.mjs.macro-origins.json +1 -0
  101. package/dist/bootstrap/emitter.mjs.map +1 -1
  102. package/dist/bootstrap/expander.mjs +2887 -1233
  103. package/dist/bootstrap/expander.mjs.macro-origins.json +1 -0
  104. package/dist/bootstrap/expander.mjs.map +1 -1
  105. package/dist/bootstrap/formatter.mjs +582 -218
  106. package/dist/bootstrap/formatter.mjs.macro-origins.json +1 -0
  107. package/dist/bootstrap/formatter.mjs.map +1 -1
  108. package/dist/bootstrap/ir.mjs +670 -116
  109. package/dist/bootstrap/ir.mjs.macro-origins.json +1 -0
  110. package/dist/bootstrap/ir.mjs.map +1 -1
  111. package/dist/bootstrap/lower.mjs +866 -257
  112. package/dist/bootstrap/lower.mjs.macro-origins.json +1 -0
  113. package/dist/bootstrap/lower.mjs.map +1 -1
  114. package/dist/bootstrap/package.json +1 -0
  115. package/dist/bootstrap/project.mjs +1168 -498
  116. package/dist/bootstrap/project.mjs.macro-origins.json +1 -0
  117. package/dist/bootstrap/project.mjs.map +1 -1
  118. package/dist/bootstrap/reader.mjs +674 -175
  119. package/dist/bootstrap/reader.mjs.macro-origins.json +1 -0
  120. package/dist/bootstrap/reader.mjs.map +1 -1
  121. package/dist/bootstrap/runtime/math.mjs +1117 -0
  122. package/dist/bootstrap/runtime/math.mjs.map +1 -0
  123. package/dist/bootstrap/runtime/unicode-case-data.mjs +10125 -0
  124. package/dist/bootstrap/runtime/unicode-case-data.mjs.map +1 -0
  125. package/dist/bootstrap/runtime/unicode-case.mjs +281 -0
  126. package/dist/bootstrap/runtime/unicode-case.mjs.map +1 -0
  127. package/dist/bootstrap/source-map.mjs +430 -119
  128. package/dist/bootstrap/source-map.mjs.macro-origins.json +1 -0
  129. package/dist/bootstrap/source-map.mjs.map +1 -1
  130. package/dist/bootstrap/symbol.mjs +229 -53
  131. package/dist/bootstrap/symbol.mjs.macro-origins.json +1 -0
  132. package/dist/bootstrap/symbol.mjs.map +1 -1
  133. package/dist/bootstrap/syntax.mjs +205 -7
  134. package/dist/bootstrap/syntax.mjs.macro-origins.json +1 -0
  135. package/dist/bootstrap/syntax.mjs.map +1 -1
  136. package/dist/bootstrap/transient-analysis.mjs +1185 -489
  137. package/dist/bootstrap/transient-analysis.mjs.macro-origins.json +1 -0
  138. package/dist/bootstrap/transient-analysis.mjs.map +1 -1
  139. package/dist/browser/compiler.js +199 -6478
  140. package/dist/browser/host.mjs +446 -0
  141. package/dist/browser/loader.js +1 -0
  142. package/dist/browser/loader.mjs +231 -0
  143. package/dist/browser/worker.mjs +60 -0
  144. package/dist/compiler-artifact.json +1 -0
  145. package/dist/host/compiler-session.mjs +2980 -0
  146. package/dist/host/compiler-session.mjs.macro-origins.json +1 -0
  147. package/dist/host/compiler-session.mjs.map +1 -0
  148. package/dist/host/compiler-tools.mjs +1084 -0
  149. package/dist/host/compiler-tools.mjs.macro-origins.json +1 -0
  150. package/dist/host/compiler-tools.mjs.map +1 -0
  151. package/dist/literal-sources/runtime/core/collection-internals.eli +60 -0
  152. package/dist/literal-sources/runtime/core/collection.eli +579 -0
  153. package/dist/literal-sources/runtime/core/data-text.eli +290 -0
  154. package/dist/literal-sources/runtime/core/data.eli +22 -0
  155. package/dist/literal-sources/runtime/core/identifier.eli +44 -0
  156. package/dist/literal-sources/runtime/core/lazy-sequence.eli +131 -0
  157. package/dist/literal-sources/runtime/core/list.eli +19 -0
  158. package/dist/literal-sources/runtime/core/map.eli +9 -0
  159. package/dist/literal-sources/runtime/core/metadata-internals.eli +6 -0
  160. package/dist/literal-sources/runtime/core/metadata.eli +23 -0
  161. package/dist/literal-sources/runtime/core/object.eli +8 -0
  162. package/dist/literal-sources/runtime/core/order.eli +123 -0
  163. package/dist/literal-sources/runtime/core/persistent-kind.eli +28 -0
  164. package/dist/literal-sources/runtime/core/protocol-error.eli +32 -0
  165. package/dist/literal-sources/runtime/core/protocol.eli +28 -0
  166. package/dist/literal-sources/runtime/core/queue.eli +9 -0
  167. package/dist/literal-sources/runtime/core/record.eli +191 -0
  168. package/dist/literal-sources/runtime/core/regex.eli +158 -0
  169. package/dist/literal-sources/runtime/core/sequence.eli +305 -0
  170. package/dist/literal-sources/runtime/core/set-algebra.eli +28 -0
  171. package/dist/literal-sources/runtime/core/set.eli +9 -0
  172. package/dist/literal-sources/runtime/core/sorted.eli +408 -0
  173. package/dist/literal-sources/runtime/core/text.eli +14 -0
  174. package/dist/literal-sources/runtime/core/transducer.eli +268 -0
  175. package/dist/literal-sources/runtime/core/transient.eli +17 -0
  176. package/dist/literal-sources/runtime/core/truth.eli +4 -0
  177. package/dist/literal-sources/runtime/core/type.eli +232 -0
  178. package/dist/literal-sources/runtime/core/value-internals.eli +13 -0
  179. package/dist/literal-sources/runtime/core/value.eli +19 -0
  180. package/dist/literal-sources/runtime/core/vector.eli +20 -0
  181. package/dist/literal-sources/runtime/literals.eli +23 -0
  182. package/dist/literal-sources/runtime/testing/value.eli +6 -0
  183. package/dist/literal-sources/runtime/wire/http-rpc.eli +362 -0
  184. package/dist/literal-sources/runtime/wire/markdown.eli +275 -0
  185. package/dist/literal-sources/runtime/wire/schema.eli +193 -0
  186. package/dist/literal-sources/stdlib/bit.eli +36 -0
  187. package/dist/literal-sources/stdlib/core/data.eli +306 -0
  188. package/dist/literal-sources/stdlib/core/object.eli +89 -0
  189. package/dist/literal-sources/stdlib/core/protocol.eli +451 -0
  190. package/dist/literal-sources/stdlib/core/set.eli +312 -0
  191. package/dist/literal-sources/stdlib/core/text.eli +103 -0
  192. package/dist/literal-sources/stdlib/managed-literal-protocols.eli +483 -0
  193. package/dist/literal-sources/stdlib/managed-literals.eli +1414 -0
  194. package/dist/literal-sources/stdlib/managed-queue-state.eli +65 -0
  195. package/dist/literal-sources/stdlib/managed-sorted-state.eli +233 -0
  196. package/dist/literal-sources/stdlib/managed-transient-state.eli +348 -0
  197. package/dist/literal-sources/stdlib/managed-value-state.eli +153 -0
  198. package/dist/literal-sources/stdlib/managed-vector-view-state.eli +102 -0
  199. package/dist/literal-sources/stdlib/persistent-list.eli +145 -0
  200. package/dist/literal-sources/stdlib/persistent-map.eli +724 -0
  201. package/dist/literal-sources/stdlib/persistent-set.eli +236 -0
  202. package/dist/literal-sources/stdlib/persistent-vector.eli +359 -0
  203. package/dist/literal-sources/stdlib/value.eli +325 -0
  204. package/dist/package.json +10 -0
  205. package/dist/runtime/math.mjs +1116 -0
  206. package/dist/runtime/math.mjs.macro-origins.json +1 -0
  207. package/dist/runtime/math.mjs.map +1 -0
  208. package/dist/runtime/unicode-case-data.mjs +10124 -0
  209. package/dist/runtime/unicode-case-data.mjs.macro-origins.json +1 -0
  210. package/dist/runtime/unicode-case-data.mjs.map +1 -0
  211. package/dist/runtime/unicode-case.mjs +280 -0
  212. package/dist/runtime/unicode-case.mjs.macro-origins.json +1 -0
  213. package/dist/runtime/unicode-case.mjs.map +1 -0
  214. package/dist/runtime.eli +30379 -0
  215. package/dist/stage3-release.json +1 -0
  216. package/editor/README.md +1 -1
  217. package/editor/eliscript-mode.el +1 -1
  218. package/editor/eliscript-repl.el +1 -1
  219. package/package.json +97 -10
  220. package/platform/http.mjs +20 -0
  221. package/runtime/array-text.mjs +159 -0
  222. package/runtime/core/map-internals.mjs +27 -9
  223. package/runtime/core/object-impl.mjs +26 -17
  224. package/runtime/core/object-impl.mjs.map +1 -1
  225. package/runtime/core/protocol-impl.mjs +682 -255
  226. package/runtime/core/protocol-impl.mjs.map +1 -1
  227. package/runtime/core/protocol.mjs +4 -0
  228. package/runtime/core/record.mjs +23 -2
  229. package/runtime/core/regex.mjs +4 -0
  230. package/runtime/core/sorted.mjs +53 -0
  231. package/runtime/core/text-impl.mjs +167 -48
  232. package/runtime/core/text-impl.mjs.map +1 -1
  233. package/runtime/core/type.mjs +75 -3
  234. package/runtime/core/vector.mjs +6 -0
  235. package/runtime/math.eli +429 -0
  236. package/runtime/math.mjs +1116 -0
  237. package/runtime/math.mjs.map +1 -0
  238. package/runtime/number-radix.mjs +105 -0
  239. package/runtime/unicode-case-data.eli +29 -0
  240. package/runtime/unicode-case-data.mjs +10124 -0
  241. package/runtime/unicode-case-data.mjs.map +1 -0
  242. package/runtime/unicode-case.eli +100 -0
  243. package/runtime/unicode-case.mjs +280 -0
  244. package/runtime/unicode-case.mjs.map +1 -0
  245. package/runtime/wire/http-rpc.mjs +168 -0
  246. package/runtime/wire/markdown.mjs +196 -0
  247. package/runtime/wire/schema.mjs +109 -0
  248. package/stdlib/README.md +54 -0
  249. package/stdlib/core/protocol.eli +81 -17
  250. package/stdlib/core/seq.eli +1 -1
  251. package/stdlib/core/zipper.eli +114 -47
  252. package/stdlib/gepo.eli +12 -0
  253. package/stdlib/interop/js.eli +56 -15
  254. package/stdlib/managed-literal-protocols.eli +483 -0
  255. package/stdlib/managed-literals.eli +1414 -0
  256. package/stdlib/managed-protocol-error.eli +32 -0
  257. package/stdlib/managed-queue-state.eli +65 -0
  258. package/stdlib/managed-runtime-collection-internals.eli +60 -0
  259. package/stdlib/managed-runtime-collection.eli +579 -0
  260. package/stdlib/managed-runtime-data-text.eli +290 -0
  261. package/stdlib/managed-runtime-data.eli +22 -0
  262. package/stdlib/managed-runtime-identifier.eli +44 -0
  263. package/stdlib/managed-runtime-lazy-sequence.eli +131 -0
  264. package/stdlib/managed-runtime-list.eli +19 -0
  265. package/stdlib/managed-runtime-literals.eli +23 -0
  266. package/stdlib/managed-runtime-map.eli +9 -0
  267. package/stdlib/managed-runtime-metadata-internals.eli +6 -0
  268. package/stdlib/managed-runtime-metadata.eli +23 -0
  269. package/stdlib/managed-runtime-object.eli +8 -0
  270. package/stdlib/managed-runtime-order.eli +123 -0
  271. package/stdlib/managed-runtime-persistent-kind.eli +28 -0
  272. package/stdlib/managed-runtime-protocol.eli +28 -0
  273. package/stdlib/managed-runtime-queue.eli +9 -0
  274. package/stdlib/managed-runtime-record.eli +191 -0
  275. package/stdlib/managed-runtime-regex.eli +158 -0
  276. package/stdlib/managed-runtime-sequence.eli +305 -0
  277. package/stdlib/managed-runtime-set-algebra.eli +28 -0
  278. package/stdlib/managed-runtime-set.eli +9 -0
  279. package/stdlib/managed-runtime-sorted.eli +408 -0
  280. package/stdlib/managed-runtime-text.eli +14 -0
  281. package/stdlib/managed-runtime-transducer.eli +268 -0
  282. package/stdlib/managed-runtime-transient.eli +17 -0
  283. package/stdlib/managed-runtime-truth.eli +4 -0
  284. package/stdlib/managed-runtime-type.eli +232 -0
  285. package/stdlib/managed-runtime-value-internals.eli +13 -0
  286. package/stdlib/managed-runtime-value.eli +19 -0
  287. package/stdlib/managed-runtime-vector.eli +20 -0
  288. package/stdlib/managed-sorted-state.eli +233 -0
  289. package/stdlib/managed-testing-value.eli +6 -0
  290. package/stdlib/managed-transient-state.eli +348 -0
  291. package/stdlib/managed-value-state.eli +153 -0
  292. package/stdlib/managed-vector-view-state.eli +102 -0
  293. package/stdlib/managed-wire-http-rpc.eli +362 -0
  294. package/stdlib/managed-wire-markdown.eli +275 -0
  295. package/stdlib/managed-wire-schema.eli +193 -0
  296. package/stdlib/mdp.eli +7 -0
  297. package/stdlib/mds.eli +4 -0
  298. package/stdlib/persistent-vector.eli +23 -6
  299. package/tools/acceptance/check-legacy.mjs +687 -0
  300. package/tools/acceptance/check.eli +431 -0
  301. package/tools/acceptance/compile-evidence.el +49 -0
  302. package/tools/acceptance/finalize-legacy.mjs +498 -0
  303. package/tools/acceptance/finalize.eli +270 -0
  304. package/tools/backends/benchmark.mjs +175 -0
  305. package/tools/backends/build.mjs +135 -0
  306. package/tools/backends/compile.mjs +94 -0
  307. package/tools/backends/compiler-bootstrap.mjs +1001 -0
  308. package/tools/backends/compiler-browser.mjs +361 -0
  309. package/tools/backends/compiler-build.mjs +1628 -0
  310. package/tools/backends/compiler-cli-legacy.mjs +334 -0
  311. package/tools/backends/compiler-cli.mjs +29 -0
  312. package/tools/backends/compiler-corpus-bit.mjs +234 -0
  313. package/tools/backends/compiler-corpus-cli-adapters-legacy.mjs +362 -0
  314. package/tools/backends/compiler-corpus-cli-adapters.mjs +247 -0
  315. package/tools/backends/compiler-corpus-debugging.mjs +221 -0
  316. package/tools/backends/compiler-corpus-emitter.mjs +324 -0
  317. package/tools/backends/compiler-corpus-evaluation-adapters.mjs +65 -0
  318. package/tools/backends/compiler-corpus-execution-legacy.mjs +769 -0
  319. package/tools/backends/compiler-corpus-execution.mjs +3324 -0
  320. package/tools/backends/compiler-corpus-fuzz.mjs +229 -0
  321. package/tools/backends/compiler-corpus-generations.mjs +208 -0
  322. package/tools/backends/compiler-corpus-host-context-legacy.mjs +114 -0
  323. package/tools/backends/compiler-corpus-host-context.mjs +550 -0
  324. package/tools/backends/compiler-corpus-identity-host.mjs +553 -0
  325. package/tools/backends/compiler-corpus-identity-value-adapters-legacy.mjs +298 -0
  326. package/tools/backends/compiler-corpus-identity-value-adapters.mjs +69 -0
  327. package/tools/backends/compiler-corpus-isolated-exports.mjs +21 -0
  328. package/tools/backends/compiler-corpus-legacy.mjs +1155 -0
  329. package/tools/backends/compiler-corpus-literal-provider.mjs +282 -0
  330. package/tools/backends/compiler-corpus-managed-adapters-legacy.mjs +334 -0
  331. package/tools/backends/compiler-corpus-managed-adapters.mjs +937 -0
  332. package/tools/backends/compiler-corpus-managed-cases.mjs +179 -0
  333. package/tools/backends/compiler-corpus-managed-fixtures-legacy.mjs +879 -0
  334. package/tools/backends/compiler-corpus-managed-fixtures.mjs +1287 -0
  335. package/tools/backends/compiler-corpus-matchers.mjs +173 -0
  336. package/tools/backends/compiler-corpus-original-program.mjs +612 -0
  337. package/tools/backends/compiler-corpus-process.mjs +765 -0
  338. package/tools/backends/compiler-corpus-program-driver.mjs +306 -0
  339. package/tools/backends/compiler-corpus-project-adapters-legacy.mjs +497 -0
  340. package/tools/backends/compiler-corpus-project-adapters.mjs +340 -0
  341. package/tools/backends/compiler-corpus-project-entry-host.mjs +511 -0
  342. package/tools/backends/compiler-corpus-project-transport.mjs +151 -0
  343. package/tools/backends/compiler-corpus-raw-fixture-observer.mjs +1438 -0
  344. package/tools/backends/compiler-corpus-raw-language-fixtures.mjs +1456 -0
  345. package/tools/backends/compiler-corpus-raw-math-fixture.mjs +346 -0
  346. package/tools/backends/compiler-corpus-raw-special-fixtures.mjs +523 -0
  347. package/tools/backends/compiler-corpus-reference-legacy.mjs +263 -0
  348. package/tools/backends/compiler-corpus-reference.mjs +241 -0
  349. package/tools/backends/compiler-corpus-runtime-adapters-legacy.mjs +843 -0
  350. package/tools/backends/compiler-corpus-runtime-adapters.mjs +663 -0
  351. package/tools/backends/compiler-corpus-source-archive.mjs +206 -0
  352. package/tools/backends/compiler-corpus-tools-artifact-adapters.mjs +410 -0
  353. package/tools/backends/compiler-corpus-tools-cli.mjs +363 -0
  354. package/tools/backends/compiler-corpus-tools-reference.mjs +264 -0
  355. package/tools/backends/compiler-corpus.mjs +2054 -0
  356. package/tools/backends/compiler-debug.mjs +142 -0
  357. package/tools/backends/compiler-matrix.mjs +1955 -0
  358. package/tools/backends/compiler-metadata.mjs +203 -0
  359. package/tools/backends/compiler-package-browser.mjs +120 -0
  360. package/tools/backends/compiler-package-legacy.mjs +654 -0
  361. package/tools/backends/compiler-package.mjs +464 -0
  362. package/tools/backends/compiler-project.mjs +126 -0
  363. package/tools/backends/compiler-session.mjs +843 -0
  364. package/tools/backends/compiler-sha256.mjs +152 -0
  365. package/tools/backends/compiler-unicode-profile-host.mjs +196 -0
  366. package/tools/backends/compiler-worker.mjs +573 -0
  367. package/tools/backends/dist/bootstrap-js-stages.mjs +919 -0
  368. package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -0
  369. package/tools/backends/dist/managed-ir-inventory.mjs +488 -0
  370. package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -0
  371. package/tools/backends/dist/record-grid.mjs +1256 -0
  372. package/tools/backends/dist/record-grid.mjs.map +1 -0
  373. package/tools/backends/dist/release-cli.mjs +460 -0
  374. package/tools/backends/dist/release-cli.mjs.map +1 -0
  375. package/tools/backends/dist/run-artifact.mjs +517 -0
  376. package/tools/backends/dist/run-artifact.mjs.map +1 -0
  377. package/tools/backends/eliscript/compiler-corpus-bit.eli +77 -0
  378. package/tools/backends/eliscript/compiler-corpus-debugging.eli +70 -0
  379. package/tools/backends/eliscript/compiler-corpus-project-entry-host.eli +256 -0
  380. package/tools/backends/managed-foreign-binding.mjs +497 -0
  381. package/tools/backends/managed-host-legacy.mjs +1181 -0
  382. package/tools/backends/managed-host-lifecycle.mjs +310 -0
  383. package/tools/backends/managed-host-object-provider.mjs +155 -0
  384. package/tools/backends/managed-host-object-realm.mjs +797 -0
  385. package/tools/backends/managed-host-proxy.mjs +71 -0
  386. package/tools/backends/managed-host-runtime.mjs +5868 -0
  387. package/tools/backends/managed-host.mjs +716 -0
  388. package/tools/backends/managed-module-graph-legacy.mjs +308 -0
  389. package/tools/backends/managed-module-graph.mjs +694 -0
  390. package/tools/backends/managed-runtime-host-legacy.mjs +195 -0
  391. package/tools/backends/managed-runtime.mjs +939 -0
  392. package/tools/backends/managed-source-view-legacy.mjs +332 -0
  393. package/tools/backends/managed-source-view.mjs +959 -0
  394. package/tools/backends/memory-runtime.mjs +100 -0
  395. package/tools/backends/native-benchmark.mjs +88 -0
  396. package/tools/backends/native-managed-runtime.mjs +677 -0
  397. package/tools/backends/native-memory.mjs +768 -0
  398. package/tools/backends/native-node-memory.mjs +142 -0
  399. package/tools/backends/native-node-runner.mjs +99 -0
  400. package/tools/backends/native-node-watchdog.mjs +19 -0
  401. package/tools/backends/native-node-worker.mjs +75 -0
  402. package/tools/backends/stage3-targets.mjs +486 -0
  403. package/tools/bootstrap-command.el +13 -0
  404. package/tools/bootstrap-runtime.el +101 -0
  405. package/tools/bootstrap-seed.el +55 -0
  406. package/tools/project/check-cli.eli +31 -0
  407. package/tools/project/project-cli.eli +42 -0
  408. package/tools/project/project.eli +122 -0
  409. package/tools/runtime/unicode-case-profiles.mjs +13 -0
  410. package/tools/runtime/unicode-case-runtime.el +57 -0
  411. package/tools/testing/source-debugging-corpus-host.eli +16 -0
  412. package/tools/testing/source-debugging.eli +139 -0
  413. package/tools/testing/stdlib-bit-corpus-host.eli +21 -0
  414. package/tools/testing/stdlib-bit-corpus-host.mjs +118 -0
  415. package/tools/testing/stdlib-bit.eli +104 -0
  416. package/tools/testing/stdlib-bit.mjs +255 -0
  417. 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
- const fail = (diagnostic) => { const p = diagnostic.location.start; const error = new Error(`${diagnostic.location.file}:${p.line}:${p.column}: ${diagnostic.message}`); error.eliscriptDiagnostic = diagnostic; throw error; };
10
- const guard = (operation, onError) => { try { return operation(); } catch (error) { return onError(error.message); } };
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
- return ((file) => {
13
- return fail(({"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)})})}));
14
- })(((__eliscript_value_1) => (__eliscript_truthy(__eliscript_value_1) ? __eliscript_value_1 : ((__eliscript_value_2) => (__eliscript_truthy(__eliscript_value_2) ? __eliscript_value_2 : "<input>"))(((__eliscript_value_3) => (__eliscript_truthy(__eliscript_value_3) ? (span)["filename"] : __eliscript_value_3))(span))))((context)["filename"]));
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 ((__eliscript_value_4) => (__eliscript_truthy(__eliscript_value_4) ? (node_kind(node) === "symbol") : __eliscript_value_4))(node);
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 ((__eliscript_value_5) => (__eliscript_truthy(__eliscript_value_5) ? (node_kind(node) === "keyword") : __eliscript_value_5))(node);
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 ((__eliscript_value_6) => (__eliscript_truthy(__eliscript_value_6) ? (node_kind(node) === "vector") : __eliscript_value_6))(node);
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 ((__eliscript_value_7) => (__eliscript_truthy(__eliscript_value_7) ? ((__eliscript_value_8) => (__eliscript_truthy(__eliscript_value_8) ? ((__eliscript_value_9) => (__eliscript_truthy(__eliscript_value_9) ? ((__eliscript_value_10) => (__eliscript_truthy(__eliscript_value_10) ? (node_name(((((node_items(node)) ?? [])[0]) ?? null)) === "hash-map") : __eliscript_value_10))(symbol_node_p(((((node_items(node)) ?? [])[0]) ?? null))) : __eliscript_value_9))(((node_items(node))["length"] > 0)) : __eliscript_value_8))((node_kind(node) === "list")) : __eliscript_value_7))(node);
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 ((__eliscript_value_11) => (__eliscript_truthy(__eliscript_value_11) ? ((__eliscript_value_12) => (__eliscript_truthy(__eliscript_value_12) ? (typeof node.value === "string") : __eliscript_value_12))((node_kind(node) === "literal")) : __eliscript_value_11))(node);
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 ((__eliscript_value_13) => (__eliscript_truthy(__eliscript_value_13) ? ((__eliscript_value_14) => (__eliscript_truthy(__eliscript_value_14) ? (node_value(node) == null) : __eliscript_value_14))((node_kind(node) === "literal")) : __eliscript_value_13))(node);
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
- return (__eliscript_truthy(((__eliscript_value_15) => (__eliscript_truthy(__eliscript_value_15) ? (node_kind(node) === "list") : __eliscript_value_15))(node)) ? node_items(node) : (__eliscript_truthy(null_node_p(node)) ? [] : undefined));
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 (["&optional", "&rest", "&body"])["includes"](name);
196
+ return ((name === "&optional") || (name === "&rest") || (name === "&body"));
45
197
  }
46
198
  function split_binding_name(name) {
47
- return ((slash) => {
48
- return (__eliscript_truthy((slash < 0)) ? ({"namespace": undefined, "local": name}) : ({"namespace": (name)["slice"](0, slash), "local": (name)["slice"]((slash + 1))}));
49
- })((name)["lastIndexOf"]("/"));
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
- return (__eliscript_truthy(keyword_node_p(node)) ? ((parts) => {
53
- return ((kind) => {
54
- return (__eliscript_truthy((["keys", "strs", "syms"])["includes"](kind)) ? ({"kind": kind, "namespace": (parts)["namespace"]}) : null);
55
- })((parts)["local"]);
56
- })(split_binding_name(node_name(node))) : null);
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
- return ((name) => {
60
- return ((parts) => {
61
- return ((local) => {
62
- return ((namespace) => {
63
- return ((kind) => {
64
- return ((qualified) => {
65
- return ({"target": ({"kind": "symbol", "name": local, "span": node_span(name_node)}), "keyKind": kind, "keyName": (__eliscript_truthy((kind === "strs")) ? name : qualified)});
66
- })((__eliscript_truthy(namespace) ? (String(namespace) + String("/") + String(local)) : local));
67
- })((shortcut)["kind"]);
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 ((__eliscript_value_17) => (__eliscript_truthy(__eliscript_value_17) ? __eliscript_value_17 : ((__eliscript_value_18) => (__eliscript_truthy(__eliscript_value_18) ? ((__eliscript_value_19) => (__eliscript_truthy(__eliscript_value_19) ? ((__eliscript_value_20) => (__eliscript_truthy(__eliscript_value_20) ? __eliscript_value_20 : (typeof node.value === "number")))((typeof node.value === "string")) : __eliscript_value_19))((node_kind(node) === "literal")) : __eliscript_value_18))(node)))(keyword_node_p(node));
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
- return ((items, entries, defaults, as, shortcuts_seen, or_seen, as_seen, index) => {
78
- (() => {
79
- while (__eliscript_truthy((index < (items)["length"]))) {
80
- ((left) => {
81
- return ((right) => {
82
- return ((directive) => {
83
- return ((shortcut) => {
84
- return (__eliscript_truthy(shortcut) ? ((kind) => {
85
- (__eliscript_truthy((shortcuts_seen)["has"](directive)) ? analyzer_fail(context, node_span(left), (String("map binding pattern accepts :") + String(directive) + String(" once"))) : null);
86
- (shortcuts_seen)["add"](directive);
87
- (__eliscript_truthy((!__eliscript_truthy(vector_node_p(right)))) ? analyzer_fail(context, node_span(right), (String("map binding :") + String(kind) + String(" value must be a vector"))) : null);
88
- return (node_items(right))["forEach"]((name_node) => {
89
- return ((name) => {
90
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_23) => (__eliscript_truthy(__eliscript_value_23) ? ((__eliscript_value_24) => (__eliscript_truthy(__eliscript_value_24) ? (((split_binding_name(name))["local"])["length"] > 0) : __eliscript_value_24))((!__eliscript_truthy(binding_marker_p(name)))) : __eliscript_value_23))(name)))) ? analyzer_fail(context, node_span(name_node), (String("map binding :") + String(kind) + String(" entries must be symbols"))) : null);
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
- })(((__eliscript_value_22) => (__eliscript_truthy(__eliscript_value_22) ? node_name(name_node) : __eliscript_value_22))(symbol_node_p(name_node)));
93
- });
94
- })((shortcut)["kind"]) : (__eliscript_truthy((directive === "or")) ? (() => {
95
- (__eliscript_truthy(or_seen) ? analyzer_fail(context, node_span(left), "map binding pattern accepts :or once") : null);
96
- ((or_seen = true));
97
- (__eliscript_truthy((!__eliscript_truthy(map_node_p(right)))) ? analyzer_fail(context, node_span(right), "map binding :or value must be a map") : null);
98
- return ((pairs, default_index) => {
99
- return (() => {
100
- while (__eliscript_truthy((default_index < (pairs)["length"]))) {
101
- ((name_node) => {
102
- return ((default$) => {
103
- return ((name) => {
104
- return (() => {
105
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_26) => (__eliscript_truthy(__eliscript_value_26) ? (!__eliscript_truthy(binding_marker_p(name))) : __eliscript_value_26))(name)))) ? analyzer_fail(context, node_span(name_node), "map binding :or keys must be binding symbols") : null);
106
- (__eliscript_truthy((defaults)["has"](name)) ? analyzer_fail(context, node_span(name_node), "duplicate map binding :or default") : null);
107
- return (defaults)["set"](name, default$);
108
- })();
109
- })(((__eliscript_value_25) => (__eliscript_truthy(__eliscript_value_25) ? node_name(name_node) : __eliscript_value_25))(symbol_node_p(name_node)));
110
- })(((((pairs) ?? [])[(default_index + 1)]) ?? null));
111
- })(((((pairs) ?? [])[default_index]) ?? null));
112
- ((default_index = (default_index + 2)));
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
- return null;
115
- })();
116
- })((node_items(right))["slice"](1), 0);
117
- })() : (__eliscript_truthy((directive === "as")) ? (() => {
118
- (__eliscript_truthy(as_seen) ? analyzer_fail(context, node_span(left), "map binding pattern accepts :as once") : null);
119
- ((as_seen = true));
120
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_27) => (__eliscript_truthy(__eliscript_value_27) ? (!__eliscript_truthy(binding_marker_p(node_name(right)))) : __eliscript_value_27))(symbol_node_p(right))))) ? analyzer_fail(context, node_span(right), "map binding :as value must be a symbol") : null);
121
- return ((as = right));
122
- })() : (__eliscript_truthy(directive) ? analyzer_fail(context, node_span(left), (String("unknown map binding directive: :") + String(directive))) : (() => {
123
- (__eliscript_truthy((!__eliscript_truthy(binding_pattern_p(left)))) ? analyzer_fail(context, node_span(left), "map binding entry target must be a binding pattern") : null);
124
- (__eliscript_truthy((!__eliscript_truthy(map_binding_key_p(right)))) ? analyzer_fail(context, node_span(right), "map binding entry key must be a keyword, string, or number") : null);
125
- return (entries)["push"](({"target": left, "key": right}));
126
- })()))));
127
- })(map_binding_shortcut(left));
128
- })(((__eliscript_value_21) => (__eliscript_truthy(__eliscript_value_21) ? node_name(left) : __eliscript_value_21))(keyword_node_p(left)));
129
- })(((((items) ?? [])[(index + 1)]) ?? null));
130
- })(((((items) ?? [])[index]) ?? null));
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
- return null;
134
- })();
135
- (defaults)["forEach"]((default$, name) => {
136
- return ((entry) => {
137
- (__eliscript_truthy((!__eliscript_truthy(entry))) ? analyzer_fail(context, node_span(default$), (String("map binding :or has no scalar target: ") + String(name))) : null);
138
- ((entry)["default"] = default$);
139
- return ((entry)["hasDefault"] = true);
140
- })((entries)["find"]((candidate) => {
141
- return ((__eliscript_value_28) => (__eliscript_truthy(__eliscript_value_28) ? (node_name((candidate)["target"]) === name) : __eliscript_value_28))(symbol_node_p((candidate)["target"]));
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
- return ({"entries": entries, "as": as});
145
- })((node_items(pattern))["slice"](1), [], new globalThis.Map(), undefined, new globalThis.Set(), false, false, 0);
366
+ return ({"entries": entries, "as": as});
367
+ }
368
+ }
146
369
  }
147
370
  function binding_nodes(pattern, context) {
148
- return (__eliscript_truthy(symbol_node_p(pattern)) ? (__eliscript_truthy(binding_marker_p(node_name(pattern))) ? analyzer_fail(context, node_span(pattern), "invalid binding pattern marker") : [pattern]) : (__eliscript_truthy(vector_node_p(pattern)) ? ((result, rest_seen, rest_done) => {
149
- (node_items(pattern))["forEach"]((element) => {
150
- return ((name) => {
151
- return (__eliscript_truthy((name === "&rest")) ? (() => {
152
- (__eliscript_truthy(((__eliscript_value_30) => (__eliscript_truthy(__eliscript_value_30) ? __eliscript_value_30 : rest_done))(rest_seen)) ? analyzer_fail(context, node_span(element), "invalid vector binding pattern") : null);
153
- return ((rest_seen = true));
154
- })() : (__eliscript_truthy(rest_seen) ? (() => {
155
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_31) => (__eliscript_truthy(__eliscript_value_31) ? (!__eliscript_truthy(binding_marker_p(name))) : __eliscript_value_31))(name)))) ? analyzer_fail(context, node_span(element), "vector &rest binding must be a symbol") : null);
156
- (result)["push"](element);
157
- ((rest_seen = false));
158
- return ((rest_done = true));
159
- })() : (__eliscript_truthy(rest_done) ? analyzer_fail(context, node_span(element), "vector &rest binding must be final") : (__eliscript_truthy(null_node_p(element)) ? null : (binding_nodes(element, context))["forEach"]((binding) => {
160
- return (result)["push"](binding);
161
- })))));
162
- })(((__eliscript_value_29) => (__eliscript_truthy(__eliscript_value_29) ? node_name(element) : __eliscript_value_29))(symbol_node_p(element)));
163
- });
164
- (__eliscript_truthy(rest_seen) ? analyzer_fail(context, node_span(pattern), "vector &rest requires a binding") : null);
165
- return result;
166
- })([], false, false) : (__eliscript_truthy(map_node_p(pattern)) ? ((spec) => {
167
- return ((result) => {
168
- return (() => {
169
- ((spec)["entries"])["forEach"]((entry) => {
170
- return (binding_nodes((entry)["target"], context))["forEach"]((binding) => {
171
- return (result)["push"](binding);
172
- });
173
- });
174
- (__eliscript_truthy((spec)["as"]) ? (result)["push"]((spec)["as"]) : null);
175
- return result;
176
- })();
177
- })([]);
178
- })(map_binding_spec(pattern, context)) : analyzer_fail(context, ((__eliscript_value_32) => (__eliscript_truthy(__eliscript_value_32) ? node_span(pattern) : __eliscript_value_32))(pattern), (String("binding pattern must be a symbol, vector, or map: ") + String(node_display(pattern)))))));
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 ((__eliscript_value_33) => (__eliscript_truthy(__eliscript_value_33) ? __eliscript_value_33 : ((__eliscript_value_35) => (__eliscript_truthy(__eliscript_value_35) ? __eliscript_value_35 : map_node_p(node)))(vector_node_p(node))))(((__eliscript_value_34) => (__eliscript_truthy(__eliscript_value_34) ? (!__eliscript_truthy(binding_marker_p(node_name(node)))) : __eliscript_value_34))(symbol_node_p(node)));
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
- return ((items, parsed, mode, index) => {
185
- (__eliscript_truthy((items === undefined)) ? analyzer_fail(context, node_span(parameters), "function arguments must be a list") : null);
186
- (() => {
187
- while (__eliscript_truthy((index < (items)["length"]))) {
188
- ((parameter) => {
189
- return ((name) => {
190
- return (__eliscript_truthy((name === "&optional")) ? (() => {
191
- (__eliscript_truthy((!__eliscript_truthy((mode === "required")))) ? analyzer_fail(context, node_span(parameter), "invalid function parameter list") : null);
192
- return ((mode = "optional"));
193
- })() : (__eliscript_truthy((name === "&rest")) ? (() => {
194
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_37) => (__eliscript_truthy(__eliscript_value_37) ? __eliscript_value_37 : (mode === "optional")))((mode === "required"))))) ? analyzer_fail(context, node_span(parameter), "invalid function parameter list") : null);
195
- return ((mode = "rest"));
196
- })() : (__eliscript_truthy((name === "&body")) ? analyzer_fail(context, node_span(parameter), "invalid function parameter list") : (__eliscript_truthy((mode === "rest")) ? (() => {
197
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_38) => (__eliscript_truthy(__eliscript_value_38) ? (!__eliscript_truthy(binding_marker_p(name))) : __eliscript_value_38))(name)))) ? analyzer_fail(context, node_span(parameter), "function &rest parameter must be a symbol") : null);
198
- (parsed)["push"](({"kind": "rest", "node": parameter, "bindings": [parameter]}));
199
- return ((mode = "done"));
200
- })() : (__eliscript_truthy((mode === "done")) ? analyzer_fail(context, node_span(parameter), "invalid function parameter list") : (__eliscript_truthy(binding_pattern_p(parameter)) ? (parsed)["push"](({"kind": mode, "node": parameter, "bindings": binding_nodes(parameter, context)})) : analyzer_fail(context, node_span(parameter), (String("function arguments must be symbols, vectors, or maps: ") + String(node_display(parameters))))))))));
201
- })(((__eliscript_value_36) => (__eliscript_truthy(__eliscript_value_36) ? node_name(parameter) : __eliscript_value_36))(symbol_node_p(parameter)));
202
- })(((((items) ?? [])[index]) ?? null));
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
- return null;
206
- })();
207
- (__eliscript_truthy((mode === "rest")) ? analyzer_fail(context, node_span(parameters), "invalid function parameter list") : null);
208
- return parsed;
209
- })(list_items(parameters), [], "required", 0);
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
- return (__eliscript_truthy((!__eliscript_truthy(node))) ? "nil" : (__eliscript_truthy((node_kind(node) === "undefined")) ? "undefined" : (__eliscript_truthy((node_kind(node) === "symbol")) ? node_name(node) : (__eliscript_truthy((node_kind(node) === "keyword")) ? (String(":") + String(node_name(node))) : (__eliscript_truthy((node_kind(node) === "literal")) ? ((value) => {
213
- return (__eliscript_truthy((value == null)) ? "nil" : (__eliscript_truthy((value === true)) ? "t" : (__eliscript_truthy((value === false)) ? "false" : (__eliscript_truthy((typeof value === "string")) ? (JSON)["stringify"](value) : (String(value))))));
214
- })(node_value(node)) : (__eliscript_truthy(((__eliscript_value_39) => (__eliscript_truthy(__eliscript_value_39) ? __eliscript_value_39 : (node_kind(node) === "vector")))((node_kind(node) === "list"))) ? ((items) => {
215
- return ((contents) => {
216
- return (__eliscript_truthy(((__eliscript_value_40) => (__eliscript_truthy(__eliscript_value_40) ? ((__eliscript_value_41) => (__eliscript_truthy(__eliscript_value_41) ? ((__eliscript_value_42) => (__eliscript_truthy(__eliscript_value_42) ? (node_name(((((items) ?? [])[0]) ?? null)) === "quote") : __eliscript_value_42))(symbol_node_p(((((items) ?? [])[0]) ?? null))) : __eliscript_value_41))(((items)["length"] === 2)) : __eliscript_value_40))((node_kind(node) === "list"))) ? (String("'") + String(node_display(((((items) ?? [])[1]) ?? null)))) : (__eliscript_truthy((node_kind(node) === "list")) ? (String("(") + String(contents) + String(")")) : (String("[") + String(contents) + String("]"))));
217
- })(((items)["map"](node_display))["join"](" "));
218
- })(node_items(node)) : "<unsupported>"))))));
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": new Map(), "outputs": new Map(), "functionContext": function_context});
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 ((current, function_context) => {
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
- return guard(() => {
237
- return binding_name(name);
238
- }, (message) => {
239
- return analyzer_fail(context, span, message);
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
- return guard(() => {
244
- return reference_name(name);
245
- }, (message) => {
246
- return analyzer_fail(context, span, message);
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
- (__eliscript_truthy((!__eliscript_truthy(symbol_node_p(name_node)))) ? analyzer_fail(context, ((__eliscript_value_44) => (__eliscript_truthy(__eliscript_value_44) ? node_span(name_node) : __eliscript_value_44))(name_node), (String("expected binding name, got ") + String(node_display(name_node)))) : null);
251
- return ((name) => {
252
- return ((span) => {
253
- return ((names) => {
254
- return ((outputs) => {
255
- return ((output_name) => {
256
- return ((existing_name) => {
257
- return ((existing_output) => {
258
- return (() => {
259
- (__eliscript_truthy(existing_name) ? analyzer_fail(context, span, (String("duplicate ") + String(kind) + String(" binding: ") + String(name))) : null);
260
- (__eliscript_truthy(existing_output) ? analyzer_fail(context, span, (String("binding ") + String(name) + String(" emits ") + String(output_name) + String(", which collides with ") + String((existing_output)["name"]))) : null);
261
- return ((binding) => {
262
- (names)["set"](name, binding);
263
- (outputs)["set"](output_name, binding);
264
- return binding;
265
- })(({"name": name, "outputName": output_name, "kind": kind, "mutable": mutable}));
266
- })();
267
- })((outputs)["get"](output_name));
268
- })((names)["get"](name));
269
- })(guarded_binding_name(name, context, span));
270
- })((scope)["outputs"]);
271
- })((scope)["names"]);
272
- })(node_span(name_node));
273
- })(node_name(name_node));
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
- return (binding_nodes(pattern, context))["forEach"]((binding) => {
277
- return declare_binding(scope, binding, kind, mutable, context);
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
- return ((current, binding) => {
282
- (() => {
283
- while (__eliscript_truthy(((__eliscript_value_45) => (__eliscript_truthy(__eliscript_value_45) ? (!__eliscript_truthy(binding)) : __eliscript_value_45))(current))) {
284
- ((binding = ((current)["names"])["get"](name)));
285
- ((current = (current)["parent"]));
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
- return null;
288
- })();
289
- return binding;
290
- })(scope, undefined);
743
+ }
744
+ }
291
745
  }
292
746
  function require_binding(scope, node, context) {
293
- return ((name) => {
294
- return ((binding) => {
295
- return ((__eliscript_value_46) => (__eliscript_truthy(__eliscript_value_46) ? __eliscript_value_46 : analyzer_fail(context, node_span(node), (String("unbound symbol: ") + String(name)))))(binding);
296
- })(lookup_binding(scope, name));
297
- })(node_name(node));
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 ((__eliscript_value_47) => (__eliscript_truthy(__eliscript_value_47) ? __eliscript_value_47 : (name)["includes"]("/")))((name)["includes"]("."));
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
- return ((tail_position, index) => {
304
- (() => {
305
- while (__eliscript_truthy((index < (forms)["length"]))) {
306
- ((context)["tailPosition"] = ((__eliscript_value_48) => (__eliscript_truthy(__eliscript_value_48) ? (index === ((forms)["length"] - 1)) : __eliscript_value_48))(tail_position));
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
- return ((context)["tailPosition"] = tail_position);
313
- })((context)["tailPosition"], 0);
774
+ }
775
+ }
314
776
  }
315
777
  function analyze_non_tail(form, scope, context) {
316
- return ((tail_position) => {
317
- ((context)["tailPosition"] = false);
318
- analyze_expression(form, scope, context);
319
- return ((context)["tailPosition"] = tail_position);
320
- })((context)["tailPosition"]);
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
- return (__eliscript_truthy(vector_node_p(pattern)) ? (node_items(pattern))["forEach"]((element) => {
324
- return (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_49) => (__eliscript_truthy(__eliscript_value_49) ? __eliscript_value_49 : ((__eliscript_value_50) => (__eliscript_truthy(__eliscript_value_50) ? (node_name(element) === "&rest") : __eliscript_value_50))(symbol_node_p(element))))(null_node_p(element))))) ? analyze_pattern_defaults(element, scope, context) : null);
325
- }) : (__eliscript_truthy(map_node_p(pattern)) ? ((spec) => {
326
- return ((spec)["entries"])["forEach"]((entry) => {
327
- (__eliscript_truthy((entry)["hasDefault"]) ? analyze_non_tail((entry)["default"], scope, context) : null);
328
- return analyze_pattern_defaults((entry)["target"], scope, context);
329
- });
330
- })(map_binding_spec(pattern, context)) : null));
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
- return ((tail_position) => {
334
- ((context)["tailPosition"] = false);
335
- analyze_sequence(forms, scope, context);
336
- return ((context)["tailPosition"] = tail_position);
337
- })((context)["tailPosition"]);
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
- return (__eliscript_truthy(binding_pattern_p(binding)) ? (() => {
341
- binding_nodes(binding, context);
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
- })() : ((items) => {
344
- return (__eliscript_truthy(((__eliscript_value_51) => (__eliscript_truthy(__eliscript_value_51) ? ((__eliscript_value_52) => (__eliscript_truthy(__eliscript_value_52) ? ((__eliscript_value_53) => (__eliscript_truthy(__eliscript_value_53) ? binding_pattern_p(((((items) ?? [])[0]) ?? null)) : __eliscript_value_53))(((items)["length"] <= 2)) : __eliscript_value_52))(((items)["length"] >= 1)) : __eliscript_value_51))((!__eliscript_truthy((items === undefined))))) ? (() => {
345
- binding_nodes(((((items) ?? [])[0]) ?? null), context);
346
- return [((((items) ?? [])[0]) ?? null), ((((items) ?? [])[1]) ?? null)];
347
- })() : analyzer_fail(context, node_span(binding), (String("invalid let binding: ") + String(node_display(binding)))));
348
- })(list_items(binding)));
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
- (__eliscript_truthy(((args)["length"] === 0)) ? analyzer_fail(context, form_span, (String((__eliscript_truthy(sequential) ? "let*" : "let")) + String(" requires a binding list"))) : null);
352
- return ((bindings_form) => {
353
- return ((bindings) => {
354
- return ((body) => {
355
- return ((child) => {
356
- return (() => {
357
- (__eliscript_truthy((bindings === undefined)) ? analyzer_fail(context, node_span(bindings_form), "let bindings must be a list") : null);
358
- (__eliscript_truthy(sequential) ? (bindings)["forEach"]((binding) => {
359
- return ((pair) => {
360
- analyze_non_tail(((((pair) ?? [])[1]) ?? null), child, context);
361
- analyze_pattern_defaults(((((pair) ?? [])[0]) ?? null), child, context);
362
- return declare_pattern(child, ((((pair) ?? [])[0]) ?? null), "local", true, context);
363
- })(binding_pair(binding, context));
364
- }) : ((parsed) => {
365
- (parsed)["forEach"]((pair) => {
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
- return analyze_pattern_defaults(((((pair) ?? [])[0]) ?? null), scope, context);
368
- });
369
- return (parsed)["forEach"]((pair) => {
370
- return declare_pattern(child, ((((pair) ?? [])[0]) ?? null), "local", true, context);
371
- });
372
- })((bindings)["map"]((binding) => {
373
- return binding_pair(binding, context);
374
- })));
375
- return analyze_sequence(body, child, context);
376
- })();
377
- })(make_scope(scope));
378
- })((args)["slice"](1));
379
- })(list_items(bindings_form));
380
- })(((((args) ?? [])[0]) ?? null));
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
- return ((parameter_items) => {
384
- (parameter_items)["forEach"]((parameter) => {
385
- return analyze_pattern_defaults((parameter)["node"], scope, context);
386
- });
387
- return ((child) => {
388
- (parameter_items)["forEach"]((parameter) => {
389
- return ((parameter)["bindings"])["forEach"]((binding) => {
390
- return declare_binding(child, binding, "parameter", true, context);
391
- });
392
- });
393
- return ((recur_targets, tail_position, recur_barrier) => {
394
- ((context)["recurTargets"] = [({"kind": "function", "arity": (parameter_items)["length"]})]);
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
- })((context)["recurTargets"], (context)["tailPosition"], (context)["recurBarrier"]);
402
- })(make_scope(scope, (__eliscript_truthy(asynchronous) ? "async" : "sync")));
403
- })(function_parameters(parameters, context));
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
- return ((targets) => {
449
- return ((target) => {
450
- return (() => {
451
- (__eliscript_truthy((!__eliscript_truthy(target))) ? analyzer_fail(context, form_span, "recur is only valid inside a function or loop") : null);
452
- (__eliscript_truthy((context)["recurBarrier"]) ? analyzer_fail(context, form_span, "recur cannot cross a try boundary") : null);
453
- (__eliscript_truthy((!__eliscript_truthy((context)["tailPosition"]))) ? analyzer_fail(context, form_span, "recur is only valid in tail position") : null);
454
- (__eliscript_truthy((!__eliscript_truthy(((args)["length"] === (target)["arity"])))) ? analyzer_fail(context, form_span, (String("recur expects ") + String((target)["arity"]) + String(" arguments for the current ") + String((target)["kind"]) + String(", got ") + String((args)["length"]))) : null);
455
- return analyze_non_tail_sequence(args, scope, context);
456
- })();
457
- })(((__eliscript_value_55) => (__eliscript_truthy(__eliscript_value_55) ? ((((targets) ?? [])[0]) ?? null) : __eliscript_value_55))(((targets)["length"] > 0)));
458
- })((context)["recurTargets"]);
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
- (__eliscript_truthy(((__eliscript_value_56) => (__eliscript_truthy(__eliscript_value_56) ? __eliscript_value_56 : (((args)["length"] % 2) === 1)))(((args)["length"] === 0))) ? analyzer_fail(context, form_span, (String(form_name) + String(" expects one or more name/value pairs"))) : null);
462
- return ((index) => {
463
- return (() => {
464
- while (__eliscript_truthy((index < (args)["length"]))) {
465
- ((name_node) => {
466
- return ((value) => {
467
- return (() => {
468
- (__eliscript_truthy((!__eliscript_truthy(symbol_node_p(name_node)))) ? analyzer_fail(context, form_span, (String("assignment target must be a symbol: ") + String(node_display(name_node)))) : null);
469
- ((binding) => {
470
- return (__eliscript_truthy((!__eliscript_truthy((binding)["mutable"]))) ? analyzer_fail(context, node_span(name_node), (String("cannot assign to immutable binding: ") + String(node_name(name_node)))) : null);
471
- })(require_binding(scope, name_node, context));
472
- return analyze_non_tail(value, scope, context);
473
- })();
474
- })(((((args) ?? [])[(index + 1)]) ?? null));
475
- })(((((args) ?? [])[index]) ?? null));
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
- })(0);
1080
+ }
1081
+ }
481
1082
  }
482
1083
  function analyze_object(args, scope, context, form_span, form_name) {
483
- (__eliscript_truthy((((args)["length"] % 2) === 1)) ? analyzer_fail(context, form_span, (String(form_name) + String(" expects key/value pairs"))) : null);
484
- return ((index) => {
485
- return (() => {
486
- while (__eliscript_truthy((index < (args)["length"]))) {
487
- ((key, value) => {
488
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_57) => (__eliscript_truthy(__eliscript_value_57) ? __eliscript_value_57 : ((__eliscript_value_58) => (__eliscript_truthy(__eliscript_value_58) ? __eliscript_value_58 : symbol_node_p(key)))(string_node_p(key))))(keyword_node_p(key))))) ? analyze_non_tail(key, scope, context) : null);
489
- return analyze_non_tail(value, scope, context);
490
- })(((((args) ?? [])[index]) ?? null), ((((args) ?? [])[(index + 1)]) ?? null));
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
- })(0);
1107
+ }
1108
+ }
496
1109
  }
497
1110
  function analyze_property_call(operator, args, scope, context, form_span) {
498
- (__eliscript_truthy((operator === "get")) ? (__eliscript_truthy(((__eliscript_value_59) => (__eliscript_truthy(__eliscript_value_59) ? __eliscript_value_59 : ((args)["length"] > 3)))(((args)["length"] < 2))) ? analyzer_fail(context, form_span, "get expects 2..3 arguments") : null) : (__eliscript_truthy((operator === "put")) ? (__eliscript_truthy((!__eliscript_truthy(((args)["length"] === 3)))) ? analyzer_fail(context, form_span, "put expects 3 arguments") : null) : (__eliscript_truthy((operator === "js-call")) ? (__eliscript_truthy(((args)["length"] < 2)) ? analyzer_fail(context, form_span, "js-call expects 2+ arguments") : null) : null)));
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
- ((key) => {
501
- return (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_60) => (__eliscript_truthy(__eliscript_value_60) ? __eliscript_value_60 : string_node_p(key)))(keyword_node_p(key))))) ? analyze_non_tail(key, scope, context) : null);
502
- })(((((args) ?? [])[1]) ?? null));
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
- return ((items) => {
508
- (__eliscript_truthy(((__eliscript_value_61) => (__eliscript_truthy(__eliscript_value_61) ? __eliscript_value_61 : ((items)["length"] === 0)))((items === undefined))) ? analyzer_fail(context, node_span(clause), (String("invalid cond clause: ") + String(node_display(clause)))) : null);
509
- analyze_non_tail(((((items) ?? [])[0]) ?? null), scope, context);
510
- return analyze_sequence((items)["slice"](1), scope, context);
511
- })(list_items(clause));
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
- return ((items) => {
516
- return ((__eliscript_value_62) => (__eliscript_truthy(__eliscript_value_62) ? ((__eliscript_value_63) => (__eliscript_truthy(__eliscript_value_63) ? ((__eliscript_value_64) => (__eliscript_truthy(__eliscript_value_64) ? node_name(((((items) ?? [])[0]) ?? null)) : __eliscript_value_64))(symbol_node_p(((((items) ?? [])[0]) ?? null))) : __eliscript_value_63))(((items)["length"] > 0)) : __eliscript_value_62))((!__eliscript_truthy((items === undefined))));
517
- })(list_items(form));
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
- return ((recur_barrier, clauses_started, catch_seen, finally_seen) => {
521
- ((context)["recurBarrier"] = true);
522
- (args)["forEach"]((argument) => {
523
- return ((operator) => {
524
- return (__eliscript_truthy((operator === "catch")) ? (() => {
525
- (__eliscript_truthy(catch_seen) ? analyzer_fail(context, form_span, "try accepts at most one catch clause") : null);
526
- (__eliscript_truthy(finally_seen) ? analyzer_fail(context, form_span, "catch must precede finally") : null);
527
- ((clauses_started = true));
528
- ((catch_seen = true));
529
- return ((items) => {
530
- return ((binding) => {
531
- return (() => {
532
- (__eliscript_truthy((!__eliscript_truthy(binding_pattern_p(binding)))) ? analyzer_fail(context, node_span(argument), "catch requires a binding symbol, vector, or map") : null);
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
- return ((child) => {
535
- declare_pattern(child, binding, "catch", true, context);
536
- return analyze_sequence((items)["slice"](2), child, context);
537
- })(make_scope(scope));
538
- })();
539
- })(((((items) ?? [])[1]) ?? null));
540
- })(list_items(argument));
541
- })() : (__eliscript_truthy((operator === "finally")) ? (() => {
542
- (__eliscript_truthy(finally_seen) ? analyzer_fail(context, form_span, "try accepts at most one finally clause") : null);
543
- ((clauses_started = true));
544
- ((finally_seen = true));
545
- return analyze_sequence((list_items(argument))["slice"](1), scope, context);
546
- })() : (__eliscript_truthy(clauses_started) ? analyzer_fail(context, node_span(argument), "try body forms must precede catch and finally clauses") : analyze_expression(argument, scope, context))));
547
- })(clause_operator(argument));
548
- });
549
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_65) => (__eliscript_truthy(__eliscript_value_65) ? __eliscript_value_65 : finally_seen))(catch_seen)))) ? analyzer_fail(context, form_span, "try requires a catch or finally clause") : null);
550
- return ((context)["recurBarrier"] = recur_barrier);
551
- })((context)["recurBarrier"], false, false, false);
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
- return ((items) => {
555
- return ((operator_node) => {
556
- return ((operator) => {
557
- return ((args) => {
558
- return ((form_span) => {
559
- return (__eliscript_truthy(((__eliscript_value_67) => (__eliscript_truthy(__eliscript_value_67) ? __eliscript_value_67 : (operator === "fn")))((operator === "lambda"))) ? (() => {
560
- (__eliscript_truthy(((args)["length"] === 0)) ? analyzer_fail(context, form_span, (String(operator) + String(" requires an argument list"))) : null);
561
- return analyze_function(((((args) ?? [])[0]) ?? null), (args)["slice"](1), scope, context);
562
- })() : (__eliscript_truthy((operator === "async")) ? (() => {
563
- (__eliscript_truthy(((args)["length"] === 0)) ? analyzer_fail(context, form_span, "async requires an argument list") : null);
564
- return analyze_function(((((args) ?? [])[0]) ?? null), (args)["slice"](1), scope, context, true);
565
- })() : (__eliscript_truthy((operator === "await")) ? (() => {
566
- (__eliscript_truthy((!__eliscript_truthy(((args)["length"] === 1)))) ? analyzer_fail(context, form_span, "await expects 1 argument") : null);
567
- (__eliscript_truthy((!__eliscript_truthy(async_function_p(scope)))) ? analyzer_fail(context, form_span, "await is only valid inside an async function") : null);
568
- return analyze_non_tail(((((args) ?? [])[0]) ?? null), scope, context);
569
- })() : (__eliscript_truthy((operator === "throw")) ? (() => {
570
- (__eliscript_truthy((!__eliscript_truthy(((args)["length"] === 1)))) ? analyzer_fail(context, form_span, "throw expects 1 argument") : null);
571
- return analyze_non_tail(((((args) ?? [])[0]) ?? null), scope, context);
572
- })() : (__eliscript_truthy((operator === "try")) ? analyze_try(args, scope, context, form_span) : (__eliscript_truthy(((__eliscript_value_68) => (__eliscript_truthy(__eliscript_value_68) ? __eliscript_value_68 : (operator === "finally")))((operator === "catch"))) ? analyzer_fail(context, form_span, (String(operator) + String(" is only valid as a try clause"))) : (__eliscript_truthy((operator === "let")) ? analyze_let(args, scope, false, context, form_span) : (__eliscript_truthy((operator === "let*")) ? analyze_let(args, scope, true, context, form_span) : (__eliscript_truthy((operator === "loop")) ? analyze_loop(args, scope, context, form_span) : (__eliscript_truthy((operator === "recur")) ? analyze_recur(args, scope, context, form_span) : (__eliscript_truthy((operator === "setq")) ? analyze_assignment(args, scope, "setq", context, form_span) : (__eliscript_truthy((operator === "set!")) ? (() => {
573
- (__eliscript_truthy((!__eliscript_truthy(((args)["length"] === 2)))) ? analyzer_fail(context, form_span, "set! expects 2 arguments") : null);
574
- return analyze_assignment(args, scope, "set!", context, form_span);
575
- })() : (__eliscript_truthy((operator === "cond")) ? analyze_cond(args, scope, context) : (__eliscript_truthy((operator === "if")) ? (() => {
576
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_69) => (__eliscript_truthy(__eliscript_value_69) ? ((args)["length"] <= 3) : __eliscript_value_69))(((args)["length"] >= 2))))) ? analyzer_fail(context, form_span, "if expects 2..3 arguments") : null);
577
- analyze_non_tail(((((args) ?? [])[0]) ?? null), scope, context);
578
- return analyze_sequence((args)["slice"](1), scope, context);
579
- })() : (__eliscript_truthy(((__eliscript_value_70) => (__eliscript_truthy(__eliscript_value_70) ? __eliscript_value_70 : (operator === "unless")))((operator === "when"))) ? (() => {
580
- (__eliscript_truthy(((args)["length"] === 0)) ? analyzer_fail(context, form_span, (String(operator) + String(" expects 1+ arguments"))) : null);
581
- analyze_non_tail(((((args) ?? [])[0]) ?? null), scope, context);
582
- return analyze_sequence((args)["slice"](1), scope, context);
583
- })() : (__eliscript_truthy(((__eliscript_value_71) => (__eliscript_truthy(__eliscript_value_71) ? __eliscript_value_71 : ((__eliscript_value_72) => (__eliscript_truthy(__eliscript_value_72) ? __eliscript_value_72 : ((__eliscript_value_73) => (__eliscript_truthy(__eliscript_value_73) ? __eliscript_value_73 : (operator === "or")))((operator === "and"))))((operator === "do"))))((operator === "progn"))) ? analyze_sequence(args, scope, context) : (__eliscript_truthy((operator === "while")) ? (() => {
584
- (__eliscript_truthy(((args)["length"] === 0)) ? analyzer_fail(context, form_span, "while expects 1+ arguments") : null);
585
- return analyze_non_tail_sequence(args, scope, context);
586
- })() : (__eliscript_truthy((operator === "quote")) ? null : (__eliscript_truthy((operator === "js-object")) ? analyze_object(args, scope, context, form_span, operator) : (__eliscript_truthy((operator === "hash-map")) ? (() => {
587
- (__eliscript_truthy((((args)["length"] % 2) === 1)) ? analyzer_fail(context, form_span, "hash-map expects complete key/value pairs") : null);
588
- return analyze_non_tail_sequence(args, scope, context);
589
- })() : (__eliscript_truthy(((__eliscript_value_74) => (__eliscript_truthy(__eliscript_value_74) ? __eliscript_value_74 : ((__eliscript_value_75) => (__eliscript_truthy(__eliscript_value_75) ? __eliscript_value_75 : (operator === "js-call")))((operator === "put"))))((operator === "get"))) ? analyze_property_call(operator, args, scope, context, form_span) : (__eliscript_truthy((operator === "js*")) ? null : (__eliscript_truthy((builtin_operators)["includes"](operator)) ? analyze_non_tail_sequence(args, scope, context) : (__eliscript_truthy((["defun", "defn", "defportable", "defasync", "defvar", "defconst", "export", "export-default", "import", "import-portable", "module"])["includes"](operator)) ? analyzer_fail(context, form_span, (String(operator) + String(" is only valid at module top level"))) : (() => {
590
- analyze_non_tail(operator_node, scope, context);
591
- return analyze_non_tail_sequence(args, scope, context);
592
- })()))))))))))))))))))))))));
593
- })(node_span(form));
594
- })((items)["slice"](1));
595
- })(((__eliscript_value_66) => (__eliscript_truthy(__eliscript_value_66) ? node_name(operator_node) : __eliscript_value_66))(symbol_node_p(operator_node)));
596
- })(((((items) ?? [])[0]) ?? null));
597
- })(node_items(form));
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
- return (__eliscript_truthy(form) ? (__eliscript_truthy(((__eliscript_value_76) => (__eliscript_truthy(__eliscript_value_76) ? __eliscript_value_76 : ((__eliscript_value_77) => (__eliscript_truthy(__eliscript_value_77) ? __eliscript_value_77 : (node_kind(form) === "keyword")))((node_kind(form) === "undefined"))))((node_kind(form) === "literal"))) ? null : (__eliscript_truthy((node_kind(form) === "symbol")) ? ((name) => {
601
- return (__eliscript_truthy(qualified_name_p(name)) ? guarded_reference_name(name, context, node_span(form)) : require_binding(scope, form, context));
602
- })(node_name(form)) : (__eliscript_truthy((node_kind(form) === "vector")) ? analyze_non_tail_sequence(node_items(form), scope, context) : (__eliscript_truthy((node_kind(form) === "list")) ? analyze_call(form, scope, context) : analyzer_fail(context, node_span(form), (String("unsupported form: ") + String(node_display(form)))))))) : null);
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
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_78) => (__eliscript_truthy(__eliscript_value_78) ? string_node_p(((((args) ?? [])[0]) ?? null)) : __eliscript_value_78))(((args)["length"] > 0))))) ? analyzer_fail(context, form_span, "import module must be a string") : null);
606
- return ((bindings, index, default_seen, namespace_seen, named_seen) => {
607
- (() => {
608
- while (__eliscript_truthy((index < (args)["length"]))) {
609
- ((specifier) => {
610
- (__eliscript_truthy(((__eliscript_value_79) => (__eliscript_truthy(__eliscript_value_79) ? (node_name(specifier) === "default") : __eliscript_value_79))(keyword_node_p(specifier))) ? (() => {
611
- (__eliscript_truthy(portable) ? analyzer_fail(context, form_span, "import-portable only supports named imports") : null);
612
- (__eliscript_truthy(default_seen) ? analyzer_fail(context, form_span, "duplicate :default import") : null);
613
- (__eliscript_truthy(((index + 1) >= (args)["length"])) ? analyzer_fail(context, form_span, ":default requires a binding") : null);
614
- ((default_seen = true));
615
- ((index = (index + 1)));
616
- return (bindings)["push"](((((args) ?? [])[index]) ?? null));
617
- })() : (__eliscript_truthy(((__eliscript_value_80) => (__eliscript_truthy(__eliscript_value_80) ? (node_name(specifier) === "as") : __eliscript_value_80))(keyword_node_p(specifier))) ? (() => {
618
- (__eliscript_truthy(portable) ? analyzer_fail(context, form_span, "import-portable only supports named imports") : null);
619
- (__eliscript_truthy(namespace_seen) ? analyzer_fail(context, form_span, "duplicate :as import") : null);
620
- (__eliscript_truthy(((index + 1) >= (args)["length"])) ? analyzer_fail(context, form_span, ":as requires a namespace binding") : null);
621
- ((namespace_seen = true));
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
- return (bindings)["push"](((((args) ?? [])[index]) ?? null));
624
- })() : (__eliscript_truthy(symbol_node_p(specifier)) ? (() => {
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
- return null;
632
- })();
633
- (__eliscript_truthy(((__eliscript_value_81) => (__eliscript_truthy(__eliscript_value_81) ? named_seen : __eliscript_value_81))(namespace_seen)) ? analyzer_fail(context, form_span, "namespace and named imports cannot be combined") : null);
634
- (__eliscript_truthy(((__eliscript_value_82) => (__eliscript_truthy(__eliscript_value_82) ? ((bindings)["length"] === 0) : __eliscript_value_82))(portable)) ? analyzer_fail(context, form_span, "import-portable expects one or more bindings") : null);
635
- return bindings;
636
- })([], 1, false, false, false);
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
- return (__eliscript_truthy(((__eliscript_value_83) => (__eliscript_truthy(__eliscript_value_83) ? ((__eliscript_value_84) => (__eliscript_truthy(__eliscript_value_84) ? (node_name(((((node_items(form)) ?? [])[0]) ?? null)) === "module") : __eliscript_value_84))(symbol_node_p(((((node_items(form)) ?? [])[0]) ?? null))) : __eliscript_value_83))((node_kind(form) === "list"))) ? ((items) => {
641
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_85) => (__eliscript_truthy(__eliscript_value_85) ? symbol_node_p(((((items) ?? [])[1]) ?? null)) : __eliscript_value_85))(((items)["length"] > 1))))) ? analyzer_fail(context, node_span(form), "module name must be a symbol") : null);
642
- return append_flattened_modules((items)["slice"](2), result, context);
643
- })(node_items(form)) : (result)["push"](form));
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
- return ((result) => {
648
- append_flattened_modules(forms, result, context);
649
- return result;
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
- return (__eliscript_truthy((node_kind(form) === "list")) ? ((items) => {
655
- return ((operator_node) => {
656
- return ((operator) => {
657
- return ((args) => {
658
- return ((count) => {
659
- return (__eliscript_truthy(((__eliscript_value_87) => (__eliscript_truthy(__eliscript_value_87) ? __eliscript_value_87 : (operator === "import-portable")))((operator === "import"))) ? (() => {
660
- (__eliscript_truthy((count === 0)) ? analyzer_fail(context, node_span(form), (String(operator) + String(" expects a module name"))) : null);
661
- return (import_bindings(args, context, node_span(form), (operator === "import-portable")))["forEach"]((name) => {
662
- return declare_binding(scope, name, "import", false, context);
663
- });
664
- })() : (__eliscript_truthy((operator === "defvar")) ? (() => {
665
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_88) => (__eliscript_truthy(__eliscript_value_88) ? (count <= 2) : __eliscript_value_88))((count >= 1))))) ? analyzer_fail(context, node_span(form), "defvar expects 1..2 arguments") : null);
666
- return declare_binding(scope, ((((args) ?? [])[0]) ?? null), "variable", true, context);
667
- })() : (__eliscript_truthy((operator === "defconst")) ? (() => {
668
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_89) => (__eliscript_truthy(__eliscript_value_89) ? (count <= 2) : __eliscript_value_89))((count >= 1))))) ? analyzer_fail(context, node_span(form), "defconst expects 1..2 arguments") : null);
669
- return declare_binding(scope, ((((args) ?? [])[0]) ?? null), "constant", false, context);
670
- })() : (__eliscript_truthy(((__eliscript_value_90) => (__eliscript_truthy(__eliscript_value_90) ? __eliscript_value_90 : ((__eliscript_value_91) => (__eliscript_truthy(__eliscript_value_91) ? __eliscript_value_91 : ((__eliscript_value_92) => (__eliscript_truthy(__eliscript_value_92) ? __eliscript_value_92 : (operator === "defasync")))((operator === "defportable"))))((operator === "defn"))))((operator === "defun"))) ? (() => {
671
- (__eliscript_truthy((!__eliscript_truthy((count >= 2)))) ? analyzer_fail(context, node_span(form), (String(operator) + String(" expects 2+ arguments"))) : null);
672
- return declare_binding(scope, ((((args) ?? [])[0]) ?? null), "function", false, context);
673
- })() : null))));
674
- })((args)["length"]);
675
- })((items)["slice"](1));
676
- })(((__eliscript_value_86) => (__eliscript_truthy(__eliscript_value_86) ? node_name(operator_node) : __eliscript_value_86))(symbol_node_p(operator_node)));
677
- })(((((items) ?? [])[0]) ?? null));
678
- })(node_items(form)) : null);
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
- return (__eliscript_truthy((!__eliscript_truthy((node_kind(form) === "list")))) ? analyze_expression(form, scope, context) : ((items) => {
683
- return ((operator_node) => {
684
- return ((operator) => {
685
- return ((args) => {
686
- return ((count) => {
687
- return (__eliscript_truthy(((__eliscript_value_94) => (__eliscript_truthy(__eliscript_value_94) ? __eliscript_value_94 : (operator === "import-portable")))((operator === "import"))) ? null : (__eliscript_truthy(((__eliscript_value_95) => (__eliscript_truthy(__eliscript_value_95) ? __eliscript_value_95 : (operator === "defconst")))((operator === "defvar"))) ? (() => {
688
- (__eliscript_truthy((count > 2)) ? analyzer_fail(context, node_span(form), (String(operator) + String(" expects 1..2 arguments"))) : null);
689
- return analyze_expression(((((args) ?? [])[1]) ?? null), scope, context);
690
- })() : (__eliscript_truthy(((__eliscript_value_96) => (__eliscript_truthy(__eliscript_value_96) ? __eliscript_value_96 : ((__eliscript_value_97) => (__eliscript_truthy(__eliscript_value_97) ? __eliscript_value_97 : ((__eliscript_value_98) => (__eliscript_truthy(__eliscript_value_98) ? __eliscript_value_98 : (operator === "defasync")))((operator === "defportable"))))((operator === "defn"))))((operator === "defun"))) ? (() => {
691
- (__eliscript_truthy((!__eliscript_truthy((count >= 2)))) ? analyzer_fail(context, node_span(form), (String(operator) + String(" expects 2+ arguments"))) : null);
692
- return analyze_function(((((args) ?? [])[1]) ?? null), (args)["slice"](2), scope, context, (operator === "defasync"));
693
- })() : (__eliscript_truthy((operator === "export")) ? (() => {
694
- (__eliscript_truthy((count === 0)) ? analyzer_fail(context, node_span(form), "export expects one or more bindings") : null);
695
- return (args)["forEach"]((name) => {
696
- (__eliscript_truthy((!__eliscript_truthy(symbol_node_p(name)))) ? analyzer_fail(context, node_span(name), (String("export name must be a symbol: ") + String(node_display(name)))) : null);
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
- })() : (__eliscript_truthy((operator === "export-default")) ? (() => {
700
- (__eliscript_truthy((!__eliscript_truthy((count === 1)))) ? analyzer_fail(context, node_span(form), "export-default expects 1 argument") : null);
701
- return analyze_expression(((((args) ?? [])[0]) ?? null), scope, context);
702
- })() : analyze_expression(form, scope, context))))));
703
- })((args)["length"]);
704
- })((items)["slice"](1));
705
- })(((__eliscript_value_93) => (__eliscript_truthy(__eliscript_value_93) ? node_name(operator_node) : __eliscript_value_93))(symbol_node_p(operator_node)));
706
- })(((((items) ?? [])[0]) ?? null));
707
- })(node_items(form)));
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
- return ((declarations) => {
711
- (forms)["forEach"]((form) => {
712
- return (__eliscript_truthy((node_kind(form) === "list")) ? ((items) => {
713
- return ((operator_node) => {
714
- return ((operator) => {
715
- return ((args) => {
716
- return (__eliscript_truthy((operator === "defconst")) ? (declarations)["set"](node_name(((((args) ?? [])[0]) ?? null)), ({"kind": "constant", "form": form, "initializer": ((((args) ?? [])[1]) ?? null)})) : (__eliscript_truthy((operator === "defvar")) ? (declarations)["set"](node_name(((((args) ?? [])[0]) ?? null)), ({"kind": "variable", "form": form})) : (__eliscript_truthy(((__eliscript_value_100) => (__eliscript_truthy(__eliscript_value_100) ? __eliscript_value_100 : ((__eliscript_value_101) => (__eliscript_truthy(__eliscript_value_101) ? __eliscript_value_101 : ((__eliscript_value_102) => (__eliscript_truthy(__eliscript_value_102) ? __eliscript_value_102 : (operator === "defasync")))((operator === "defportable"))))((operator === "defn"))))((operator === "defun"))) ? (declarations)["set"](node_name(((((args) ?? [])[0]) ?? null)), ({"kind": (__eliscript_truthy((operator === "defportable")) ? "portable" : "function"), "form": form, "parameters": ((((args) ?? [])[1]) ?? null), "body": (args)["slice"](2)})) : (__eliscript_truthy(((__eliscript_value_103) => (__eliscript_truthy(__eliscript_value_103) ? __eliscript_value_103 : (operator === "import-portable")))((operator === "import"))) ? (import_bindings(args, context, node_span(form), (operator === "import-portable")))["forEach"]((name) => {
717
- return (declarations)["set"](node_name(name), ({"kind": (__eliscript_truthy((operator === "import-portable")) ? "portable-import" : "import"), "form": form}));
718
- }) : null))));
719
- })((items)["slice"](1));
720
- })(((__eliscript_value_99) => (__eliscript_truthy(__eliscript_value_99) ? node_name(operator_node) : __eliscript_value_99))(symbol_node_p(operator_node)));
721
- })(((((items) ?? [])[0]) ?? null));
722
- })(node_items(form)) : null);
723
- });
724
- return declarations;
725
- })(new Map());
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
- return ((scope) => {
729
- (__eliscript_truthy(parameters) ? (function_parameters(parameters, context))["forEach"]((parameter) => {
730
- return ((parameter)["bindings"])["forEach"]((binding) => {
731
- return (scope)["add"](node_name(binding));
732
- });
733
- }) : null);
734
- return scope;
735
- })(new Set());
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
- return ((name) => {
747
- return (__eliscript_truthy((!__eliscript_truthy((scope)["has"](name)))) ? (() => {
748
- (__eliscript_truthy(qualified_name_p(name)) ? portable_fail(context, node_span(node), (String("portable function ") + String(entry) + String(" uses qualified host reference: ") + String(name))) : null);
749
- return ((declaration) => {
750
- return (__eliscript_truthy(declaration) ? ((kind) => {
751
- return (__eliscript_truthy(((__eliscript_value_104) => (__eliscript_truthy(__eliscript_value_104) ? __eliscript_value_104 : ((__eliscript_value_105) => (__eliscript_truthy(__eliscript_value_105) ? __eliscript_value_105 : (kind === "portable-import")))((kind === "constant"))))((kind === "portable"))) ? (dependencies)["add"](name) : portable_fail(context, node_span(node), (String("portable function ") + String(entry) + String(" depends on non-portable ") + String(kind) + String(": ") + String(name))));
752
- })((declaration)["kind"]) : null);
753
- })((declarations)["get"](name));
754
- })() : null);
755
- })(node_name(node));
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
- return ((child) => {
764
- (function_parameters(((((args) ?? [])[0]) ?? null), context))["forEach"]((parameter) => {
765
- return ((parameter)["bindings"])["forEach"]((binding) => {
766
- return (child)["add"](node_name(binding));
767
- });
768
- });
769
- return portable_sequence((args)["slice"](1), child, declarations, dependencies, entry, context);
770
- })(copy_portable_scope(scope));
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
- return ((bindings, child) => {
774
- (__eliscript_truthy(sequential) ? (bindings)["forEach"]((binding) => {
775
- return ((items) => {
776
- return ((name) => {
777
- return ((initializer) => {
778
- return (() => {
779
- portable_expression(initializer, child, declarations, dependencies, entry, context);
780
- return add_portable_pattern(name, child, context);
781
- })();
782
- })(((__eliscript_value_106) => (__eliscript_truthy(__eliscript_value_106) ? ((((items) ?? [])[1]) ?? null) : __eliscript_value_106))(items));
783
- })((__eliscript_truthy(items) ? ((((items) ?? [])[0]) ?? null) : binding));
784
- })(list_items(binding));
785
- }) : (() => {
786
- (bindings)["forEach"]((binding) => {
787
- return ((items) => {
788
- return (__eliscript_truthy(items) ? portable_expression(((((items) ?? [])[1]) ?? null), scope, declarations, dependencies, entry, context) : null);
789
- })(list_items(binding));
790
- });
791
- return (bindings)["forEach"]((binding) => {
792
- return ((items) => {
793
- return add_portable_pattern((__eliscript_truthy(items) ? ((((items) ?? [])[0]) ?? null) : binding), child, context);
794
- })(list_items(binding));
795
- });
796
- })());
797
- return portable_sequence((args)["slice"](1), child, declarations, dependencies, entry, context);
798
- })(list_items(((((args) ?? [])[0]) ?? null)), copy_portable_scope(scope));
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
- return ((bindings, child) => {
802
- (bindings)["forEach"]((binding) => {
803
- return ((items) => {
804
- return portable_expression(((((items) ?? [])[1]) ?? null), scope, declarations, dependencies, entry, context);
805
- })(list_items(binding));
806
- });
807
- (bindings)["forEach"]((binding) => {
808
- return add_portable_pattern(((((list_items(binding)) ?? [])[0]) ?? null), child, context);
809
- });
810
- return portable_sequence((args)["slice"](1), child, declarations, dependencies, entry, context);
811
- })(list_items(((((args) ?? [])[0]) ?? null)), copy_portable_scope(scope));
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
- return ((index) => {
815
- return (() => {
816
- while (__eliscript_truthy((index < (args)["length"]))) {
817
- ((name, value) => {
818
- (__eliscript_truthy((!__eliscript_truthy((scope)["has"](node_name(name))))) ? portable_fail(context, node_span(name), (String("portable function ") + String(entry) + String(" may only assign local bindings: ") + String(node_name(name)))) : null);
819
- return portable_expression(value, scope, declarations, dependencies, entry, context);
820
- })(((((args) ?? [])[index]) ?? null), ((((args) ?? [])[(index + 1)]) ?? null));
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
- })(0);
1825
+ }
1826
+ }
826
1827
  }
827
1828
  function portable_object(args, scope, declarations, dependencies, entry, context) {
828
- return ((index) => {
829
- return (() => {
830
- while (__eliscript_truthy((index < (args)["length"]))) {
831
- ((key, value) => {
832
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_107) => (__eliscript_truthy(__eliscript_value_107) ? __eliscript_value_107 : ((__eliscript_value_108) => (__eliscript_truthy(__eliscript_value_108) ? __eliscript_value_108 : symbol_node_p(key)))(string_node_p(key))))(keyword_node_p(key))))) ? portable_expression(key, scope, declarations, dependencies, entry, context) : null);
833
- return portable_expression(value, scope, declarations, dependencies, entry, context);
834
- })(((((args) ?? [])[index]) ?? null), ((((args) ?? [])[(index + 1)]) ?? null));
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
- })(0);
1849
+ }
1850
+ }
840
1851
  }
841
1852
  function portable_host_key_call(args, scope, declarations, dependencies, entry, context) {
842
- return ((index) => {
843
- return (() => {
844
- while (__eliscript_truthy((index < (args)["length"]))) {
845
- ((argument) => {
846
- return (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_109) => (__eliscript_truthy(__eliscript_value_109) ? keyword_node_p(argument) : __eliscript_value_109))((index === 1))))) ? portable_expression(argument, scope, declarations, dependencies, entry, context) : null);
847
- })(((((args) ?? [])[index]) ?? null));
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
- })(0);
1870
+ }
1871
+ }
853
1872
  }
854
1873
  function portable_call(form, scope, declarations, dependencies, entry, context) {
855
- return ((items) => {
856
- return ((operator_node) => {
857
- return ((operator) => {
858
- return ((args) => {
859
- return (() => {
860
- (__eliscript_truthy((portable_forbidden_operators)["includes"](operator)) ? portable_fail(context, node_span(form), (String("portable function ") + String(entry) + String(" cannot use ") + String(operator) + String(" (") + String((__eliscript_truthy((operator === "js*")) ? "raw JavaScript" : (__eliscript_truthy((operator === "print")) ? "console output" : (__eliscript_truthy((operator === "put")) ? "object mutation" : (__eliscript_truthy((operator === "js-call")) ? "host method calls" : (__eliscript_truthy((operator === "new")) ? "host constructors" : (__eliscript_truthy((operator === "async")) ? "asynchronous functions" : (__eliscript_truthy((operator === "await")) ? "asynchronous suspension" : (__eliscript_truthy(((__eliscript_value_111) => (__eliscript_truthy(__eliscript_value_111) ? __eliscript_value_111 : (operator === "try")))((operator === "throw"))) ? "exception control flow" : "unsupported host capability"))))))))) + String(")"))) : null);
861
- return (__eliscript_truthy((operator === "quote")) ? null : (__eliscript_truthy(((__eliscript_value_112) => (__eliscript_truthy(__eliscript_value_112) ? __eliscript_value_112 : (operator === "fn")))((operator === "lambda"))) ? portable_function_expression(args, scope, declarations, dependencies, entry, context) : (__eliscript_truthy((operator === "let")) ? portable_let_expression(args, scope, false, declarations, dependencies, entry, context) : (__eliscript_truthy((operator === "let*")) ? portable_let_expression(args, scope, true, declarations, dependencies, entry, context) : (__eliscript_truthy((operator === "loop")) ? portable_loop_expression(args, scope, declarations, dependencies, entry, context) : (__eliscript_truthy(((__eliscript_value_113) => (__eliscript_truthy(__eliscript_value_113) ? __eliscript_value_113 : (operator === "set!")))((operator === "setq"))) ? portable_assignment(args, scope, declarations, dependencies, entry, context) : (__eliscript_truthy((operator === "js-object")) ? portable_object(args, scope, declarations, dependencies, entry, context) : (__eliscript_truthy(((__eliscript_value_114) => (__eliscript_truthy(__eliscript_value_114) ? __eliscript_value_114 : ((__eliscript_value_115) => (__eliscript_truthy(__eliscript_value_115) ? __eliscript_value_115 : ((__eliscript_value_116) => (__eliscript_truthy(__eliscript_value_116) ? __eliscript_value_116 : (operator === "object-assoc")))((operator === "object-has?"))))((operator === "aref"))))((operator === "get"))) ? portable_host_key_call(args, scope, declarations, dependencies, entry, context) : (() => {
862
- (__eliscript_truthy((!__eliscript_truthy((builtin_operators)["includes"](operator)))) ? portable_expression(operator_node, scope, declarations, dependencies, entry, context) : null);
863
- return portable_sequence(args, scope, declarations, dependencies, entry, context);
864
- })()))))))));
865
- })();
866
- })((items)["slice"](1));
867
- })(((__eliscript_value_110) => (__eliscript_truthy(__eliscript_value_110) ? node_name(operator_node) : __eliscript_value_110))(symbol_node_p(operator_node)));
868
- })(((((items) ?? [])[0]) ?? null));
869
- })(node_items(form));
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
- return (__eliscript_truthy(form) ? (__eliscript_truthy(((__eliscript_value_117) => (__eliscript_truthy(__eliscript_value_117) ? __eliscript_value_117 : (node_kind(form) === "undefined")))((node_kind(form) === "literal"))) ? null : (__eliscript_truthy((node_kind(form) === "keyword")) ? null : (__eliscript_truthy((node_kind(form) === "symbol")) ? portable_reference(form, scope, declarations, dependencies, entry, context) : (__eliscript_truthy((node_kind(form) === "vector")) ? portable_sequence(node_items(form), scope, declarations, dependencies, entry, context) : (__eliscript_truthy((node_kind(form) === "list")) ? portable_call(form, scope, declarations, dependencies, entry, context) : null))))) : null);
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
- return ((dependencies, scope) => {
876
- (__eliscript_truthy(((declaration)["kind"] === "portable")) ? portable_sequence((declaration)["body"], scope, declarations, dependencies, entry, context) : portable_expression((declaration)["initializer"], scope, declarations, dependencies, entry, context));
877
- return dependencies;
878
- })(new Set(), portable_scope((declaration)["parameters"], context));
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
- return ((declarations, pending, visited) => {
882
- (declarations)["forEach"]((declaration, name) => {
883
- return (__eliscript_truthy(((declaration)["kind"] === "portable")) ? (pending)["push"](name) : null);
884
- });
885
- (() => {
886
- while (__eliscript_truthy(((pending)["length"] > 0))) {
887
- ((name) => {
888
- return (__eliscript_truthy((!__eliscript_truthy((visited)["has"](name)))) ? (() => {
889
- (visited)["add"](name);
890
- return ((declaration) => {
891
- return (portable_dependencies(declaration, declarations, name, context))["forEach"]((dependency) => {
892
- return (pending)["push"](dependency);
893
- });
894
- })((declarations)["get"](name));
895
- })() : null);
896
- })((pending)["pop"]());
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 null;
899
- })();
900
- return forms;
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
- return ((context) => {
905
- return ((flattened) => {
906
- return ((declarations) => {
907
- return ((pending) => {
908
- return ((selected) => {
909
- return (() => {
910
- (entries)["forEach"]((entry) => {
911
- return ((declaration) => {
912
- (__eliscript_truthy((!__eliscript_truthy(((__eliscript_value_118) => (__eliscript_truthy(__eliscript_value_118) ? ((declaration)["kind"] === "portable") : __eliscript_value_118))(declaration)))) ? portable_fail(context, null, (String("portable entry ") + String(entry) + String(" is not declared with defportable"))) : null);
913
- return (pending)["push"](entry);
914
- })((declarations)["get"](entry));
915
- });
916
- (() => {
917
- while (__eliscript_truthy(((pending)["length"] > 0))) {
918
- ((name) => {
919
- return (__eliscript_truthy((!__eliscript_truthy((selected)["has"](name)))) ? (() => {
920
- (selected)["add"](name);
921
- return ((declaration) => {
922
- (__eliscript_truthy(((__eliscript_value_119) => (__eliscript_truthy(__eliscript_value_119) ? (!__eliscript_truthy(allow_project_imports)) : __eliscript_value_119))(((declaration)["kind"] === "portable-import"))) ? portable_fail(context, node_span((declaration)["form"]), (String("portable import ") + String(name) + String(" requires a project build"))) : null);
923
- return (portable_dependencies(declaration, declarations, name, context))["forEach"]((dependency) => {
924
- return (pending)["push"](dependency);
925
- });
926
- })((declarations)["get"](name));
927
- })() : null);
928
- })((pending)["pop"]());
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
- return null;
931
- })();
932
- return (flattened)["filter"]((form) => {
933
- return (__eliscript_truthy((node_kind(form) === "list")) ? ((items) => {
934
- return ((operator) => {
935
- return ((name) => {
936
- return ((__eliscript_value_123) => (__eliscript_truthy(__eliscript_value_123) ? __eliscript_value_123 : ((__eliscript_value_126) => (__eliscript_truthy(__eliscript_value_126) ? ((items)["slice"](2))["some"]((imported) => {
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
- return ((context) => {
952
- return ((flattened) => {
953
- return ((scope) => {
954
- return (() => {
955
- predeclare_top_level(flattened, scope, context);
956
- (flattened)["forEach"]((form) => {
957
- return analyze_top_level(form, scope, context);
958
- });
959
- analyze_transients(forms, filename);
960
- validate_portable_module(flattened, context);
961
- return forms;
962
- })();
963
- })(make_scope(null));
964
- })(flatten_modules(forms, context));
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