eliscript 0.1.3 → 0.1.4

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 (526) hide show
  1. package/COPYING.RUNTIME +93 -0
  2. package/README.md +15 -3
  3. package/bin/eliscript-test +29 -0
  4. package/bootstrap/backends/README.md +5 -4
  5. package/bootstrap/backends/binary.eli +89 -22
  6. package/bootstrap/backends/capabilities.eli +9 -4
  7. package/bootstrap/backends/managed-layout.eli +93 -81
  8. package/bootstrap/backends/managed.eli +651 -125
  9. package/bootstrap/backends/native.eli +1791 -324
  10. package/bootstrap/backends/numeric.eli +71 -7
  11. package/bootstrap/backends/sha256.eli +165 -68
  12. package/bootstrap/backends/wasm.eli +461 -52
  13. package/bootstrap/compiler/analyzer.eli +692 -2
  14. package/bootstrap/compiler/compiler.eli +16 -3
  15. package/bootstrap/compiler/emitter.eli +80 -35
  16. package/bootstrap/compiler/project.eli +175 -1
  17. package/bootstrap/compiler/transient-analysis.eli +2 -2
  18. package/bootstrap/host/build.eli +1 -0
  19. package/bootstrap/host/build.mjs +1 -1
  20. package/bootstrap/host/build.mjs.map +1 -1
  21. package/bootstrap/host/bun.mjs +7 -9
  22. package/bootstrap/host/bun.mjs.map +1 -1
  23. package/bootstrap/host/check-cli-ground.eli +47 -5
  24. package/bootstrap/host/check-cli-ground.mjs +60 -19
  25. package/bootstrap/host/check-cli-ground.mjs.map +1 -1
  26. package/bootstrap/host/check-cli.mjs +41 -1
  27. package/bootstrap/host/check-cli.mjs.map +1 -1
  28. package/bootstrap/host/compiler-session.eli +136 -22
  29. package/bootstrap/host/eliscript-cli.mjs +1 -1
  30. package/bootstrap/host/eliscript-cli.mjs.map +1 -1
  31. package/bootstrap/host/evaluation-cli.eli +33 -1
  32. package/bootstrap/host/evaluation-cli.mjs +65 -28
  33. package/bootstrap/host/evaluation-cli.mjs.map +1 -1
  34. package/bootstrap/host/evaluation.eli +651 -42
  35. package/bootstrap/host/evaluation.mjs +884 -72
  36. package/bootstrap/host/evaluation.mjs.map +1 -1
  37. package/bootstrap/host/project-cli-ground.eli +6 -1
  38. package/bootstrap/host/project-cli-ground.mjs +33 -32
  39. package/bootstrap/host/project-cli-ground.mjs.map +1 -1
  40. package/bootstrap/host/project-cli.mjs +1 -1
  41. package/bootstrap/host/project-cli.mjs.map +1 -1
  42. package/bootstrap/host/project-ground.eli +266 -45
  43. package/bootstrap/host/project-ground.mjs +429 -159
  44. package/bootstrap/host/project-ground.mjs.map +1 -1
  45. package/bootstrap/host/project.mjs +30 -40
  46. package/bootstrap/host/project.mjs.map +1 -1
  47. package/bootstrap/host/test-cli.eli +379 -0
  48. package/bootstrap/host/test-cli.mjs +494 -0
  49. package/bootstrap/host/test-cli.mjs.map +1 -0
  50. package/browser/README.md +7 -0
  51. package/browser/host.mjs +21 -29
  52. package/browser/host.mjs.map +1 -1
  53. package/browser/worker.mjs +7 -9
  54. package/browser/worker.mjs.map +1 -1
  55. package/compiler/eliscript-analyzer.el +694 -0
  56. package/compiler/eliscript-cli.el +66 -22
  57. package/compiler/eliscript-emitter.el +67 -43
  58. package/compiler/eliscript-ir-emitter.el +71 -36
  59. package/compiler/eliscript-project.el +360 -80
  60. package/compiler/eliscript-transient-analysis.el +5 -5
  61. package/compiler/eliscript.el +6 -0
  62. package/dist/backends/binary.mjs +148 -26
  63. package/dist/backends/binary.mjs.map +1 -1
  64. package/dist/backends/capabilities.mjs +11 -4
  65. package/dist/backends/capabilities.mjs.map +1 -1
  66. package/dist/backends/elf.mjs +4 -4
  67. package/dist/backends/elf.mjs.map +1 -1
  68. package/dist/backends/managed-layout.mjs +53 -56
  69. package/dist/backends/managed-layout.mjs.map +1 -1
  70. package/dist/backends/managed.mjs +1116 -375
  71. package/dist/backends/managed.mjs.map +1 -1
  72. package/dist/backends/memory.mjs +24 -26
  73. package/dist/backends/memory.mjs.map +1 -1
  74. package/dist/backends/native.mjs +2529 -434
  75. package/dist/backends/native.mjs.map +1 -1
  76. package/dist/backends/numeric.mjs +140 -33
  77. package/dist/backends/numeric.mjs.map +1 -1
  78. package/dist/backends/optimize.mjs +2 -2
  79. package/dist/backends/optimize.mjs.map +1 -1
  80. package/dist/backends/regexp.mjs +33 -35
  81. package/dist/backends/regexp.mjs.map +1 -1
  82. package/dist/backends/sha256.mjs +159 -59
  83. package/dist/backends/sha256.mjs.map +1 -1
  84. package/dist/backends/wasm.mjs +609 -73
  85. package/dist/backends/wasm.mjs.map +1 -1
  86. package/dist/bootstrap/analyzer.mjs +1018 -2
  87. package/dist/bootstrap/analyzer.mjs.map +1 -1
  88. package/dist/bootstrap/compiler.mjs +30 -23
  89. package/dist/bootstrap/compiler.mjs.map +1 -1
  90. package/dist/bootstrap/emitter.mjs +206 -161
  91. package/dist/bootstrap/emitter.mjs.macro-origins.json +16 -16
  92. package/dist/bootstrap/emitter.mjs.map +1 -1
  93. package/dist/bootstrap/expander.mjs +27 -31
  94. package/dist/bootstrap/expander.mjs.map +1 -1
  95. package/dist/bootstrap/ir.mjs +22 -24
  96. package/dist/bootstrap/ir.mjs.map +1 -1
  97. package/dist/bootstrap/project.mjs +246 -1
  98. package/dist/bootstrap/project.mjs.map +1 -1
  99. package/dist/bootstrap/reader.mjs +2 -2
  100. package/dist/bootstrap/reader.mjs.map +1 -1
  101. package/dist/bootstrap/source-map.mjs +34 -48
  102. package/dist/bootstrap/source-map.mjs.map +1 -1
  103. package/dist/bootstrap/transient-analysis.mjs +2 -2
  104. package/dist/bootstrap/transient-analysis.mjs.map +1 -1
  105. package/dist/browser/compiler.js +106 -106
  106. package/dist/browser/host.mjs +21 -29
  107. package/dist/browser/loader.js +1 -1
  108. package/dist/browser/worker.mjs +95 -95
  109. package/dist/compiler-artifact.json +1 -1
  110. package/dist/host/compiler-session.mjs +405 -228
  111. package/dist/host/compiler-session.mjs.map +1 -1
  112. package/dist/host/compiler-tools.mjs +44 -46
  113. package/dist/host/compiler-tools.mjs.map +1 -1
  114. package/dist/literal-sources/runtime/core/array-map.eli +45 -0
  115. package/dist/literal-sources/runtime/core/collection-internals.eli +22 -2
  116. package/dist/literal-sources/runtime/core/collection.eli +282 -23
  117. package/dist/literal-sources/runtime/core/data-text.eli +196 -13
  118. package/dist/literal-sources/runtime/core/data.eli +1 -1
  119. package/dist/literal-sources/runtime/core/identifier.eli +1 -1
  120. package/dist/literal-sources/runtime/core/lazy-sequence.eli +822 -44
  121. package/dist/literal-sources/runtime/core/list.eli +1 -1
  122. package/dist/literal-sources/runtime/core/map.eli +1 -1
  123. package/dist/literal-sources/runtime/core/metadata-internals.eli +2 -2
  124. package/dist/literal-sources/runtime/core/metadata.eli +2 -2
  125. package/dist/literal-sources/{stdlib/core/object.eli → runtime/core/object-impl.eli} +6 -6
  126. package/dist/literal-sources/runtime/core/object.eli +1 -1
  127. package/dist/literal-sources/runtime/core/order.eli +3 -3
  128. package/dist/literal-sources/runtime/core/persistent-kind.eli +1 -1
  129. package/dist/literal-sources/{stdlib/core/protocol.eli → runtime/core/protocol-impl.eli} +2 -2
  130. package/dist/literal-sources/runtime/core/protocol.eli +5 -3
  131. package/dist/literal-sources/runtime/core/queue.eli +1 -1
  132. package/dist/literal-sources/runtime/core/record.eli +3 -3
  133. package/dist/literal-sources/runtime/core/regex.eli +2 -2
  134. package/dist/literal-sources/runtime/core/sequence.eli +1 -1
  135. package/dist/literal-sources/runtime/core/set-algebra.eli +1 -1
  136. package/dist/literal-sources/runtime/core/set.eli +1 -1
  137. package/dist/literal-sources/runtime/core/sorted.eli +4 -4
  138. package/dist/literal-sources/{stdlib/core/text.eli → runtime/core/text-impl.eli} +2 -2
  139. package/dist/literal-sources/runtime/core/text.eli +1 -1
  140. package/dist/literal-sources/runtime/core/transducer.eli +24 -2
  141. package/dist/literal-sources/runtime/core/transient.eli +7 -5
  142. package/dist/literal-sources/runtime/core/type.eli +1 -1
  143. package/dist/literal-sources/runtime/core/value-internals.eli +3 -3
  144. package/dist/literal-sources/runtime/core/value.eli +2 -2
  145. package/dist/literal-sources/runtime/core/vector.eli +5 -2
  146. package/dist/literal-sources/{stdlib → runtime/managed}/managed-literal-protocols.eli +100 -34
  147. package/dist/literal-sources/{stdlib → runtime/managed}/managed-literals.eli +406 -81
  148. package/{stdlib → dist/literal-sources/runtime/managed}/managed-queue-state.eli +1 -1
  149. package/{stdlib → dist/literal-sources/runtime/managed}/managed-sorted-state.eli +1 -1
  150. package/dist/literal-sources/runtime/managed/managed-transient-state.eli +1206 -0
  151. package/{stdlib → dist/literal-sources/runtime/managed}/managed-value-state.eli +30 -6
  152. package/dist/literal-sources/{stdlib → runtime/managed}/managed-vector-view-state.eli +1 -1
  153. package/dist/literal-sources/runtime/wire/http-rpc.eli +1 -1
  154. package/dist/literal-sources/runtime/wire/markdown.eli +1 -1
  155. package/dist/literal-sources/runtime/wire/schema.eli +1 -1
  156. package/dist/literal-sources/stdlib/bit.eli +89 -1
  157. package/dist/literal-sources/stdlib/data.eli +522 -0
  158. package/dist/literal-sources/stdlib/interop/object.eli +39 -0
  159. package/dist/literal-sources/stdlib/persistent-list.eli +60 -21
  160. package/dist/literal-sources/stdlib/persistent-map.eli +335 -324
  161. package/dist/literal-sources/stdlib/persistent-set.eli +8 -6
  162. package/dist/literal-sources/stdlib/persistent-vector.eli +18 -18
  163. package/dist/literal-sources/stdlib/protocol.eli +63 -0
  164. package/{stdlib/core → dist/literal-sources/stdlib}/set.eli +8 -8
  165. package/dist/literal-sources/stdlib/string.eli +362 -0
  166. package/dist/runtime/lisp/async-runtime.mjs +55 -59
  167. package/dist/runtime/lisp/async-runtime.mjs.map +1 -1
  168. package/dist/runtime/lisp/builtins.mjs +232 -280
  169. package/dist/runtime/lisp/builtins.mjs.map +1 -1
  170. package/dist/runtime/lisp/cli.mjs +159 -167
  171. package/dist/runtime/lisp/cli.mjs.map +1 -1
  172. package/dist/runtime/lisp/compiler.mjs +359 -419
  173. package/dist/runtime/lisp/compiler.mjs.map +1 -1
  174. package/dist/runtime/lisp/core.mjs +24 -24
  175. package/dist/runtime/lisp/core.mjs.map +1 -1
  176. package/dist/runtime/lisp/evaluator.mjs +315 -385
  177. package/dist/runtime/lisp/evaluator.mjs.map +1 -1
  178. package/dist/runtime/lisp/extensions.mjs +85 -103
  179. package/dist/runtime/lisp/extensions.mjs.map +1 -1
  180. package/dist/runtime/lisp/host-io.mjs +106 -122
  181. package/dist/runtime/lisp/host-io.mjs.map +1 -1
  182. package/dist/runtime/lisp/io-worker.mjs +117 -135
  183. package/dist/runtime/lisp/io-worker.mjs.map +1 -1
  184. package/dist/runtime/lisp/keymap.mjs +5 -5
  185. package/dist/runtime/lisp/keymap.mjs.map +1 -1
  186. package/dist/runtime/lisp/macros-forms.mjs +49 -51
  187. package/dist/runtime/lisp/macros-forms.mjs.map +1 -1
  188. package/dist/runtime/lisp/reader-format.mjs +31 -31
  189. package/dist/runtime/lisp/reader-format.mjs.map +1 -1
  190. package/dist/runtime/lisp/regexp-buffer.mjs +9 -9
  191. package/dist/runtime/lisp/regexp-buffer.mjs.map +1 -1
  192. package/dist/runtime/math.mjs +32 -38
  193. package/dist/runtime/math.mjs.map +1 -1
  194. package/dist/runtime/number-radix.mjs +5 -7
  195. package/dist/runtime/number-radix.mjs.map +1 -1
  196. package/dist/runtime/primitives.mjs +81 -46
  197. package/dist/runtime/primitives.mjs.macro-origins.json +294 -44
  198. package/dist/runtime/primitives.mjs.map +1 -1
  199. package/dist/runtime/unicode-case.mjs +6 -6
  200. package/dist/runtime/unicode-case.mjs.map +1 -1
  201. package/dist/runtime.eli +3068 -1882
  202. package/dist/stage3-release.json +1 -1
  203. package/dist/stdlib/async.mjs +1838 -0
  204. package/dist/stdlib/bit.mjs +116 -0
  205. package/dist/stdlib/collection.mjs +193 -0
  206. package/dist/stdlib/core.mjs +28 -0
  207. package/dist/stdlib/data-text.mjs +54 -0
  208. package/dist/stdlib/data.mjs +601 -0
  209. package/dist/stdlib/devtools.mjs +565 -0
  210. package/dist/stdlib/diff.mjs +180 -0
  211. package/dist/stdlib/fn.mjs +164 -0
  212. package/dist/stdlib/hierarchy.mjs +189 -0
  213. package/dist/stdlib/identifier.mjs +33 -0
  214. package/dist/stdlib/interop/js.mjs +706 -0
  215. package/dist/stdlib/interop/object.mjs +40 -0
  216. package/dist/stdlib/json.mjs +843 -0
  217. package/dist/stdlib/lazy-sequence.mjs +117 -0
  218. package/dist/stdlib/math.mjs +386 -0
  219. package/dist/stdlib/meta.mjs +21 -0
  220. package/dist/stdlib/multimethod.mjs +345 -0
  221. package/dist/stdlib/numeric.mjs +327 -0
  222. package/dist/stdlib/order.mjs +194 -0
  223. package/dist/stdlib/persistent-list.mjs +171 -0
  224. package/dist/stdlib/persistent-map.mjs +781 -0
  225. package/dist/stdlib/persistent-queue.mjs +44 -0
  226. package/dist/stdlib/persistent-set.mjs +225 -0
  227. package/dist/stdlib/persistent-vector.mjs +316 -0
  228. package/dist/stdlib/portable/data-text.mjs +1094 -0
  229. package/dist/stdlib/portable/data.mjs +62 -0
  230. package/dist/stdlib/portable/identifier.mjs +179 -0
  231. package/dist/stdlib/portable/metadata.mjs +63 -0
  232. package/dist/stdlib/portable/object.mjs +140 -0
  233. package/dist/stdlib/portable/sequence.mjs +142 -0
  234. package/dist/stdlib/portable/text.mjs +111 -0
  235. package/dist/stdlib/pprint.mjs +807 -0
  236. package/dist/stdlib/protocol.mjs +61 -0
  237. package/dist/stdlib/record.mjs +25 -0
  238. package/dist/stdlib/regex.mjs +115 -0
  239. package/dist/stdlib/result.mjs +198 -0
  240. package/dist/stdlib/schema.mjs +2828 -0
  241. package/dist/stdlib/seq.mjs +913 -0
  242. package/dist/stdlib/set.mjs +317 -0
  243. package/dist/stdlib/sorted.mjs +56 -0
  244. package/dist/stdlib/state.mjs +451 -0
  245. package/dist/stdlib/string.mjs +494 -0
  246. package/dist/stdlib/tap.mjs +187 -0
  247. package/dist/stdlib/test.mjs +669 -0
  248. package/dist/stdlib/time.mjs +522 -0
  249. package/dist/stdlib/transducer.mjs +85 -0
  250. package/dist/stdlib/transient.mjs +32 -0
  251. package/dist/stdlib/type.mjs +28 -0
  252. package/dist/stdlib/uuid.mjs +377 -0
  253. package/dist/stdlib/value.mjs +334 -0
  254. package/dist/stdlib/walk.mjs +243 -0
  255. package/dist/stdlib/wire/gepo.mjs +28 -0
  256. package/dist/stdlib/wire/mdp.mjs +13 -0
  257. package/dist/stdlib/wire/mds.mjs +10 -0
  258. package/dist/stdlib/zipper.mjs +1025 -0
  259. package/editor/README.md +15 -0
  260. package/editor/eliscript-data.el +221 -8
  261. package/editor/eliscript-mode.el +207 -48
  262. package/editor/eliscript-runtime.el +6 -3
  263. package/package.json +49 -15
  264. package/platform/README.md +6 -0
  265. package/platform/browser.mjs +10 -12
  266. package/platform/browser.mjs.map +1 -1
  267. package/runtime/README.md +12 -5
  268. package/runtime/core/array-map.eli +538 -0
  269. package/runtime/core/array-map.mjs +651 -0
  270. package/runtime/core/array-map.mjs.map +1 -0
  271. package/runtime/core/collection-internals.eli +85 -33
  272. package/runtime/core/collection-internals.mjs +245 -193
  273. package/runtime/core/collection-internals.mjs.map +1 -1
  274. package/runtime/core/collection.eli +105 -3
  275. package/runtime/core/collection.mjs +190 -53
  276. package/runtime/core/collection.mjs.map +1 -1
  277. package/runtime/core/data-text.eli +224 -16
  278. package/runtime/core/data-text.mjs +345 -83
  279. package/runtime/core/data-text.mjs.map +1 -1
  280. package/runtime/core/data.eli +50 -33
  281. package/runtime/core/data.mjs +72 -36
  282. package/runtime/core/data.mjs.map +1 -1
  283. package/runtime/core/identifier.mjs +15 -19
  284. package/runtime/core/identifier.mjs.map +1 -1
  285. package/runtime/core/lazy-sequence.eli +885 -15
  286. package/runtime/core/lazy-sequence.mjs +1265 -38
  287. package/runtime/core/lazy-sequence.mjs.map +1 -1
  288. package/runtime/core/map-internals.eli +209 -1
  289. package/runtime/core/map-internals.mjs +359 -71
  290. package/runtime/core/map-internals.mjs.map +1 -1
  291. package/runtime/core/map.eli +75 -7
  292. package/runtime/core/map.mjs +122 -47
  293. package/runtime/core/map.mjs.map +1 -1
  294. package/{stdlib/core/object.eli → runtime/core/object-impl.eli} +6 -6
  295. package/runtime/core/object-impl.mjs +5 -5
  296. package/runtime/core/object-impl.mjs.map +1 -1
  297. package/runtime/core/order.eli +15 -3
  298. package/runtime/core/order.mjs +23 -8
  299. package/runtime/core/order.mjs.map +1 -1
  300. package/runtime/core/persistent-kind.mjs +9 -13
  301. package/runtime/core/persistent-kind.mjs.map +1 -1
  302. package/runtime/core/protocol-error.mjs +9 -11
  303. package/runtime/core/protocol-error.mjs.map +1 -1
  304. package/{stdlib/core/protocol.eli → runtime/core/protocol-impl.eli} +2 -2
  305. package/runtime/core/protocol-impl.mjs +10 -10
  306. package/runtime/core/protocol-impl.mjs.map +1 -1
  307. package/runtime/core/queue.mjs +14 -16
  308. package/runtime/core/queue.mjs.map +1 -1
  309. package/runtime/core/record.eli +2 -2
  310. package/runtime/core/record.mjs +13 -17
  311. package/runtime/core/record.mjs.map +1 -1
  312. package/runtime/core/regex.mjs +18 -22
  313. package/runtime/core/regex.mjs.map +1 -1
  314. package/runtime/core/sequence.eli +33 -31
  315. package/runtime/core/sequence.mjs +60 -93
  316. package/runtime/core/sequence.mjs.map +1 -1
  317. package/runtime/core/set.eli +53 -27
  318. package/runtime/core/set.mjs +113 -82
  319. package/runtime/core/set.mjs.map +1 -1
  320. package/runtime/core/sorted.mjs +91 -108
  321. package/runtime/core/sorted.mjs.map +1 -1
  322. package/{stdlib/core/text.eli → runtime/core/text-impl.eli} +2 -2
  323. package/runtime/core/text-impl.mjs +1 -1
  324. package/runtime/core/text-impl.mjs.map +1 -1
  325. package/runtime/core/transducer.eli +24 -0
  326. package/runtime/core/transducer.mjs +27 -1
  327. package/runtime/core/transducer.mjs.map +1 -1
  328. package/runtime/core/transient-internals.eli +12 -4
  329. package/runtime/core/transient-internals.mjs +19 -6
  330. package/runtime/core/transient-internals.mjs.map +1 -1
  331. package/runtime/core/transient.eli +31 -0
  332. package/runtime/core/transient.mjs +33 -2
  333. package/runtime/core/transient.mjs.map +1 -1
  334. package/runtime/core/value-internals.mjs +29 -35
  335. package/runtime/core/value-internals.mjs.map +1 -1
  336. package/runtime/core/vector.eli +73 -20
  337. package/runtime/core/vector.mjs +159 -156
  338. package/runtime/core/vector.mjs.map +1 -1
  339. package/runtime/literals.eli +16 -9
  340. package/runtime/literals.mjs +25 -9
  341. package/runtime/literals.mjs.map +1 -1
  342. package/{stdlib → runtime/managed}/managed-literal-protocols.eli +100 -34
  343. package/{stdlib → runtime/managed}/managed-literals.eli +406 -81
  344. package/{dist/literal-sources/stdlib → runtime/managed}/managed-queue-state.eli +1 -1
  345. package/runtime/managed/managed-runtime-array-map.eli +45 -0
  346. package/{stdlib → runtime/managed}/managed-runtime-collection-internals.eli +22 -2
  347. package/{stdlib → runtime/managed}/managed-runtime-collection.eli +282 -23
  348. package/{stdlib → runtime/managed}/managed-runtime-data-text.eli +196 -13
  349. package/{stdlib → runtime/managed}/managed-runtime-data.eli +1 -1
  350. package/{stdlib → runtime/managed}/managed-runtime-identifier.eli +1 -1
  351. package/runtime/managed/managed-runtime-lazy-sequence.eli +935 -0
  352. package/{stdlib → runtime/managed}/managed-runtime-list.eli +1 -1
  353. package/{stdlib → runtime/managed}/managed-runtime-map.eli +1 -1
  354. package/{stdlib → runtime/managed}/managed-runtime-metadata-internals.eli +2 -2
  355. package/{stdlib → runtime/managed}/managed-runtime-metadata.eli +2 -2
  356. package/{stdlib → runtime/managed}/managed-runtime-object.eli +1 -1
  357. package/{stdlib → runtime/managed}/managed-runtime-order.eli +3 -3
  358. package/{stdlib → runtime/managed}/managed-runtime-persistent-kind.eli +1 -1
  359. package/{stdlib → runtime/managed}/managed-runtime-protocol.eli +5 -3
  360. package/{stdlib → runtime/managed}/managed-runtime-queue.eli +1 -1
  361. package/{stdlib → runtime/managed}/managed-runtime-record.eli +3 -3
  362. package/{stdlib → runtime/managed}/managed-runtime-regex.eli +2 -2
  363. package/{stdlib → runtime/managed}/managed-runtime-sequence.eli +1 -1
  364. package/{stdlib → runtime/managed}/managed-runtime-set-algebra.eli +1 -1
  365. package/{stdlib → runtime/managed}/managed-runtime-set.eli +1 -1
  366. package/{stdlib → runtime/managed}/managed-runtime-sorted.eli +4 -4
  367. package/{stdlib → runtime/managed}/managed-runtime-text.eli +1 -1
  368. package/{stdlib → runtime/managed}/managed-runtime-transducer.eli +24 -2
  369. package/{stdlib → runtime/managed}/managed-runtime-transient.eli +7 -5
  370. package/{stdlib → runtime/managed}/managed-runtime-type.eli +1 -1
  371. package/{stdlib → runtime/managed}/managed-runtime-value-internals.eli +3 -3
  372. package/{stdlib → runtime/managed}/managed-runtime-value.eli +2 -2
  373. package/{stdlib → runtime/managed}/managed-runtime-vector.eli +5 -2
  374. package/{dist/literal-sources/stdlib → runtime/managed}/managed-sorted-state.eli +1 -1
  375. package/runtime/managed/managed-transient-state.eli +1206 -0
  376. package/{dist/literal-sources/stdlib → runtime/managed}/managed-value-state.eli +30 -6
  377. package/{stdlib → runtime/managed}/managed-vector-view-state.eli +1 -1
  378. package/{stdlib → runtime/managed}/managed-wire-http-rpc.eli +1 -1
  379. package/{stdlib → runtime/managed}/managed-wire-markdown.eli +1 -1
  380. package/{stdlib → runtime/managed}/managed-wire-schema.eli +1 -1
  381. package/runtime/math.mjs +32 -38
  382. package/runtime/math.mjs.map +1 -1
  383. package/runtime/number-radix.mjs +5 -7
  384. package/runtime/number-radix.mjs.map +1 -1
  385. package/runtime/primitives.eli +19 -6
  386. package/runtime/primitives.mjs +81 -46
  387. package/runtime/primitives.mjs.map +1 -1
  388. package/runtime/source-mapping.mjs +17 -23
  389. package/runtime/source-mapping.mjs.map +1 -1
  390. package/runtime/testing/map.eli +70 -41
  391. package/runtime/testing/map.mjs +57 -34
  392. package/runtime/testing/map.mjs.map +1 -1
  393. package/runtime/unicode-case.mjs +6 -6
  394. package/runtime/unicode-case.mjs.map +1 -1
  395. package/runtime/wire/http-rpc.mjs +12 -18
  396. package/runtime/wire/http-rpc.mjs.map +1 -1
  397. package/runtime/wire/markdown.mjs +42 -42
  398. package/runtime/wire/markdown.mjs.map +1 -1
  399. package/runtime/wire/schema.mjs +13 -13
  400. package/runtime/wire/schema.mjs.map +1 -1
  401. package/runtime/worker-value-codec.mjs +5 -7
  402. package/runtime/worker-value-codec.mjs.map +1 -1
  403. package/runtime/worker-value-stream.mjs +128 -135
  404. package/runtime/worker-value-stream.mjs.map +1 -1
  405. package/runtime/worker.mjs +75 -89
  406. package/runtime/worker.mjs.map +1 -1
  407. package/stdlib/README.md +25 -18
  408. package/stdlib/async.eli +1245 -0
  409. package/stdlib/bit.eli +89 -1
  410. package/stdlib/bit.mjs +89 -2
  411. package/stdlib/bit.mjs.map +1 -1
  412. package/stdlib/{core/collection.eli → collection.eli} +39 -4
  413. package/stdlib/core.eli +956 -0
  414. package/stdlib/data-text.eli +62 -1091
  415. package/stdlib/data.eli +517 -37
  416. package/stdlib/devtools.eli +399 -0
  417. package/stdlib/diff.eli +134 -0
  418. package/stdlib/{function.eli → fn.eli} +1 -1
  419. package/stdlib/identifier.eli +21 -136
  420. package/stdlib/interop/object.eli +39 -0
  421. package/stdlib/{core/lazy-sequence.eli → lazy-sequence.eli} +28 -2
  422. package/stdlib/math.eli +267 -0
  423. package/stdlib/{core/metadata.eli → meta.eli} +2 -2
  424. package/stdlib/{core/order.eli → order.eli} +6 -6
  425. package/stdlib/persistent-list.eli +60 -21
  426. package/stdlib/persistent-map.eli +335 -324
  427. package/stdlib/persistent-set.eli +8 -6
  428. package/stdlib/persistent-vector.eli +18 -18
  429. package/stdlib/portable/data-text.eli +1092 -0
  430. package/stdlib/portable/data.eli +42 -0
  431. package/stdlib/portable/identifier.eli +147 -0
  432. package/stdlib/{metadata.eli → portable/metadata.eli} +5 -5
  433. package/stdlib/{object.eli → portable/object.eli} +1 -1
  434. package/stdlib/{sequence.eli → portable/sequence.eli} +1 -1
  435. package/stdlib/{text.eli → portable/text.eli} +1 -1
  436. package/stdlib/pprint.eli +588 -0
  437. package/stdlib/protocol.eli +63 -0
  438. package/stdlib/{core/record.eli → record.eli} +2 -2
  439. package/stdlib/regex.eli +70 -0
  440. package/stdlib/result.eli +53 -44
  441. package/stdlib/schema.eli +1886 -0
  442. package/stdlib/{core/seq.eli → seq.eli} +97 -90
  443. package/{dist/literal-sources/stdlib/core → stdlib}/set.eli +8 -8
  444. package/stdlib/{core/sorted.eli → sorted.eli} +2 -2
  445. package/stdlib/{state/atom.eli → state.eli} +137 -7
  446. package/stdlib/string.eli +362 -0
  447. package/stdlib/tap.eli +135 -0
  448. package/stdlib/test.eli +566 -0
  449. package/stdlib/time.eli +419 -0
  450. package/stdlib/{core/transducer.eli → transducer.eli} +4 -2
  451. package/stdlib/{core/transient.eli → transient.eli} +11 -5
  452. package/stdlib/{core/type.eli → type.eli} +2 -2
  453. package/stdlib/uuid.eli +288 -0
  454. package/stdlib/{core/walk.eli → walk.eli} +6 -6
  455. package/stdlib/{gepo.eli → wire/gepo.eli} +2 -2
  456. package/stdlib/{mdp.eli → wire/mdp.eli} +2 -2
  457. package/stdlib/{mds.eli → wire/mds.eli} +2 -2
  458. package/stdlib/{core/zipper.eli → zipper.eli} +179 -138
  459. package/tests/helpers/wasm-managed-math-node.mjs +495 -582
  460. package/tools/acceptance/check-ground.mjs +106 -132
  461. package/tools/acceptance/check.mjs +16 -16
  462. package/tools/acceptance/retained-performance-snapshot.mjs +265 -149
  463. package/tools/acceptance/retained-soak.mjs +5 -7
  464. package/tools/acceptance/retained-transient.mjs +5 -7
  465. package/tools/backends/build.mjs +373 -95
  466. package/tools/backends/compiler-bootstrap.mjs +271 -317
  467. package/tools/backends/compiler-browser.mjs +7 -9
  468. package/tools/backends/compiler-build.mjs +77 -97
  469. package/tools/backends/compiler-cli-ground.mjs +47 -47
  470. package/tools/backends/compiler-data-transport.mjs +27 -31
  471. package/tools/backends/compiler-host-iteration.mjs +13 -21
  472. package/tools/backends/compiler-host-record.mjs +28 -34
  473. package/tools/backends/compiler-metadata.mjs +145 -53
  474. package/tools/backends/compiler-package-ground.mjs +39 -47
  475. package/tools/backends/compiler-package-loader.mjs +164 -206
  476. package/tools/backends/compiler-session.mjs +432 -324
  477. package/tools/backends/compiler-worker.mjs +79 -89
  478. package/tools/backends/dist/bootstrap-js-stages.mjs +17 -19
  479. package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -1
  480. package/tools/backends/dist/managed-ir-inventory.mjs +1 -1
  481. package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -1
  482. package/tools/backends/dist/release-cli.mjs +151 -22
  483. package/tools/backends/dist/release-cli.mjs.map +1 -1
  484. package/tools/backends/dist/run-artifact.mjs +54 -76
  485. package/tools/backends/dist/run-artifact.mjs.map +1 -1
  486. package/tools/backends/managed-foreign-binding.mjs +370 -114
  487. package/tools/backends/managed-host-ground.mjs +14 -17
  488. package/tools/backends/managed-host-lifecycle.mjs +42 -53
  489. package/tools/backends/managed-host-object-realm.mjs +121 -111
  490. package/tools/backends/managed-host-proxy.mjs +5 -7
  491. package/tools/backends/managed-host-runtime.mjs +6295 -4350
  492. package/tools/backends/managed-host.mjs +234 -188
  493. package/tools/backends/managed-layout.mjs +53 -56
  494. package/tools/backends/managed-module-graph-ground.mjs +488 -568
  495. package/tools/backends/managed-module-graph.mjs +62 -76
  496. package/tools/backends/managed-runtime-host-ground.mjs +352 -400
  497. package/tools/backends/managed-runtime.mjs +227 -266
  498. package/tools/backends/managed-source-view-ground.mjs +165 -161
  499. package/tools/backends/managed-source-view.mjs +415 -154
  500. package/tools/backends/native-managed-runtime.mjs +96 -138
  501. package/tools/backends/native-memory.mjs +1122 -742
  502. package/tools/backends/native-node-ffi.mjs +2439 -0
  503. package/tools/backends/native-node-memory.mjs +793 -383
  504. package/tools/backends/native-node-runner.mjs +1458 -579
  505. package/tools/backends/native-node-watchdog.mjs +12 -14
  506. package/tools/backends/native-node-worker.mjs +46 -50
  507. package/tools/backends/stage3-targets.mjs +2 -2
  508. package/tools/bootstrap-runtime.el +4 -4
  509. package/tools/collections/transient-builder-benchmark.mjs +17 -17
  510. package/tools/project/check-cli.eli +27 -3
  511. package/tools/project/project-cli.eli +1 -1
  512. package/tools/testing/maintained-suite-source.mjs +5 -7
  513. package/tools/testing/maintained-suite-source.mjs.map +1 -1
  514. package/dist/literal-sources/stdlib/core/data.eli +0 -306
  515. package/dist/literal-sources/stdlib/managed-transient-state.eli +0 -353
  516. package/stdlib/core/data-text.eli +0 -16
  517. package/stdlib/core/data.eli +0 -306
  518. package/stdlib/core/identifier.eli +0 -32
  519. package/stdlib/core/regex.eli +0 -17
  520. package/stdlib/deferred.eli +0 -70
  521. package/stdlib/managed-runtime-lazy-sequence.eli +0 -157
  522. package/stdlib/managed-transient-state.eli +0 -353
  523. /package/{stdlib → runtime/managed}/managed-protocol-error.eli +0 -0
  524. /package/{stdlib → runtime/managed}/managed-runtime-literals.eli +0 -0
  525. /package/{stdlib → runtime/managed}/managed-runtime-truth.eli +0 -0
  526. /package/{stdlib → runtime/managed}/managed-testing-value.eli +0 -0
@@ -7,6 +7,9 @@ var __eliscript_tdz_ready_6;
7
7
  var __eliscript_tdz_ready_7;
8
8
  var __eliscript_tdz_ready_8;
9
9
  var __eliscript_tdz_ready_9;
10
+ var __eliscript_tdz_ready_10;
11
+ var __eliscript_tdz_ready_11;
12
+ var __eliscript_tdz_ready_12;
10
13
  import "eliscript/runtime/unicode-case.mjs";
11
14
  import { __eliscript_at, __eliscript_at_direct, __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not } from "eliscript/runtime/prelude.mjs";
12
15
  const __eliscript_truthy = (value) => value !== false && value != null;
@@ -27,7 +30,7 @@ const portable_forbidden_operator_set = new (globalThis.Set)(portable_forbidden_
27
30
  __eliscript_tdz_ready_5 = true;
28
31
  const top_level_operator_set = new (globalThis.Set)(top_level_operators);
29
32
  __eliscript_tdz_ready_6 = true;
30
- const transient_import_pattern = new (globalThis.RegExp)("(^|/)(stdlib|runtime)/core/transient\\.(mjs|eli)$");
33
+ const transient_import_pattern = new (globalThis.RegExp)("(^|/)(stdlib|runtime/core)/transient\\.(mjs|eli)$");
31
34
  __eliscript_tdz_ready_7 = true;
32
35
  const fail = ((diagnostic) => {
33
36
  {
@@ -1776,4 +1779,1017 @@ function analyze_module(forms, filename) {
1776
1779
  return forms;
1777
1780
  }
1778
1781
  }
1779
- export {analyze_module, select_portable_module};
1782
+ const lint_transient_constructors = new (globalThis.Set)(["transient", "as-transient", "asTransient", "transient-vector", "transientVector", "transient-map", "transientMap", "transient-set", "transientSet"]);
1783
+ __eliscript_tdz_ready_10 = true;
1784
+ const lint_transient_updaters = new (globalThis.Set)(["conj!", "conjBang", "assoc!", "assocBang", "dissoc!", "dissocBang", "disj!", "disjBang"]);
1785
+ __eliscript_tdz_ready_11 = true;
1786
+ const lint_transient_finalizers = new (globalThis.Set)(["persistent!", "persistentBang"]);
1787
+ __eliscript_tdz_ready_12 = true;
1788
+ function lint_ignored_name_p(name) {
1789
+ return ((__eliscript_value_56) => (__eliscript_truthy(__eliscript_value_56) ? (name)["startsWith"]("_") : __eliscript_value_56))(((__eliscript_tdz_ready_0 === true ? typeof_value : __eliscript_tdz_error("typeof_value"))(name) === "string"));
1790
+ }
1791
+ function lint_rule_level(options, code) {
1792
+ {
1793
+ let rules = ((__eliscript_value_57) => (__eliscript_truthy(__eliscript_value_57) ? ((__eliscript_value_58) => (__eliscript_truthy(__eliscript_value_58) ? ((options)["rules"] ?? null) : __eliscript_value_58))(((__eliscript_tdz_ready_0 === true ? typeof_value : __eliscript_tdz_error("typeof_value"))(options) === "object")) : __eliscript_value_57))(options);
1794
+ let raw = ((__eliscript_value_59) => (__eliscript_truthy(__eliscript_value_59) ? ((__eliscript_value_60) => (__eliscript_truthy(__eliscript_value_60) ? (rules)[code] : __eliscript_value_60))(((__eliscript_tdz_ready_0 === true ? typeof_value : __eliscript_tdz_error("typeof_value"))(rules) === "object")) : __eliscript_value_59))(rules);
1795
+ if ((raw === "off")) {
1796
+ return "off";
1797
+ } else {
1798
+ if ((raw === "error")) {
1799
+ return "error";
1800
+ } else {
1801
+ return "warning";
1802
+ }
1803
+ }
1804
+ }
1805
+ }
1806
+ function lint_emit(state, code, span, message) {
1807
+ {
1808
+ let severity = lint_rule_level((state)["options"], code);
1809
+ if ((!(severity === "off"))) {
1810
+ {
1811
+ let effective_span = ((__eliscript_value_61) => (__eliscript_truthy(__eliscript_value_61) ? __eliscript_value_61 : (state)["currentSpan"]))(span);
1812
+ let file = ((__eliscript_value_62) => (__eliscript_truthy(__eliscript_value_62) ? __eliscript_value_62 : ((__eliscript_value_63) => (__eliscript_truthy(__eliscript_value_63) ? __eliscript_value_63 : "<input>"))(((__eliscript_value_64) => (__eliscript_truthy(__eliscript_value_64) ? (effective_span)["filename"] : __eliscript_value_64))(effective_span))))((state)["filename"]);
1813
+ let loc = (__eliscript_truthy(effective_span) ? ({"file": file, "start": ({"offset": (effective_span)["start"], "line": (effective_span)["line"], "column": (effective_span)["column"]}), "end": ({"offset": (effective_span)["end"], "line": (effective_span)["endLine"], "column": (effective_span)["endColumn"]})}) : ({"file": file}));
1814
+ let diag = ({"format": "eliscript-diagnostic", "code": code, "severity": severity, "phase": "lint", "message": message, "location": loc});
1815
+ return ((state)["diagnostics"])["push"](diag);
1816
+ }
1817
+ } else {
1818
+ return null;
1819
+ }
1820
+ }
1821
+ }
1822
+ function lint_make_scope(parent, fn_depth) {
1823
+ return ({"parent": parent, "fnDepth": fn_depth, "bindings": new (globalThis.Map)(), "order": []});
1824
+ }
1825
+ function lint_lookup(scope, name) {
1826
+ {
1827
+ let current = scope;
1828
+ let found = null;
1829
+ while ((__eliscript_truthy(current) && !(__eliscript_truthy(found)))) {
1830
+ ((found = ((current)["bindings"])["get"](name)));
1831
+ if ((!__eliscript_truthy(found))) {
1832
+ ((current = (current)["parent"]));
1833
+ }
1834
+ }
1835
+ return found;
1836
+ }
1837
+ }
1838
+ function lint_declare(scope, name_node, kind, fn_depth, mutable, state, check_shadow = null, is_transient = null) {
1839
+ if (__eliscript_truthy(symbol_node_p(name_node))) {
1840
+ {
1841
+ let name = node_name(name_node);
1842
+ let span = ((__eliscript_value_65) => (__eliscript_truthy(__eliscript_value_65) ? __eliscript_value_65 : (state)["currentSpan"]))(node_span(name_node));
1843
+ if ((__eliscript_truthy(check_shadow) && !(__eliscript_truthy(lint_ignored_name_p(name))) && __eliscript_truthy((scope)["parent"]) && __eliscript_truthy(lint_lookup((scope)["parent"], name)))) {
1844
+ lint_emit(state, "ELI-L0003", span, (String("binding shadows outer binding: ") + String(name)));
1845
+ }
1846
+ {
1847
+ let binding = ({"name": name, "kind": kind, "fnDepth": fn_depth, "span": span, "mutable": mutable, "used": false, "isTransient": (__eliscript_truthy(is_transient) ? true : false), "transientFinalized": false, "transientEscaped": false, "transientEscapeSpan": null});
1848
+ if ((!__eliscript_truthy(((scope)["bindings"])["has"](name)))) {
1849
+ ((scope)["order"])["push"](binding);
1850
+ }
1851
+ ((scope)["bindings"])["set"](name, binding);
1852
+ return binding;
1853
+ }
1854
+ }
1855
+ } else {
1856
+ return null;
1857
+ }
1858
+ }
1859
+ function lint_finalize_scope(scope, state) {
1860
+ {
1861
+ let order = (scope)["order"];
1862
+ let index = 0;
1863
+ while (__eliscript_numeric_relation("<", index, (order)["length"])) {
1864
+ {
1865
+ let binding = ((((order) ?? [])[index]) ?? null);
1866
+ let name = (binding)["name"];
1867
+ let kind = (binding)["kind"];
1868
+ if ((((kind === "local") || (kind === "parameter") || (kind === "loop") || (kind === "catch")) && !(__eliscript_truthy((binding)["used"])) && !(__eliscript_truthy(lint_ignored_name_p(name))))) {
1869
+ lint_emit(state, "ELI-L0001", (binding)["span"], (String("unused local binding: ") + String(name)));
1870
+ }
1871
+ if ((__eliscript_truthy((binding)["isTransient"]) && (__eliscript_truthy((binding)["transientEscaped"]) || !(__eliscript_truthy((binding)["transientFinalized"]))))) {
1872
+ lint_emit(state, "ELI-L0009", ((__eliscript_value_66) => (__eliscript_truthy(__eliscript_value_66) ? __eliscript_value_66 : (binding)["span"]))((binding)["transientEscapeSpan"]), (String("transient binding escapes or is not finalized with persistent!: ") + String(name)));
1873
+ }
1874
+ }
1875
+ ((index = (index + 1)));
1876
+ }
1877
+ return null;
1878
+ }
1879
+ }
1880
+ function lint_transient_init_p(node) {
1881
+ {
1882
+ let items = ((__eliscript_value_67) => (__eliscript_truthy(__eliscript_value_67) ? ((__eliscript_value_68) => (__eliscript_truthy(__eliscript_value_68) ? node_items(node) : __eliscript_value_68))((node_kind(node) === "list")) : __eliscript_value_67))(node);
1883
+ return ((__eliscript_value_69) => (__eliscript_truthy(__eliscript_value_69) ? ((__eliscript_value_70) => (__eliscript_truthy(__eliscript_value_70) ? ((__eliscript_value_71) => (__eliscript_truthy(__eliscript_value_71) ? ((__eliscript_tdz_ready_10 === true ? lint_transient_constructors : __eliscript_tdz_error("lint_transient_constructors")))["has"](node_name(((((items) ?? [])[0]) ?? null))) : __eliscript_value_71))(symbol_node_p(((((items) ?? [])[0]) ?? null))) : __eliscript_value_70))(__eliscript_numeric_relation(">", (items)["length"], 0)) : __eliscript_value_69))(items);
1884
+ }
1885
+ }
1886
+ function lint_mark_finalized_transient(arg, scope) {
1887
+ if (__eliscript_truthy(arg)) {
1888
+ if (__eliscript_truthy(symbol_node_p(arg))) {
1889
+ {
1890
+ let binding = lint_lookup(scope, node_name(arg));
1891
+ if ((__eliscript_truthy(binding) && __eliscript_truthy((binding)["isTransient"]) && ((binding)["fnDepth"] === (scope)["fnDepth"]))) {
1892
+ return ((binding)["transientFinalized"] = true);
1893
+ } else {
1894
+ return null;
1895
+ }
1896
+ }
1897
+ } else {
1898
+ if ((node_kind(arg) === "list")) {
1899
+ {
1900
+ let items = node_items(arg);
1901
+ let head = ((__eliscript_value_72) => (__eliscript_truthy(__eliscript_value_72) ? ((((items) ?? [])[0]) ?? null) : __eliscript_value_72))(__eliscript_numeric_relation(">", (items)["length"], 0));
1902
+ if ((__eliscript_truthy(head) && __eliscript_truthy(symbol_node_p(head)) && __eliscript_truthy(((__eliscript_tdz_ready_11 === true ? lint_transient_updaters : __eliscript_tdz_error("lint_transient_updaters")))["has"](node_name(head))) && __eliscript_numeric_relation(">", (items)["length"], 1))) {
1903
+ return lint_mark_finalized_transient(((((items) ?? [])[1]) ?? null), scope);
1904
+ } else {
1905
+ return null;
1906
+ }
1907
+ }
1908
+ } else {
1909
+ return null;
1910
+ }
1911
+ }
1912
+ } else {
1913
+ return null;
1914
+ }
1915
+ }
1916
+ function lint_constant_condition_p(node) {
1917
+ if (!(__eliscript_truthy(node))) {
1918
+ return null;
1919
+ } else {
1920
+ {
1921
+ let kind = node_kind(node);
1922
+ return ((__eliscript_value_73) => (__eliscript_truthy(__eliscript_value_73) ? __eliscript_value_73 : ((__eliscript_value_74) => (__eliscript_truthy(__eliscript_value_74) ? __eliscript_value_74 : ((__eliscript_value_75) => (__eliscript_truthy(__eliscript_value_75) ? __eliscript_value_75 : ((__eliscript_value_76) => (__eliscript_truthy(__eliscript_value_76) ? ((__eliscript_value_77) => (__eliscript_truthy(__eliscript_value_77) ? ((__eliscript_value_78) => (__eliscript_truthy(__eliscript_value_78) ? (node_name(((((node_items(node)) ?? [])[0]) ?? null)) === "quote") : __eliscript_value_78))(symbol_node_p(((((node_items(node)) ?? [])[0]) ?? null))) : __eliscript_value_77))(__eliscript_numeric_relation(">", (node_items(node))["length"], 0)) : __eliscript_value_76))((kind === "list"))))((kind === "keyword"))))((kind === "undefined"))))((kind === "literal"));
1923
+ }
1924
+ }
1925
+ }
1926
+ function lint_useless_expr_p(node) {
1927
+ if (!(__eliscript_truthy(node))) {
1928
+ return null;
1929
+ } else {
1930
+ {
1931
+ let kind = node_kind(node);
1932
+ return ((__eliscript_value_79) => (__eliscript_truthy(__eliscript_value_79) ? __eliscript_value_79 : ((__eliscript_value_80) => (__eliscript_truthy(__eliscript_value_80) ? __eliscript_value_80 : ((__eliscript_value_81) => (__eliscript_truthy(__eliscript_value_81) ? __eliscript_value_81 : ((__eliscript_value_82) => (__eliscript_truthy(__eliscript_value_82) ? __eliscript_value_82 : ((__eliscript_value_83) => (__eliscript_truthy(__eliscript_value_83) ? ((__eliscript_value_84) => (__eliscript_truthy(__eliscript_value_84) ? ((__eliscript_value_85) => (__eliscript_truthy(__eliscript_value_85) ? (node_name(((((node_items(node)) ?? [])[0]) ?? null)) === "quote") : __eliscript_value_85))(symbol_node_p(((((node_items(node)) ?? [])[0]) ?? null))) : __eliscript_value_84))(__eliscript_numeric_relation(">", (node_items(node))["length"], 0)) : __eliscript_value_83))((kind === "list"))))(((kind === "symbol") && (!__eliscript_truthy(lint_ignored_name_p(node_name(node))))))))((kind === "keyword"))))((kind === "undefined"))))((kind === "literal"));
1933
+ }
1934
+ }
1935
+ }
1936
+ function lint_literal_key(node) {
1937
+ if (!(__eliscript_truthy(node))) {
1938
+ return null;
1939
+ } else {
1940
+ {
1941
+ let kind = node_kind(node);
1942
+ if ((kind === "undefined")) {
1943
+ return "undef:undefined";
1944
+ } else {
1945
+ if ((kind === "keyword")) {
1946
+ return (String("kw:") + String(node_name(node)));
1947
+ } else {
1948
+ if ((kind === "literal")) {
1949
+ {
1950
+ let val = node_value(node);
1951
+ if ((val == null)) {
1952
+ return "nil:nil";
1953
+ } else {
1954
+ if ((val === true)) {
1955
+ return "bool:t";
1956
+ } else {
1957
+ if ((val === false)) {
1958
+ return "bool:false";
1959
+ } else {
1960
+ if (((__eliscript_tdz_ready_0 === true ? typeof_value : __eliscript_tdz_error("typeof_value"))(val) === "string")) {
1961
+ return (String("str:") + String(val));
1962
+ } else {
1963
+ if (((__eliscript_tdz_ready_0 === true ? typeof_value : __eliscript_tdz_error("typeof_value"))(val) === "number")) {
1964
+ return (String("num:") + String(((val === 0) ? 0 : val)));
1965
+ } else {
1966
+ return null;
1967
+ }
1968
+ }
1969
+ }
1970
+ }
1971
+ }
1972
+ }
1973
+ } else {
1974
+ return null;
1975
+ }
1976
+ }
1977
+ }
1978
+ }
1979
+ }
1980
+ }
1981
+ function lint_key_display(node) {
1982
+ if (!(__eliscript_truthy(node))) {
1983
+ return "nil";
1984
+ } else {
1985
+ {
1986
+ let kind = node_kind(node);
1987
+ if ((kind === "undefined")) {
1988
+ return "undefined";
1989
+ } else {
1990
+ if ((kind === "keyword")) {
1991
+ return (String(":") + String(node_name(node)));
1992
+ } else {
1993
+ if ((kind === "literal")) {
1994
+ {
1995
+ let val = node_value(node);
1996
+ if ((val == null)) {
1997
+ return "nil";
1998
+ } else {
1999
+ if ((val === true)) {
2000
+ return "t";
2001
+ } else {
2002
+ if ((val === false)) {
2003
+ return "false";
2004
+ } else {
2005
+ if (((__eliscript_tdz_ready_0 === true ? typeof_value : __eliscript_tdz_error("typeof_value"))(val) === "string")) {
2006
+ return JSON.stringify(val);
2007
+ } else {
2008
+ return (String(val));
2009
+ }
2010
+ }
2011
+ }
2012
+ }
2013
+ }
2014
+ } else {
2015
+ return node_display(node);
2016
+ }
2017
+ }
2018
+ }
2019
+ }
2020
+ }
2021
+ }
2022
+ function lint_collect_arities(forms) {
2023
+ {
2024
+ let arities = new (globalThis.Map)();
2025
+ let context = ({"filename": "<lint>"});
2026
+ let index = 0;
2027
+ while (__eliscript_numeric_relation("<", index, (forms)["length"])) {
2028
+ {
2029
+ let form = ((((forms) ?? [])[index]) ?? null);
2030
+ if ((node_kind(form) === "list")) {
2031
+ {
2032
+ let items = node_items(form);
2033
+ let op = ((__eliscript_value_86) => (__eliscript_truthy(__eliscript_value_86) ? ((__eliscript_value_87) => (__eliscript_truthy(__eliscript_value_87) ? node_name(((((items) ?? [])[0]) ?? null)) : __eliscript_value_87))(symbol_node_p(((((items) ?? [])[0]) ?? null))) : __eliscript_value_86))(__eliscript_numeric_relation(">", (items)["length"], 0));
2034
+ if ((__eliscript_numeric_relation(">=", (items)["length"], 3) && ((op === "defun") || (op === "defn") || (op === "defportable") || (op === "defasync")) && __eliscript_truthy(symbol_node_p(((((items) ?? [])[1]) ?? null))))) {
2035
+ {
2036
+ let name = node_name(((((items) ?? [])[1]) ?? null));
2037
+ let params_node = ((((items) ?? [])[2]) ?? null);
2038
+ try {
2039
+ {
2040
+ let parsed = function_parameters(params_node, context);
2041
+ let min_arity = 0;
2042
+ let max_arity = 0;
2043
+ let variadic = false;
2044
+ let p_idx = 0;
2045
+ while (__eliscript_numeric_relation("<", p_idx, (parsed)["length"])) {
2046
+ {
2047
+ let kind = (((((parsed) ?? [])[p_idx]) ?? null))["kind"];
2048
+ if ((kind === "required")) {
2049
+ ((min_arity = (min_arity + 1)));
2050
+ ((max_arity = (max_arity + 1)));
2051
+ } else {
2052
+ if ((kind === "optional")) {
2053
+ ((max_arity = (max_arity + 1)));
2054
+ } else {
2055
+ if ((kind === "rest")) {
2056
+ ((variadic = true));
2057
+ } else {
2058
+
2059
+ }
2060
+ }
2061
+ }
2062
+ }
2063
+ ((p_idx = (p_idx + 1)));
2064
+ }
2065
+ (arities)["set"](name, ({"min": min_arity, "max": (__eliscript_truthy(variadic) ? null : max_arity)}));
2066
+ }
2067
+ } catch (_err) {
2068
+ null;
2069
+ }
2070
+ }
2071
+ }
2072
+ }
2073
+ }
2074
+ }
2075
+ ((index = (index + 1)));
2076
+ }
2077
+ return arities;
2078
+ }
2079
+ }
2080
+ function lint_sequence(forms, scope, tail, state) {
2081
+ {
2082
+ let index = 0;
2083
+ let len = (forms)["length"];
2084
+ while (__eliscript_numeric_relation("<", index, len)) {
2085
+ {
2086
+ let item = ((((forms) ?? [])[index]) ?? null);
2087
+ let is_last = (index === __eliscript_numeric_decrement(len));
2088
+ if ((!(__eliscript_truthy(is_last)) && __eliscript_truthy(lint_useless_expr_p(item)))) {
2089
+ lint_emit(state, "ELI-L0008", ((__eliscript_value_88) => (__eliscript_truthy(__eliscript_value_88) ? __eliscript_value_88 : (state)["currentSpan"]))(node_span(item)), "useless literal expression in sequence");
2090
+ }
2091
+ lint_expression(item, scope, ((__eliscript_value_89) => (__eliscript_truthy(__eliscript_value_89) ? is_last : __eliscript_value_89))(tail), state);
2092
+ }
2093
+ ((index = (index + 1)));
2094
+ }
2095
+ return null;
2096
+ }
2097
+ }
2098
+ function lint_pattern_defaults(pattern, scope, state) {
2099
+ {
2100
+ let context = ({"filename": ((__eliscript_value_90) => (__eliscript_truthy(__eliscript_value_90) ? __eliscript_value_90 : "<input>"))((state)["filename"])});
2101
+ try {
2102
+ if (__eliscript_truthy(vector_node_p(pattern))) {
2103
+ return (node_items(pattern))["forEach"](((element) => {
2104
+ if ((!(__eliscript_truthy(null_node_p(element)) || (__eliscript_truthy(symbol_node_p(element)) && (node_name(element) === "&rest"))))) {
2105
+ return lint_pattern_defaults(element, scope, state);
2106
+ } else {
2107
+ return null;
2108
+ }
2109
+ }));
2110
+ } else {
2111
+ if (__eliscript_truthy(map_node_p(pattern))) {
2112
+ {
2113
+ let spec = map_binding_spec(pattern, context);
2114
+ return ((spec)["entries"])["forEach"](((entry) => {
2115
+ if (__eliscript_truthy((entry)["hasDefault"])) {
2116
+ lint_expression((entry)["default"], scope, null, state);
2117
+ }
2118
+ return lint_pattern_defaults((entry)["target"], scope, state);
2119
+ }));
2120
+ }
2121
+ } else {
2122
+ return null;
2123
+ }
2124
+ }
2125
+ } catch (_err) {
2126
+ return null;
2127
+ }
2128
+ }
2129
+ }
2130
+ function lint_declare_pattern(scope, pattern, kind, fn_depth, mutable, state, check_shadow = null, is_transient = null) {
2131
+ {
2132
+ let context = ({"filename": ((__eliscript_value_91) => (__eliscript_truthy(__eliscript_value_91) ? __eliscript_value_91 : "<input>"))((state)["filename"])});
2133
+ try {
2134
+ {
2135
+ let single = ((__eliscript_value_92) => (__eliscript_truthy(__eliscript_value_92) ? (!__eliscript_truthy(binding_marker_p(node_name(pattern)))) : __eliscript_value_92))(symbol_node_p(pattern));
2136
+ let nodes = (__eliscript_truthy(single) ? [pattern] : binding_nodes(pattern, context));
2137
+ let index = 0;
2138
+ while (__eliscript_numeric_relation("<", index, (nodes)["length"])) {
2139
+ lint_declare(scope, ((((nodes) ?? [])[index]) ?? null), kind, fn_depth, mutable, state, check_shadow, ((__eliscript_value_93) => (__eliscript_truthy(__eliscript_value_93) ? is_transient : __eliscript_value_93))(single));
2140
+ ((index = (index + 1)));
2141
+ }
2142
+ return null;
2143
+ }
2144
+ } catch (_err) {
2145
+ return null;
2146
+ }
2147
+ }
2148
+ }
2149
+ function lint_let_binding_pair(binding) {
2150
+ if (__eliscript_truthy(binding_pattern_p(binding))) {
2151
+ return [binding, null];
2152
+ } else {
2153
+ {
2154
+ let items = list_items(binding);
2155
+ if ((!((items === undefined)) && __eliscript_numeric_relation(">=", (items)["length"], 1) && __eliscript_numeric_relation("<=", (items)["length"], 2) && __eliscript_truthy(binding_pattern_p(((((items) ?? [])[0]) ?? null))))) {
2156
+ return [((((items) ?? [])[0]) ?? null), (__eliscript_numeric_relation(">", (items)["length"], 1) ? ((((items) ?? [])[1]) ?? null) : null)];
2157
+ } else {
2158
+ return null;
2159
+ }
2160
+ }
2161
+ }
2162
+ }
2163
+ function lint_let(args, scope, sequential, tail, state) {
2164
+ if (__eliscript_numeric_relation(">", (args)["length"], 0)) {
2165
+ {
2166
+ let bindings = list_items(((((args) ?? [])[0]) ?? null));
2167
+ let body = (args)["slice"](1);
2168
+ let child = lint_make_scope(scope, (scope)["fnDepth"]);
2169
+ if (!((bindings === undefined))) {
2170
+ if (__eliscript_truthy(sequential)) {
2171
+ {
2172
+ let index = 0;
2173
+ while (__eliscript_numeric_relation("<", index, (bindings)["length"])) {
2174
+ {
2175
+ let pair = lint_let_binding_pair(((((bindings) ?? [])[index]) ?? null));
2176
+ if (__eliscript_truthy(pair)) {
2177
+ {
2178
+ let pat = ((((pair) ?? [])[0]) ?? null);
2179
+ let init = ((((pair) ?? [])[1]) ?? null);
2180
+ if (__eliscript_truthy(init)) {
2181
+ lint_expression(init, child, null, state);
2182
+ }
2183
+ lint_pattern_defaults(pat, child, state);
2184
+ lint_declare_pattern(child, pat, "local", (child)["fnDepth"], true, state, true, lint_transient_init_p(init));
2185
+ }
2186
+ }
2187
+ }
2188
+ ((index = (index + 1)));
2189
+ }
2190
+ }
2191
+ } else {
2192
+ {
2193
+ let parsed = [];
2194
+ let index = 0;
2195
+ while (__eliscript_numeric_relation("<", index, (bindings)["length"])) {
2196
+ {
2197
+ let pair = lint_let_binding_pair(((((bindings) ?? [])[index]) ?? null));
2198
+ if (__eliscript_truthy(pair)) {
2199
+ (parsed)["push"](pair);
2200
+ }
2201
+ }
2202
+ ((index = (index + 1)));
2203
+ }
2204
+ ((index = 0));
2205
+ while (__eliscript_numeric_relation("<", index, (parsed)["length"])) {
2206
+ {
2207
+ let pair = ((((parsed) ?? [])[index]) ?? null);
2208
+ if (__eliscript_truthy(((((pair) ?? [])[1]) ?? null))) {
2209
+ lint_expression(((((pair) ?? [])[1]) ?? null), scope, null, state);
2210
+ }
2211
+ lint_pattern_defaults(((((pair) ?? [])[0]) ?? null), scope, state);
2212
+ }
2213
+ ((index = (index + 1)));
2214
+ }
2215
+ ((index = 0));
2216
+ while (__eliscript_numeric_relation("<", index, (parsed)["length"])) {
2217
+ {
2218
+ let pair = ((((parsed) ?? [])[index]) ?? null);
2219
+ lint_declare_pattern(child, ((((pair) ?? [])[0]) ?? null), "local", (child)["fnDepth"], true, state, true, lint_transient_init_p(((((pair) ?? [])[1]) ?? null)));
2220
+ }
2221
+ ((index = (index + 1)));
2222
+ }
2223
+ }
2224
+ }
2225
+ }
2226
+ lint_sequence(body, child, tail, state);
2227
+ return lint_finalize_scope(child, state);
2228
+ }
2229
+ } else {
2230
+ return null;
2231
+ }
2232
+ }
2233
+ function lint_loop(args, scope, tail, state) {
2234
+ if (__eliscript_numeric_relation(">", (args)["length"], 0)) {
2235
+ {
2236
+ let bindings = list_items(((((args) ?? [])[0]) ?? null));
2237
+ let body = (args)["slice"](1);
2238
+ let child = lint_make_scope(scope, (scope)["fnDepth"]);
2239
+ let pairs = [];
2240
+ if (!((bindings === undefined))) {
2241
+ {
2242
+ let index = 0;
2243
+ while (__eliscript_numeric_relation("<", index, (bindings)["length"])) {
2244
+ {
2245
+ let items = list_items(((((bindings) ?? [])[index]) ?? null));
2246
+ if ((!((items === undefined)) && ((items)["length"] === 2))) {
2247
+ {
2248
+ let pair = lint_let_binding_pair(((((bindings) ?? [])[index]) ?? null));
2249
+ if (__eliscript_truthy(pair)) {
2250
+ (pairs)["push"](pair);
2251
+ }
2252
+ }
2253
+ }
2254
+ }
2255
+ ((index = (index + 1)));
2256
+ }
2257
+ }
2258
+ {
2259
+ let index = 0;
2260
+ while (__eliscript_numeric_relation("<", index, (pairs)["length"])) {
2261
+ {
2262
+ let pair = ((((pairs) ?? [])[index]) ?? null);
2263
+ if (__eliscript_truthy(((((pair) ?? [])[1]) ?? null))) {
2264
+ lint_expression(((((pair) ?? [])[1]) ?? null), scope, null, state);
2265
+ }
2266
+ lint_pattern_defaults(((((pair) ?? [])[0]) ?? null), scope, state);
2267
+ }
2268
+ ((index = (index + 1)));
2269
+ }
2270
+ ((index = 0));
2271
+ while (__eliscript_numeric_relation("<", index, (pairs)["length"])) {
2272
+ {
2273
+ let pair = ((((pairs) ?? [])[index]) ?? null);
2274
+ lint_declare_pattern(child, ((((pair) ?? [])[0]) ?? null), "loop", (child)["fnDepth"], true, state, true, lint_transient_init_p(((((pair) ?? [])[1]) ?? null)));
2275
+ }
2276
+ ((index = (index + 1)));
2277
+ }
2278
+ }
2279
+ }
2280
+ lint_sequence(body, child, tail, state);
2281
+ return lint_finalize_scope(child, state);
2282
+ }
2283
+ } else {
2284
+ return null;
2285
+ }
2286
+ }
2287
+ function lint_function(parameters, body, scope, state) {
2288
+ {
2289
+ let context = ({"filename": ((__eliscript_value_94) => (__eliscript_truthy(__eliscript_value_94) ? __eliscript_value_94 : "<input>"))((state)["filename"])});
2290
+ let parsed = (() => {
2291
+ try {
2292
+ return function_parameters(parameters, context);
2293
+ } catch (_err) {
2294
+ return [];
2295
+ }
2296
+ })();
2297
+ let first_body = ((__eliscript_value_95) => (__eliscript_truthy(__eliscript_value_95) ? ((((body) ?? [])[0]) ?? null) : __eliscript_value_95))(__eliscript_numeric_relation(">", (body)["length"], 0));
2298
+ let first_items = ((__eliscript_value_96) => (__eliscript_truthy(__eliscript_value_96) ? ((__eliscript_value_97) => (__eliscript_truthy(__eliscript_value_97) ? node_items(first_body) : __eliscript_value_97))((node_kind(first_body) === "list")) : __eliscript_value_96))(first_body);
2299
+ let clean_body = ((__eliscript_truthy(first_items) && __eliscript_numeric_relation(">", (first_items)["length"], 0) && __eliscript_truthy(symbol_node_p(((((first_items) ?? [])[0]) ?? null))) && (node_name(((((first_items) ?? [])[0]) ?? null)) === "memory-sig")) ? (body)["slice"](1) : body);
2300
+ let child = lint_make_scope(scope, ((scope)["fnDepth"] + 1));
2301
+ let index = 0;
2302
+ while (__eliscript_numeric_relation("<", index, (parsed)["length"])) {
2303
+ lint_pattern_defaults((((((parsed) ?? [])[index]) ?? null))["node"], scope, state);
2304
+ ((index = (index + 1)));
2305
+ }
2306
+ ((index = 0));
2307
+ while (__eliscript_numeric_relation("<", index, (parsed)["length"])) {
2308
+ lint_declare_pattern(child, (((((parsed) ?? [])[index]) ?? null))["node"], "parameter", (child)["fnDepth"], true, state, true, false);
2309
+ ((index = (index + 1)));
2310
+ }
2311
+ lint_sequence(clean_body, child, true, state);
2312
+ return lint_finalize_scope(child, state);
2313
+ }
2314
+ }
2315
+ function lint_assignment(form_span, args, scope, state) {
2316
+ {
2317
+ let index = 0;
2318
+ while (__eliscript_numeric_relation("<", index, (args)["length"])) {
2319
+ {
2320
+ let target_node = ((((args) ?? [])[index]) ?? null);
2321
+ let value_node = ((__eliscript_value_98) => (__eliscript_truthy(__eliscript_value_98) ? ((((args) ?? [])[(index + 1)]) ?? null) : __eliscript_value_98))(__eliscript_numeric_relation("<", (index + 1), (args)["length"]));
2322
+ if (__eliscript_truthy(value_node)) {
2323
+ lint_expression(value_node, scope, null, state);
2324
+ }
2325
+ if (__eliscript_truthy(symbol_node_p(target_node))) {
2326
+ {
2327
+ let target = node_name(target_node);
2328
+ let binding = lint_lookup(scope, target);
2329
+ if (__eliscript_truthy(binding)) {
2330
+ if ((!(__eliscript_truthy(lint_ignored_name_p(target))) && (((binding)["kind"] === "parameter") || (__eliscript_numeric_relation(">", (binding)["fnDepth"], 0) && __eliscript_numeric_relation("<", (binding)["fnDepth"], (scope)["fnDepth"]))))) {
2331
+ lint_emit(state, "ELI-L0006", form_span, (String("mutating parameter or captured binding with setq: ") + String(target)));
2332
+ }
2333
+ if ((__eliscript_truthy(value_node) && __eliscript_truthy(lint_transient_init_p(value_node)))) {
2334
+ ((binding)["isTransient"] = true);
2335
+ }
2336
+ }
2337
+ }
2338
+ }
2339
+ }
2340
+ ((index = (index + 2)));
2341
+ }
2342
+ return null;
2343
+ }
2344
+ }
2345
+ function lint_call(form, scope, tail, state) {
2346
+ {
2347
+ let items = node_items(form);
2348
+ let op_node = ((((items) ?? [])[0]) ?? null);
2349
+ let op = ((__eliscript_value_99) => (__eliscript_truthy(__eliscript_value_99) ? node_name(op_node) : __eliscript_value_99))(symbol_node_p(op_node));
2350
+ let args = (items)["slice"](1);
2351
+ let form_span = ((__eliscript_value_100) => (__eliscript_truthy(__eliscript_value_100) ? __eliscript_value_100 : (state)["currentSpan"]))(node_span(form));
2352
+ if (((op === "lambda") || (op === "fn") || (op === "async"))) {
2353
+ if (__eliscript_numeric_relation(">", (args)["length"], 0)) {
2354
+ return lint_function(((((args) ?? [])[0]) ?? null), (args)["slice"](1), scope, state);
2355
+ } else {
2356
+ return null;
2357
+ }
2358
+ } else {
2359
+ if ((op === "let")) {
2360
+ return lint_let(args, scope, false, tail, state);
2361
+ } else {
2362
+ if ((op === "let*")) {
2363
+ return lint_let(args, scope, true, tail, state);
2364
+ } else {
2365
+ if ((op === "loop")) {
2366
+ return lint_loop(args, scope, tail, state);
2367
+ } else {
2368
+ if (((op === "setq") || (op === "set!"))) {
2369
+ return lint_assignment(form_span, args, scope, state);
2370
+ } else {
2371
+ if ((op === "if")) {
2372
+ if ((__eliscript_numeric_relation(">", (args)["length"], 0) && __eliscript_truthy(lint_constant_condition_p(((((args) ?? [])[0]) ?? null))))) {
2373
+ lint_emit(state, "ELI-L0005", form_span, "constant condition in if expression");
2374
+ }
2375
+ if (__eliscript_numeric_relation(">", (args)["length"], 0)) {
2376
+ lint_expression(((((args) ?? [])[0]) ?? null), scope, null, state);
2377
+ {
2378
+ let index = 1;
2379
+ while (__eliscript_numeric_relation("<", index, (args)["length"])) {
2380
+ lint_expression(((((args) ?? [])[index]) ?? null), scope, tail, state);
2381
+ ((index = (index + 1)));
2382
+ }
2383
+ return null;
2384
+ }
2385
+ } else {
2386
+ return null;
2387
+ }
2388
+ } else {
2389
+ if (((op === "when") || (op === "unless"))) {
2390
+ if (__eliscript_numeric_relation(">", (args)["length"], 0)) {
2391
+ lint_expression(((((args) ?? [])[0]) ?? null), scope, null, state);
2392
+ return lint_sequence((args)["slice"](1), scope, tail, state);
2393
+ } else {
2394
+ return null;
2395
+ }
2396
+ } else {
2397
+ if (((op === "progn") || (op === "do"))) {
2398
+ if (((args)["length"] === 0)) {
2399
+ return lint_emit(state, "ELI-L0008", form_span, "empty progn/do expression");
2400
+ } else {
2401
+ return lint_sequence(args, scope, tail, state);
2402
+ }
2403
+ } else {
2404
+ if (((op === "and") || (op === "or"))) {
2405
+ return lint_sequence(args, scope, tail, state);
2406
+ } else {
2407
+ if ((op === "cond")) {
2408
+ return (args)["forEach"](((clause) => {
2409
+ {
2410
+ let c_items = list_items(clause);
2411
+ if ((!((c_items === undefined)) && __eliscript_numeric_relation(">", (c_items)["length"], 0))) {
2412
+ lint_expression(((((c_items) ?? [])[0]) ?? null), scope, null, state);
2413
+ return lint_sequence((c_items)["slice"](1), scope, tail, state);
2414
+ } else {
2415
+ return null;
2416
+ }
2417
+ }
2418
+ }));
2419
+ } else {
2420
+ if ((op === "try")) {
2421
+ return (args)["forEach"](((arg) => {
2422
+ {
2423
+ let aop = clause_operator(arg);
2424
+ if ((aop === "catch")) {
2425
+ {
2426
+ let c_items = list_items(arg);
2427
+ let pat = ((((c_items) ?? [])[1]) ?? null);
2428
+ let child = lint_make_scope(scope, (scope)["fnDepth"]);
2429
+ lint_pattern_defaults(pat, scope, state);
2430
+ lint_declare_pattern(child, pat, "catch", (child)["fnDepth"], true, state, true, false);
2431
+ lint_sequence((c_items)["slice"](2), child, tail, state);
2432
+ return lint_finalize_scope(child, state);
2433
+ }
2434
+ } else {
2435
+ if ((aop === "finally")) {
2436
+ return lint_sequence((list_items(arg))["slice"](1), scope, null, state);
2437
+ } else {
2438
+ return lint_expression(arg, scope, tail, state);
2439
+ }
2440
+ }
2441
+ }
2442
+ }));
2443
+ } else {
2444
+ if ((op === "hash-map")) {
2445
+ {
2446
+ let seen = new (globalThis.Set)();
2447
+ let index = 0;
2448
+ while (__eliscript_numeric_relation("<", index, (args)["length"])) {
2449
+ {
2450
+ let k = ((((args) ?? [])[index]) ?? null);
2451
+ let v = ((__eliscript_value_101) => (__eliscript_truthy(__eliscript_value_101) ? ((((args) ?? [])[(index + 1)]) ?? null) : __eliscript_value_101))(__eliscript_numeric_relation("<", (index + 1), (args)["length"]));
2452
+ if (__eliscript_truthy(k)) {
2453
+ {
2454
+ let canon = lint_literal_key(k);
2455
+ if (__eliscript_truthy(canon)) {
2456
+ if (__eliscript_truthy((seen)["has"](canon))) {
2457
+ lint_emit(state, "ELI-L0007", ((__eliscript_value_102) => (__eliscript_truthy(__eliscript_value_102) ? __eliscript_value_102 : form_span))(node_span(k)), (String("duplicate map literal key: ") + String(lint_key_display(k))));
2458
+ } else {
2459
+ (seen)["add"](canon);
2460
+ }
2461
+ }
2462
+ }
2463
+ lint_expression(k, scope, null, state);
2464
+ }
2465
+ if (__eliscript_truthy(v)) {
2466
+ lint_expression(v, scope, null, state);
2467
+ }
2468
+ }
2469
+ ((index = (index + 2)));
2470
+ }
2471
+ return null;
2472
+ }
2473
+ } else {
2474
+ if ((op === "hash-set")) {
2475
+ {
2476
+ let seen = new (globalThis.Set)();
2477
+ let index = 0;
2478
+ while (__eliscript_numeric_relation("<", index, (args)["length"])) {
2479
+ {
2480
+ let elem = ((((args) ?? [])[index]) ?? null);
2481
+ let canon = lint_literal_key(elem);
2482
+ if (__eliscript_truthy(canon)) {
2483
+ if (__eliscript_truthy((seen)["has"](canon))) {
2484
+ lint_emit(state, "ELI-L0007", ((__eliscript_value_103) => (__eliscript_truthy(__eliscript_value_103) ? __eliscript_value_103 : form_span))(node_span(elem)), (String("duplicate set literal element: ") + String(lint_key_display(elem))));
2485
+ } else {
2486
+ (seen)["add"](canon);
2487
+ }
2488
+ }
2489
+ lint_expression(elem, scope, null, state);
2490
+ }
2491
+ ((index = (index + 1)));
2492
+ }
2493
+ return null;
2494
+ }
2495
+ } else {
2496
+ if ((op === "js-object")) {
2497
+ {
2498
+ let index = 0;
2499
+ while (__eliscript_numeric_relation("<", index, (args)["length"])) {
2500
+ {
2501
+ let k = ((((args) ?? [])[index]) ?? null);
2502
+ let v = ((__eliscript_value_104) => (__eliscript_truthy(__eliscript_value_104) ? ((((args) ?? [])[(index + 1)]) ?? null) : __eliscript_value_104))(__eliscript_numeric_relation("<", (index + 1), (args)["length"]));
2503
+ if (__eliscript_truthy(k)) {
2504
+ if ((!(__eliscript_truthy(keyword_node_p(k)) || __eliscript_truthy(string_node_p(k)) || __eliscript_truthy(symbol_node_p(k))))) {
2505
+ lint_expression(k, scope, null, state);
2506
+ }
2507
+ }
2508
+ if (__eliscript_truthy(v)) {
2509
+ lint_expression(v, scope, null, state);
2510
+ }
2511
+ }
2512
+ ((index = (index + 2)));
2513
+ }
2514
+ return null;
2515
+ }
2516
+ } else {
2517
+ if (((op === "get") || (op === "put") || (op === "js-call"))) {
2518
+ if (__eliscript_numeric_relation(">", (args)["length"], 0)) {
2519
+ lint_expression(((((args) ?? [])[0]) ?? null), scope, null, state);
2520
+ if (__eliscript_numeric_relation(">", (args)["length"], 1)) {
2521
+ {
2522
+ let k = ((((args) ?? [])[1]) ?? null);
2523
+ if ((!(__eliscript_truthy(keyword_node_p(k)) || __eliscript_truthy(string_node_p(k))))) {
2524
+ lint_expression(k, scope, null, state);
2525
+ }
2526
+ }
2527
+ }
2528
+ {
2529
+ let index = 2;
2530
+ while (__eliscript_numeric_relation("<", index, (args)["length"])) {
2531
+ lint_expression(((((args) ?? [])[index]) ?? null), scope, null, state);
2532
+ ((index = (index + 1)));
2533
+ }
2534
+ return null;
2535
+ }
2536
+ } else {
2537
+ return null;
2538
+ }
2539
+ } else {
2540
+ if (((op === "quote") || (op === "js*"))) {
2541
+ return null;
2542
+ } else {
2543
+ {
2544
+ let is_builtin = ((__eliscript_value_105) => (__eliscript_truthy(__eliscript_value_105) ? ((__eliscript_tdz_ready_4 === true ? builtin_operator_set : __eliscript_tdz_error("builtin_operator_set")))["has"](op) : __eliscript_value_105))(op);
2545
+ if ((!__eliscript_truthy(is_builtin))) {
2546
+ lint_expression(op_node, scope, null, state);
2547
+ }
2548
+ if ((__eliscript_truthy(op) && !(__eliscript_truthy(is_builtin)))) {
2549
+ {
2550
+ let binding = lint_lookup(scope, op);
2551
+ let sig = ((__eliscript_value_106) => (__eliscript_truthy(__eliscript_value_106) ? ((__eliscript_value_107) => (__eliscript_truthy(__eliscript_value_107) ? ((__eliscript_value_108) => (__eliscript_truthy(__eliscript_value_108) ? ((state)["arities"])["get"](op) : __eliscript_value_108))(((binding)["fnDepth"] === 0)) : __eliscript_value_107))(((binding)["kind"] === "function")) : __eliscript_value_106))(binding);
2552
+ if (__eliscript_truthy(sig)) {
2553
+ {
2554
+ let min_a = (sig)["min"];
2555
+ let max_a = (sig)["max"];
2556
+ let argc = (args)["length"];
2557
+ if ((__eliscript_numeric_relation("<", argc, min_a) || (!((max_a === null)) && __eliscript_numeric_relation(">", argc, max_a)))) {
2558
+ lint_emit(state, "ELI-L0004", form_span, (String("function ") + String(op) + String(" expects ") + String(((max_a === null) ? (String("at least ") + String(min_a)) : ((min_a === max_a) ? (String(min_a)) : (String(min_a) + String("..") + String(max_a))))) + String(" arguments, got ") + String(argc)));
2559
+ }
2560
+ }
2561
+ }
2562
+ }
2563
+ }
2564
+ if ((__eliscript_truthy(op) && __eliscript_truthy(((__eliscript_tdz_ready_12 === true ? lint_transient_finalizers : __eliscript_tdz_error("lint_transient_finalizers")))["has"](op)) && __eliscript_numeric_relation(">", (args)["length"], 0))) {
2565
+ lint_mark_finalized_transient(((((args) ?? [])[0]) ?? null), scope);
2566
+ }
2567
+ {
2568
+ let index = 0;
2569
+ while (__eliscript_numeric_relation("<", index, (args)["length"])) {
2570
+ lint_expression(((((args) ?? [])[index]) ?? null), scope, null, state);
2571
+ ((index = (index + 1)));
2572
+ }
2573
+ return null;
2574
+ }
2575
+ }
2576
+ }
2577
+ }
2578
+ }
2579
+ }
2580
+ }
2581
+ }
2582
+ }
2583
+ }
2584
+ }
2585
+ }
2586
+ }
2587
+ }
2588
+ }
2589
+ }
2590
+ }
2591
+ }
2592
+ }
2593
+ }
2594
+ function lint_expression(form, scope, tail, state) {
2595
+ if (__eliscript_truthy(form)) {
2596
+ {
2597
+ let prev_span = (state)["currentSpan"];
2598
+ let span = ((__eliscript_value_109) => (__eliscript_truthy(__eliscript_value_109) ? __eliscript_value_109 : prev_span))(node_span(form));
2599
+ let kind = node_kind(form);
2600
+ ((state)["currentSpan"] = span);
2601
+ if (((kind === "literal") || (kind === "undefined") || (kind === "keyword"))) {
2602
+ null;
2603
+ } else {
2604
+ if ((kind === "symbol")) {
2605
+ {
2606
+ let name = node_name(form);
2607
+ if ((!__eliscript_truthy(qualified_name_p(name)))) {
2608
+ {
2609
+ let binding = lint_lookup(scope, name);
2610
+ if (__eliscript_truthy(binding)) {
2611
+ ((binding)["used"] = true);
2612
+ if (__eliscript_truthy((binding)["isTransient"])) {
2613
+ if (__eliscript_numeric_relation(">", (scope)["fnDepth"], (binding)["fnDepth"])) {
2614
+ ((binding)["transientEscaped"] = true);
2615
+ if ((!__eliscript_truthy((binding)["transientEscapeSpan"]))) {
2616
+ ((binding)["transientEscapeSpan"] = span);
2617
+ }
2618
+ } else {
2619
+ if (__eliscript_truthy(tail)) {
2620
+ ((binding)["transientEscaped"] = true);
2621
+ if ((!__eliscript_truthy((binding)["transientEscapeSpan"]))) {
2622
+ ((binding)["transientEscapeSpan"] = span);
2623
+ }
2624
+ } else {
2625
+
2626
+ }
2627
+ }
2628
+ }
2629
+ }
2630
+ }
2631
+ }
2632
+ }
2633
+ } else {
2634
+ if ((kind === "vector")) {
2635
+ {
2636
+ let items = node_items(form);
2637
+ let index = 0;
2638
+ while (__eliscript_numeric_relation("<", index, (items)["length"])) {
2639
+ lint_expression(((((items) ?? [])[index]) ?? null), scope, null, state);
2640
+ ((index = (index + 1)));
2641
+ }
2642
+ }
2643
+ } else {
2644
+ if ((kind === "list")) {
2645
+ lint_call(form, scope, tail, state);
2646
+ } else {
2647
+
2648
+ }
2649
+ }
2650
+ }
2651
+ }
2652
+ return ((state)["currentSpan"] = prev_span);
2653
+ }
2654
+ } else {
2655
+ return null;
2656
+ }
2657
+ }
2658
+ function lint_module(forms, filename, options = null) {
2659
+ {
2660
+ let diag_context = ({"filename": filename});
2661
+ let flattened = flatten_modules(forms, diag_context);
2662
+ let scope = lint_make_scope(null, 0);
2663
+ let arities = lint_collect_arities(flattened);
2664
+ let state = ({"filename": filename, "options": options, "arities": arities, "currentSpan": null, "diagnostics": []});
2665
+ (flattened)["forEach"](((form) => {
2666
+ if ((node_kind(form) === "list")) {
2667
+ {
2668
+ let items = node_items(form);
2669
+ let op = ((__eliscript_value_110) => (__eliscript_truthy(__eliscript_value_110) ? ((__eliscript_value_111) => (__eliscript_truthy(__eliscript_value_111) ? node_name(((((items) ?? [])[0]) ?? null)) : __eliscript_value_111))(symbol_node_p(((((items) ?? [])[0]) ?? null))) : __eliscript_value_110))(__eliscript_numeric_relation(">", (items)["length"], 0));
2670
+ let args = (items)["slice"](1);
2671
+ if (((op === "import") || (op === "import-portable"))) {
2672
+ return (import_bindings(args, diag_context, node_span(form), (op === "import-portable")))["forEach"](((name) => {
2673
+ return lint_declare(scope, name, "import", 0, false, state);
2674
+ }));
2675
+ } else {
2676
+ if ((op === "defvar")) {
2677
+ return lint_declare(scope, ((((args) ?? [])[0]) ?? null), "variable", 0, true, state);
2678
+ } else {
2679
+ if ((op === "defconst")) {
2680
+ return lint_declare(scope, ((((args) ?? [])[0]) ?? null), "constant", 0, false, state);
2681
+ } else {
2682
+ if (((op === "defun") || (op === "defn") || (op === "defportable") || (op === "defasync"))) {
2683
+ return lint_declare(scope, ((((args) ?? [])[0]) ?? null), "function", 0, false, state);
2684
+ } else {
2685
+ return null;
2686
+ }
2687
+ }
2688
+ }
2689
+ }
2690
+ }
2691
+ } else {
2692
+ return null;
2693
+ }
2694
+ }));
2695
+ (flattened)["forEach"](((form) => {
2696
+ {
2697
+ let prev_span = (state)["currentSpan"];
2698
+ ((state)["currentSpan"] = ((__eliscript_value_112) => (__eliscript_truthy(__eliscript_value_112) ? __eliscript_value_112 : prev_span))(node_span(form)));
2699
+ if (!((node_kind(form) === "list"))) {
2700
+ lint_expression(form, scope, null, state);
2701
+ } else {
2702
+ {
2703
+ let items = node_items(form);
2704
+ let op = ((__eliscript_value_113) => (__eliscript_truthy(__eliscript_value_113) ? ((__eliscript_value_114) => (__eliscript_truthy(__eliscript_value_114) ? node_name(((((items) ?? [])[0]) ?? null)) : __eliscript_value_114))(symbol_node_p(((((items) ?? [])[0]) ?? null))) : __eliscript_value_113))(__eliscript_numeric_relation(">", (items)["length"], 0));
2705
+ let args = (items)["slice"](1);
2706
+ if (((op === "import") || (op === "import-portable"))) {
2707
+ null;
2708
+ } else {
2709
+ if (((op === "defvar") || (op === "defconst"))) {
2710
+ if (__eliscript_numeric_relation(">", (args)["length"], 1)) {
2711
+ lint_expression(((((args) ?? [])[1]) ?? null), scope, null, state);
2712
+ }
2713
+ } else {
2714
+ if (((op === "defun") || (op === "defn") || (op === "defportable") || (op === "defasync"))) {
2715
+ if (__eliscript_numeric_relation(">=", (args)["length"], 2)) {
2716
+ lint_function(((((args) ?? [])[1]) ?? null), (args)["slice"](2), scope, state);
2717
+ }
2718
+ } else {
2719
+ if ((op === "export")) {
2720
+ (args)["forEach"](((name) => {
2721
+ if (__eliscript_truthy(symbol_node_p(name))) {
2722
+ {
2723
+ let binding = lint_lookup(scope, node_name(name));
2724
+ if (__eliscript_truthy(binding)) {
2725
+ return ((binding)["used"] = true);
2726
+ } else {
2727
+ return null;
2728
+ }
2729
+ }
2730
+ } else {
2731
+ return null;
2732
+ }
2733
+ }));
2734
+ } else {
2735
+ if ((op === "export-default")) {
2736
+ if (__eliscript_numeric_relation(">", (args)["length"], 0)) {
2737
+ lint_expression(((((args) ?? [])[0]) ?? null), scope, null, state);
2738
+ }
2739
+ } else {
2740
+ lint_expression(form, scope, null, state);
2741
+ }
2742
+ }
2743
+ }
2744
+ }
2745
+ }
2746
+ }
2747
+ }
2748
+ return ((state)["currentSpan"] = prev_span);
2749
+ }
2750
+ }));
2751
+ {
2752
+ let order = (scope)["order"];
2753
+ let index = 0;
2754
+ while (__eliscript_numeric_relation("<", index, (order)["length"])) {
2755
+ {
2756
+ let binding = ((((order) ?? [])[index]) ?? null);
2757
+ if ((((binding)["kind"] === "import") && !(__eliscript_truthy((binding)["used"])) && !(__eliscript_truthy(lint_ignored_name_p((binding)["name"]))))) {
2758
+ lint_emit(state, "ELI-L0002", (binding)["span"], (String("unused import binding: ") + String((binding)["name"])));
2759
+ }
2760
+ }
2761
+ ((index = (index + 1)));
2762
+ }
2763
+ }
2764
+ return ((state)["diagnostics"])["sort"](((left, right) => {
2765
+ {
2766
+ let sl = ((left)["location"])["start"];
2767
+ let sr = ((right)["location"])["start"];
2768
+ let ol = (__eliscript_truthy(sl) ? (sl)["offset"] : 0);
2769
+ let or_ = (__eliscript_truthy(sr) ? (sr)["offset"] : 0);
2770
+ if ((ol !== or_)) {
2771
+ return __eliscript_numeric_sub(ol, or_);
2772
+ } else {
2773
+ if (((left)["code"] !== (right)["code"])) {
2774
+ if (__eliscript_numeric_relation("<", (left)["code"], (right)["code"])) {
2775
+ return -1;
2776
+ } else {
2777
+ return 1;
2778
+ }
2779
+ } else {
2780
+ if (((left)["message"] !== (right)["message"])) {
2781
+ if (__eliscript_numeric_relation("<", (left)["message"], (right)["message"])) {
2782
+ return -1;
2783
+ } else {
2784
+ return 1;
2785
+ }
2786
+ } else {
2787
+ return 0;
2788
+ }
2789
+ }
2790
+ }
2791
+ }
2792
+ }));
2793
+ }
2794
+ }
2795
+ export {analyze_module, select_portable_module, lint_module};