@elaraai/east 0.0.1-beta.9 → 1.0.0

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 (410) hide show
  1. package/LICENSE.md +15 -666
  2. package/README.md +113 -88
  3. package/dist/src/analyze.d.ts +3 -0
  4. package/dist/src/analyze.d.ts.map +1 -1
  5. package/dist/src/analyze.js +223 -111
  6. package/dist/src/analyze.js.map +1 -1
  7. package/dist/src/analyze.spec.d.ts +2 -0
  8. package/dist/src/analyze.spec.d.ts.map +1 -0
  9. package/dist/src/analyze.spec.js +445 -0
  10. package/dist/src/analyze.spec.js.map +1 -0
  11. package/dist/src/ast.d.ts +54 -35
  12. package/dist/src/ast.d.ts.map +1 -1
  13. package/dist/src/ast_to_ir.coerce_to.spec.d.ts +15 -0
  14. package/dist/src/ast_to_ir.coerce_to.spec.d.ts.map +1 -0
  15. package/dist/src/ast_to_ir.coerce_to.spec.js +420 -0
  16. package/dist/src/ast_to_ir.coerce_to.spec.js.map +1 -0
  17. package/dist/src/ast_to_ir.d.ts +18 -4
  18. package/dist/src/ast_to_ir.d.ts.map +1 -1
  19. package/dist/src/ast_to_ir.js +233 -178
  20. package/dist/src/ast_to_ir.js.map +1 -1
  21. package/dist/src/builtins.d.ts +1 -1
  22. package/dist/src/builtins.d.ts.map +1 -1
  23. package/dist/src/builtins.js +194 -2
  24. package/dist/src/builtins.js.map +1 -1
  25. package/dist/src/comparison.d.ts +2 -2
  26. package/dist/src/comparison.d.ts.map +1 -1
  27. package/dist/src/comparison.js +115 -40
  28. package/dist/src/comparison.js.map +1 -1
  29. package/dist/src/comparison.spec.d.ts +2 -0
  30. package/dist/src/comparison.spec.d.ts.map +1 -0
  31. package/dist/src/comparison.spec.js +1200 -0
  32. package/dist/src/comparison.spec.js.map +1 -0
  33. package/dist/src/compile.d.ts +31 -9
  34. package/dist/src/compile.d.ts.map +1 -1
  35. package/dist/src/compile.js +1048 -548
  36. package/dist/src/compile.js.map +1 -1
  37. package/dist/src/containers/matrix.d.ts +15 -0
  38. package/dist/src/containers/matrix.d.ts.map +1 -0
  39. package/dist/src/containers/matrix.js +15 -0
  40. package/dist/src/containers/matrix.js.map +1 -0
  41. package/dist/src/containers/ref.d.ts.map +1 -1
  42. package/dist/src/containers/ref.js +1 -1
  43. package/dist/src/containers/ref.js.map +1 -1
  44. package/dist/src/containers/sortedmap.spec.d.ts +2 -0
  45. package/dist/src/containers/sortedmap.spec.d.ts.map +1 -0
  46. package/dist/src/containers/sortedmap.spec.js +180 -0
  47. package/dist/src/containers/sortedmap.spec.js.map +1 -0
  48. package/dist/src/containers/sortedset.spec.d.ts +2 -0
  49. package/dist/src/containers/sortedset.spec.d.ts.map +1 -0
  50. package/dist/src/containers/sortedset.spec.js +228 -0
  51. package/dist/src/containers/sortedset.spec.js.map +1 -0
  52. package/dist/src/containers/variant.d.ts.map +1 -1
  53. package/dist/src/containers/variant.js +1 -1
  54. package/dist/src/containers/variant.js.map +1 -1
  55. package/dist/src/containers/variant.spec.d.ts +2 -0
  56. package/dist/src/containers/variant.spec.d.ts.map +1 -0
  57. package/dist/src/containers/variant.spec.js +217 -0
  58. package/dist/src/containers/variant.spec.js.map +1 -0
  59. package/dist/src/datetime_format/parse.spec.d.ts +6 -0
  60. package/dist/src/datetime_format/parse.spec.d.ts.map +1 -0
  61. package/dist/src/datetime_format/parse.spec.js +379 -0
  62. package/dist/src/datetime_format/parse.spec.js.map +1 -0
  63. package/dist/src/datetime_format/print.spec.d.ts +6 -0
  64. package/dist/src/datetime_format/print.spec.d.ts.map +1 -0
  65. package/dist/src/datetime_format/print.spec.js +257 -0
  66. package/dist/src/datetime_format/print.spec.js.map +1 -0
  67. package/dist/src/datetime_format/tokenize.spec.d.ts +2 -0
  68. package/dist/src/datetime_format/tokenize.spec.d.ts.map +1 -0
  69. package/dist/src/datetime_format/tokenize.spec.js +508 -0
  70. package/dist/src/datetime_format/tokenize.spec.js.map +1 -0
  71. package/dist/src/datetime_format/types.d.ts +23 -23
  72. package/dist/src/default.d.ts.map +1 -1
  73. package/dist/src/default.js +33 -0
  74. package/dist/src/default.js.map +1 -1
  75. package/dist/src/default.spec.d.ts +2 -0
  76. package/dist/src/default.spec.d.ts.map +1 -0
  77. package/dist/src/default.spec.js +178 -0
  78. package/dist/src/default.spec.js.map +1 -0
  79. package/dist/src/eastir.d.ts +7 -0
  80. package/dist/src/eastir.d.ts.map +1 -1
  81. package/dist/src/eastir.js +55 -7
  82. package/dist/src/eastir.js.map +1 -1
  83. package/dist/src/error.d.ts +14 -4
  84. package/dist/src/error.d.ts.map +1 -1
  85. package/dist/src/error.js +28 -3
  86. package/dist/src/error.js.map +1 -1
  87. package/dist/src/example.d.ts +87 -0
  88. package/dist/src/example.d.ts.map +1 -0
  89. package/dist/src/example.js +18 -0
  90. package/dist/src/example.js.map +1 -0
  91. package/dist/src/expr/array.d.ts +43 -1
  92. package/dist/src/expr/array.d.ts.map +1 -1
  93. package/dist/src/expr/array.js +103 -53
  94. package/dist/src/expr/array.js.map +1 -1
  95. package/dist/src/expr/ast.d.ts +1 -1
  96. package/dist/src/expr/ast.d.ts.map +1 -1
  97. package/dist/src/expr/ast.js +112 -54
  98. package/dist/src/expr/ast.js.map +1 -1
  99. package/dist/src/expr/asyncfunction.d.ts.map +1 -1
  100. package/dist/src/expr/asyncfunction.js +6 -4
  101. package/dist/src/expr/asyncfunction.js.map +1 -1
  102. package/dist/src/expr/blob.d.ts +48 -0
  103. package/dist/src/expr/blob.d.ts.map +1 -1
  104. package/dist/src/expr/blob.js +63 -8
  105. package/dist/src/expr/blob.js.map +1 -1
  106. package/dist/src/expr/block.d.ts +213 -12
  107. package/dist/src/expr/block.d.ts.map +1 -1
  108. package/dist/src/expr/block.js +796 -293
  109. package/dist/src/expr/block.js.map +1 -1
  110. package/dist/src/expr/boolean.d.ts +44 -0
  111. package/dist/src/expr/boolean.d.ts.map +1 -1
  112. package/dist/src/expr/boolean.js +58 -6
  113. package/dist/src/expr/boolean.js.map +1 -1
  114. package/dist/src/expr/datetime.d.ts +135 -0
  115. package/dist/src/expr/datetime.d.ts.map +1 -1
  116. package/dist/src/expr/datetime.js +184 -34
  117. package/dist/src/expr/datetime.js.map +1 -1
  118. package/dist/src/expr/dict.d.ts +47 -2
  119. package/dist/src/expr/dict.d.ts.map +1 -1
  120. package/dist/src/expr/dict.js +122 -61
  121. package/dist/src/expr/dict.js.map +1 -1
  122. package/dist/src/expr/expr.d.ts +3 -1
  123. package/dist/src/expr/expr.d.ts.map +1 -1
  124. package/dist/src/expr/expr.js +4 -3
  125. package/dist/src/expr/expr.js.map +1 -1
  126. package/dist/src/expr/float.d.ts +153 -0
  127. package/dist/src/expr/float.d.ts.map +1 -1
  128. package/dist/src/expr/float.js +191 -17
  129. package/dist/src/expr/float.js.map +1 -1
  130. package/dist/src/expr/function.d.ts +7 -2
  131. package/dist/src/expr/function.d.ts.map +1 -1
  132. package/dist/src/expr/function.js +6 -4
  133. package/dist/src/expr/function.js.map +1 -1
  134. package/dist/src/expr/index.d.ts +186 -2
  135. package/dist/src/expr/index.d.ts.map +1 -1
  136. package/dist/src/expr/index.js +183 -2
  137. package/dist/src/expr/index.js.map +1 -1
  138. package/dist/src/expr/integer.d.ts +180 -0
  139. package/dist/src/expr/integer.d.ts.map +1 -1
  140. package/dist/src/expr/integer.js +189 -18
  141. package/dist/src/expr/integer.js.map +1 -1
  142. package/dist/src/expr/libs/array.js +3 -3
  143. package/dist/src/expr/libs/array.js.map +1 -1
  144. package/dist/src/expr/libs/blob.js +3 -3
  145. package/dist/src/expr/libs/blob.js.map +1 -1
  146. package/dist/src/expr/libs/dict.js +1 -1
  147. package/dist/src/expr/libs/dict.js.map +1 -1
  148. package/dist/src/expr/libs/matrix.d.ts +17 -0
  149. package/dist/src/expr/libs/matrix.d.ts.map +1 -0
  150. package/dist/src/expr/libs/matrix.js +60 -0
  151. package/dist/src/expr/libs/matrix.js.map +1 -0
  152. package/dist/src/expr/libs/set.js +1 -1
  153. package/dist/src/expr/libs/set.js.map +1 -1
  154. package/dist/src/expr/libs/string.d.ts.map +1 -1
  155. package/dist/src/expr/libs/string.js +2 -1
  156. package/dist/src/expr/libs/string.js.map +1 -1
  157. package/dist/src/expr/libs/vector.d.ts +16 -0
  158. package/dist/src/expr/libs/vector.d.ts.map +1 -0
  159. package/dist/src/expr/libs/vector.js +44 -0
  160. package/dist/src/expr/libs/vector.js.map +1 -0
  161. package/dist/src/expr/matrix.d.ts +109 -0
  162. package/dist/src/expr/matrix.d.ts.map +1 -0
  163. package/dist/src/expr/matrix.js +224 -0
  164. package/dist/src/expr/matrix.js.map +1 -0
  165. package/dist/src/expr/recursive.d.ts +83 -0
  166. package/dist/src/expr/recursive.d.ts.map +1 -0
  167. package/dist/src/expr/recursive.js +99 -0
  168. package/dist/src/expr/recursive.js.map +1 -0
  169. package/dist/src/expr/ref.js +5 -5
  170. package/dist/src/expr/ref.js.map +1 -1
  171. package/dist/src/expr/set.d.ts +44 -2
  172. package/dist/src/expr/set.d.ts.map +1 -1
  173. package/dist/src/expr/set.js +102 -52
  174. package/dist/src/expr/set.js.map +1 -1
  175. package/dist/src/expr/string.d.ts +134 -0
  176. package/dist/src/expr/string.d.ts.map +1 -1
  177. package/dist/src/expr/string.js +173 -23
  178. package/dist/src/expr/string.js.map +1 -1
  179. package/dist/src/expr/struct.d.ts +1 -1
  180. package/dist/src/expr/struct.d.ts.map +1 -1
  181. package/dist/src/expr/struct.js +2 -2
  182. package/dist/src/expr/struct.js.map +1 -1
  183. package/dist/src/expr/types.d.ts +12 -9
  184. package/dist/src/expr/types.d.ts.map +1 -1
  185. package/dist/src/expr/variant.d.ts +108 -11
  186. package/dist/src/expr/variant.d.ts.map +1 -1
  187. package/dist/src/expr/variant.js +76 -38
  188. package/dist/src/expr/variant.js.map +1 -1
  189. package/dist/src/expr/vector.d.ts +102 -0
  190. package/dist/src/expr/vector.d.ts.map +1 -0
  191. package/dist/src/expr/vector.js +202 -0
  192. package/dist/src/expr/vector.js.map +1 -0
  193. package/dist/src/fuzz.d.ts +36 -2
  194. package/dist/src/fuzz.d.ts.map +1 -1
  195. package/dist/src/fuzz.js +409 -77
  196. package/dist/src/fuzz.js.map +1 -1
  197. package/dist/src/index.d.ts +4 -0
  198. package/dist/src/index.d.ts.map +1 -1
  199. package/dist/src/index.js +4 -0
  200. package/dist/src/index.js.map +1 -1
  201. package/dist/src/internal.d.ts +12 -2
  202. package/dist/src/internal.d.ts.map +1 -1
  203. package/dist/src/internal.js +13 -2
  204. package/dist/src/internal.js.map +1 -1
  205. package/dist/src/ir.d.ts +1754 -1484
  206. package/dist/src/ir.d.ts.map +1 -1
  207. package/dist/src/ir.js +51 -34
  208. package/dist/src/ir.js.map +1 -1
  209. package/dist/src/ir.spec.d.ts +2 -0
  210. package/dist/src/ir.spec.d.ts.map +1 -0
  211. package/dist/src/ir.spec.js +35 -0
  212. package/dist/src/ir.spec.js.map +1 -0
  213. package/dist/src/location.d.ts +56 -17
  214. package/dist/src/location.d.ts.map +1 -1
  215. package/dist/src/location.js +226 -29
  216. package/dist/src/location.js.map +1 -1
  217. package/dist/src/location.spec.d.ts +2 -0
  218. package/dist/src/location.spec.d.ts.map +1 -0
  219. package/dist/src/location.spec.js +102 -0
  220. package/dist/src/location.spec.js.map +1 -0
  221. package/dist/src/patch/apply.d.ts +15 -0
  222. package/dist/src/patch/apply.d.ts.map +1 -0
  223. package/dist/src/patch/apply.js +352 -0
  224. package/dist/src/patch/apply.js.map +1 -0
  225. package/dist/src/patch/compose.d.ts +15 -0
  226. package/dist/src/patch/compose.d.ts.map +1 -0
  227. package/dist/src/patch/compose.js +448 -0
  228. package/dist/src/patch/compose.js.map +1 -0
  229. package/dist/src/patch/diff.d.ts +15 -0
  230. package/dist/src/patch/diff.d.ts.map +1 -0
  231. package/dist/src/patch/diff.js +347 -0
  232. package/dist/src/patch/diff.js.map +1 -0
  233. package/dist/src/patch/fuzz.d.ts +73 -0
  234. package/dist/src/patch/fuzz.d.ts.map +1 -0
  235. package/dist/src/patch/fuzz.js +159 -0
  236. package/dist/src/patch/fuzz.js.map +1 -0
  237. package/dist/src/patch/index.d.ts +32 -0
  238. package/dist/src/patch/index.d.ts.map +1 -0
  239. package/dist/src/patch/index.js +48 -0
  240. package/dist/src/patch/index.js.map +1 -0
  241. package/dist/src/patch/invert.d.ts +15 -0
  242. package/dist/src/patch/invert.d.ts.map +1 -0
  243. package/dist/src/patch/invert.js +284 -0
  244. package/dist/src/patch/invert.js.map +1 -0
  245. package/dist/src/patch/merge.d.ts +56 -0
  246. package/dist/src/patch/merge.d.ts.map +1 -0
  247. package/dist/src/patch/merge.js +586 -0
  248. package/dist/src/patch/merge.js.map +1 -0
  249. package/dist/src/patch/merge.spec.d.ts +2 -0
  250. package/dist/src/patch/merge.spec.d.ts.map +1 -0
  251. package/dist/src/patch/merge.spec.js +1139 -0
  252. package/dist/src/patch/merge.spec.js.map +1 -0
  253. package/dist/src/patch/patch.spec.d.ts +2 -0
  254. package/dist/src/patch/patch.spec.d.ts.map +1 -0
  255. package/dist/src/patch/patch.spec.js +452 -0
  256. package/dist/src/patch/patch.spec.js.map +1 -0
  257. package/dist/src/patch/path.d.ts +115 -0
  258. package/dist/src/patch/path.d.ts.map +1 -0
  259. package/dist/src/patch/path.js +192 -0
  260. package/dist/src/patch/path.js.map +1 -0
  261. package/dist/src/patch/path.spec.d.ts +6 -0
  262. package/dist/src/patch/path.spec.d.ts.map +1 -0
  263. package/dist/src/patch/path.spec.js +322 -0
  264. package/dist/src/patch/path.spec.js.map +1 -0
  265. package/dist/src/patch/prune.d.ts +77 -0
  266. package/dist/src/patch/prune.d.ts.map +1 -0
  267. package/dist/src/patch/prune.js +115 -0
  268. package/dist/src/patch/prune.js.map +1 -0
  269. package/dist/src/patch/prune.spec.d.ts +6 -0
  270. package/dist/src/patch/prune.spec.d.ts.map +1 -0
  271. package/dist/src/patch/prune.spec.js +473 -0
  272. package/dist/src/patch/prune.spec.js.map +1 -0
  273. package/dist/src/patch/type_of_patch.d.ts +25 -0
  274. package/dist/src/patch/type_of_patch.d.ts.map +1 -0
  275. package/dist/src/patch/type_of_patch.js +144 -0
  276. package/dist/src/patch/type_of_patch.js.map +1 -0
  277. package/dist/src/patch/types.d.ts +220 -0
  278. package/dist/src/patch/types.d.ts.map +1 -0
  279. package/dist/src/patch/types.js +62 -0
  280. package/dist/src/patch/types.js.map +1 -0
  281. package/dist/src/patch/validate.d.ts +44 -0
  282. package/dist/src/patch/validate.d.ts.map +1 -0
  283. package/dist/src/patch/validate.js +190 -0
  284. package/dist/src/patch/validate.js.map +1 -0
  285. package/dist/src/patch/validate.spec.d.ts +6 -0
  286. package/dist/src/patch/validate.spec.d.ts.map +1 -0
  287. package/dist/src/patch/validate.spec.js +225 -0
  288. package/dist/src/patch/validate.spec.js.map +1 -0
  289. package/dist/src/patch/walk.d.ts +121 -0
  290. package/dist/src/patch/walk.d.ts.map +1 -0
  291. package/dist/src/patch/walk.js +385 -0
  292. package/dist/src/patch/walk.js.map +1 -0
  293. package/dist/src/patch/walk.spec.d.ts +6 -0
  294. package/dist/src/patch/walk.spec.d.ts.map +1 -0
  295. package/dist/src/patch/walk.spec.js +621 -0
  296. package/dist/src/patch/walk.spec.js.map +1 -0
  297. package/dist/src/platform.d.ts +6 -0
  298. package/dist/src/platform.d.ts.map +1 -1
  299. package/dist/src/platform.spec.d.ts +2 -0
  300. package/dist/src/platform.spec.d.ts.map +1 -0
  301. package/dist/src/platform.spec.js +330 -0
  302. package/dist/src/platform.spec.js.map +1 -0
  303. package/dist/src/serialization/beast.d.ts.map +1 -1
  304. package/dist/src/serialization/beast.js +12 -0
  305. package/dist/src/serialization/beast.js.map +1 -1
  306. package/dist/src/serialization/beast.spec.d.ts +6 -0
  307. package/dist/src/serialization/beast.spec.d.ts.map +1 -0
  308. package/dist/src/serialization/beast.spec.js +406 -0
  309. package/dist/src/serialization/beast.spec.js.map +1 -0
  310. package/dist/src/serialization/beast2/index.d.ts +50 -0
  311. package/dist/src/serialization/beast2/index.d.ts.map +1 -0
  312. package/dist/src/serialization/beast2/index.js +756 -0
  313. package/dist/src/serialization/beast2/index.js.map +1 -0
  314. package/dist/src/serialization/beast2/index.spec.d.ts +6 -0
  315. package/dist/src/serialization/beast2/index.spec.d.ts.map +1 -0
  316. package/dist/src/serialization/beast2/index.spec.js +528 -0
  317. package/dist/src/serialization/beast2/index.spec.js.map +1 -0
  318. package/dist/src/serialization/beast2/sourcemap-table.d.ts +29 -0
  319. package/dist/src/serialization/beast2/sourcemap-table.d.ts.map +1 -0
  320. package/dist/src/serialization/beast2/sourcemap-table.js +82 -0
  321. package/dist/src/serialization/beast2/sourcemap-table.js.map +1 -0
  322. package/dist/src/serialization/beast2/string-table.d.ts +16 -0
  323. package/dist/src/serialization/beast2/string-table.d.ts.map +1 -0
  324. package/dist/src/serialization/beast2/string-table.js +38 -0
  325. package/dist/src/serialization/beast2/string-table.js.map +1 -0
  326. package/dist/src/serialization/beast2/type-table.d.ts +86 -0
  327. package/dist/src/serialization/beast2/type-table.d.ts.map +1 -0
  328. package/dist/src/serialization/beast2/type-table.js +618 -0
  329. package/dist/src/serialization/beast2/type-table.js.map +1 -0
  330. package/dist/src/serialization/beast2/value-table.d.ts +40 -0
  331. package/dist/src/serialization/beast2/value-table.d.ts.map +1 -0
  332. package/dist/src/serialization/beast2/value-table.js +157 -0
  333. package/dist/src/serialization/beast2/value-table.js.map +1 -0
  334. package/dist/src/serialization/binary-utils.d.ts +33 -0
  335. package/dist/src/serialization/binary-utils.d.ts.map +1 -1
  336. package/dist/src/serialization/binary-utils.js +157 -0
  337. package/dist/src/serialization/binary-utils.js.map +1 -1
  338. package/dist/src/serialization/csv.d.ts +17 -17
  339. package/dist/src/serialization/csv.d.ts.map +1 -1
  340. package/dist/src/serialization/csv.js +10 -8
  341. package/dist/src/serialization/csv.js.map +1 -1
  342. package/dist/src/serialization/csv.spec.d.ts +2 -0
  343. package/dist/src/serialization/csv.spec.d.ts.map +1 -0
  344. package/dist/src/serialization/csv.spec.js +556 -0
  345. package/dist/src/serialization/csv.spec.js.map +1 -0
  346. package/dist/src/serialization/east-inferred.spec.d.ts +2 -0
  347. package/dist/src/serialization/east-inferred.spec.d.ts.map +1 -0
  348. package/dist/src/serialization/east-inferred.spec.js +322 -0
  349. package/dist/src/serialization/east-inferred.spec.js.map +1 -0
  350. package/dist/src/serialization/east.d.ts +1 -1
  351. package/dist/src/serialization/east.d.ts.map +1 -1
  352. package/dist/src/serialization/east.js +178 -26
  353. package/dist/src/serialization/east.js.map +1 -1
  354. package/dist/src/serialization/east.spec.d.ts +2 -0
  355. package/dist/src/serialization/east.spec.d.ts.map +1 -0
  356. package/dist/src/serialization/east.spec.js +1548 -0
  357. package/dist/src/serialization/east.spec.js.map +1 -0
  358. package/dist/src/serialization/index.d.ts +1 -2
  359. package/dist/src/serialization/index.d.ts.map +1 -1
  360. package/dist/src/serialization/index.js +1 -2
  361. package/dist/src/serialization/index.js.map +1 -1
  362. package/dist/src/serialization/json.d.ts +1 -1
  363. package/dist/src/serialization/json.d.ts.map +1 -1
  364. package/dist/src/serialization/json.js +123 -24
  365. package/dist/src/serialization/json.js.map +1 -1
  366. package/dist/src/serialization/json.spec.d.ts +2 -0
  367. package/dist/src/serialization/json.spec.d.ts.map +1 -0
  368. package/dist/src/serialization/json.spec.js +1297 -0
  369. package/dist/src/serialization/json.spec.js.map +1 -0
  370. package/dist/src/type_of_type.d.ts +72 -35
  371. package/dist/src/type_of_type.d.ts.map +1 -1
  372. package/dist/src/type_of_type.is_data.spec.d.ts +6 -0
  373. package/dist/src/type_of_type.is_data.spec.d.ts.map +1 -0
  374. package/dist/src/type_of_type.is_data.spec.js +221 -0
  375. package/dist/src/type_of_type.is_data.spec.js.map +1 -0
  376. package/dist/src/type_of_type.js +355 -80
  377. package/dist/src/type_of_type.js.map +1 -1
  378. package/dist/src/type_of_type.to_etv.spec.d.ts +6 -0
  379. package/dist/src/type_of_type.to_etv.spec.d.ts.map +1 -0
  380. package/dist/src/type_of_type.to_etv.spec.js +263 -0
  381. package/dist/src/type_of_type.to_etv.spec.js.map +1 -0
  382. package/dist/src/types.d.ts +82 -12
  383. package/dist/src/types.d.ts.map +1 -1
  384. package/dist/src/types.error.spec.d.ts +2 -0
  385. package/dist/src/types.error.spec.d.ts.map +1 -0
  386. package/dist/src/types.error.spec.js +665 -0
  387. package/dist/src/types.error.spec.js.map +1 -0
  388. package/dist/src/types.js +663 -156
  389. package/dist/src/types.js.map +1 -1
  390. package/dist/src/types.spec.d.ts +2 -0
  391. package/dist/src/types.spec.d.ts.map +1 -0
  392. package/dist/src/types.spec.js +946 -0
  393. package/dist/src/types.spec.js.map +1 -0
  394. package/dist/src/walker.d.ts +65 -0
  395. package/dist/src/walker.d.ts.map +1 -0
  396. package/dist/src/walker.js +165 -0
  397. package/dist/src/walker.js.map +1 -0
  398. package/dist/src/walker.spec.d.ts +6 -0
  399. package/dist/src/walker.spec.d.ts.map +1 -0
  400. package/dist/src/walker.spec.js +109 -0
  401. package/dist/src/walker.spec.js.map +1 -0
  402. package/package.json +16 -38
  403. package/dist/src/serialization/beast2-stream.d.ts +0 -38
  404. package/dist/src/serialization/beast2-stream.d.ts.map +0 -1
  405. package/dist/src/serialization/beast2-stream.js +0 -670
  406. package/dist/src/serialization/beast2-stream.js.map +0 -1
  407. package/dist/src/serialization/beast2.d.ts +0 -41
  408. package/dist/src/serialization/beast2.d.ts.map +0 -1
  409. package/dist/src/serialization/beast2.js +0 -495
  410. package/dist/src/serialization/beast2.js.map +0 -1
@@ -1,6 +1,7 @@
1
- import { get_location } from "../location.js";
1
+ import { get_location_id } from "../location.js";
2
2
  import { DictType, BooleanType, FunctionType, IntegerType, NullType, OptionType, SetType, NeverType, VariantType, printType, FloatType, isTypeEqual, ArrayType } from "../types.js";
3
3
  import { valueOrExprToAst, valueOrExprToAstTyped } from "./ast.js";
4
+ import { equal, notEqual } from "./block.js";
4
5
  import { AstSymbol, Expr, FactorySymbol, TypeSymbol } from "./expr.js";
5
6
  import { none, some } from "../containers/variant.js";
6
7
  /**
@@ -61,7 +62,7 @@ export class DictExpr extends Expr {
61
62
  return this[FactorySymbol]({
62
63
  ast_type: "Builtin",
63
64
  type: IntegerType,
64
- location: get_location(2),
65
+ loc_id: get_location_id(),
65
66
  builtin: "DictSize",
66
67
  type_parameters: [this.key_type, this.value_type],
67
68
  arguments: [this[AstSymbol]],
@@ -89,7 +90,7 @@ export class DictExpr extends Expr {
89
90
  return this[FactorySymbol]({
90
91
  ast_type: "Builtin",
91
92
  type: BooleanType,
92
- location: get_location(2),
93
+ loc_id: get_location_id(),
93
94
  builtin: "DictHas",
94
95
  type_parameters: [this.key_type, this.value_type],
95
96
  arguments: [this[AstSymbol], keyAst],
@@ -135,7 +136,7 @@ export class DictExpr extends Expr {
135
136
  return this[FactorySymbol]({
136
137
  ast_type: "Builtin",
137
138
  type: this.value_type,
138
- location: get_location(2),
139
+ loc_id: get_location_id(),
139
140
  builtin: "DictGet",
140
141
  type_parameters: [this.key_type, this.value_type],
141
142
  arguments: [this[AstSymbol], keyAst],
@@ -147,7 +148,7 @@ export class DictExpr extends Expr {
147
148
  return this[FactorySymbol]({
148
149
  ast_type: "Builtin",
149
150
  type: this.value_type,
150
- location: get_location(2),
151
+ loc_id: get_location_id(),
151
152
  builtin: "DictGetOrDefault",
152
153
  type_parameters: [this.key_type, this.value_type],
153
154
  arguments: [this[AstSymbol], keyAst, onMissingAst],
@@ -192,7 +193,7 @@ export class DictExpr extends Expr {
192
193
  return this[FactorySymbol]({
193
194
  ast_type: "Builtin",
194
195
  type: OptionType(this.value_type),
195
- location: get_location(2),
196
+ loc_id: get_location_id(),
196
197
  builtin: "DictTryGet",
197
198
  type_parameters: [this.key_type, this.value_type],
198
199
  arguments: [this[AstSymbol], keyAst],
@@ -229,7 +230,7 @@ export class DictExpr extends Expr {
229
230
  return this[FactorySymbol]({
230
231
  ast_type: "Builtin",
231
232
  type: NullType,
232
- location: get_location(2),
233
+ loc_id: get_location_id(),
233
234
  builtin: "DictInsert",
234
235
  type_parameters: [this.key_type, this.value_type],
235
236
  arguments: [this[AstSymbol], keyAst, valueAst],
@@ -238,14 +239,17 @@ export class DictExpr extends Expr {
238
239
  /**
239
240
  * Inserts or updates a key-value pair in the dictionary.
240
241
  *
241
- * If the key already exists, the value is overwritten with the provided value. This operation is idempotent.
242
+ * If the key does not exist, inserts the value. If the key already exists, the value is replaced by default,
243
+ * or resolved using the optional `onConflict` handler.
242
244
  *
243
245
  * @param key - The key to insert or update
244
246
  * @param value - The new value to associate with the key
247
+ * @param onConflict - Optional conflict handler called with (existing, new, key) when the key already exists; if omitted, the new value overwrites the existing one
245
248
  * @returns A NullExpr
246
249
  *
247
250
  * @see {@link insert} for inserting only (errors on duplicate)
248
251
  * @see {@link update} for updating only (errors on missing key)
252
+ * @see {@link merge} to update based on the existing value
249
253
  *
250
254
  * @example
251
255
  * ```ts
@@ -259,16 +263,24 @@ export class DictExpr extends Expr {
259
263
  * compiled(dict, "a", 10n); // dict now has Map([["a", 10n], ["b", 2n]])
260
264
  * ```
261
265
  */
262
- insertOrUpdate(key, value) {
266
+ insertOrUpdate(key, value, onConflict) {
263
267
  const keyAst = valueOrExprToAstTyped(key, this.key_type);
264
268
  const valueAst = valueOrExprToAstTyped(value, this.value_type);
269
+ let onConflictExpr;
270
+ if (onConflict === undefined) {
271
+ // Default: replace existing with new value
272
+ onConflictExpr = Expr.function([this.value_type, this.value_type, this.key_type], this.value_type, (_$, _existing, newValue) => newValue);
273
+ }
274
+ else {
275
+ onConflictExpr = Expr.from(onConflict, FunctionType([this.value_type, this.value_type, this.key_type], this.value_type));
276
+ }
265
277
  return this[FactorySymbol]({
266
278
  ast_type: "Builtin",
267
279
  type: NullType,
268
- location: get_location(2),
280
+ loc_id: get_location_id(),
269
281
  builtin: "DictInsertOrUpdate",
270
282
  type_parameters: [this.key_type, this.value_type],
271
- arguments: [this[AstSymbol], keyAst, valueAst],
283
+ arguments: [this[AstSymbol], keyAst, valueAst, Expr.ast(onConflictExpr)],
272
284
  });
273
285
  }
274
286
  /**
@@ -302,7 +314,7 @@ export class DictExpr extends Expr {
302
314
  return this[FactorySymbol]({
303
315
  ast_type: "Builtin",
304
316
  type: NullType,
305
- location: get_location(2),
317
+ loc_id: get_location_id(),
306
318
  builtin: "DictUpdate",
307
319
  type_parameters: [this.key_type, this.value_type],
308
320
  arguments: [this[AstSymbol], keyAst, valueAst],
@@ -358,7 +370,7 @@ export class DictExpr extends Expr {
358
370
  let initialExpr;
359
371
  if (initialFn === undefined) {
360
372
  // Default: create function that throws error
361
- initialExpr = Expr.function([this.key_type], this.value_type, ($, key) => $.error(Expr.str `Key ${key} not found in dictionary`, get_location(2)));
373
+ initialExpr = Expr.function([this.key_type], this.value_type, ($, key) => $.error(Expr.str `Key ${key} not found in dictionary`, get_location_id()));
362
374
  }
363
375
  else {
364
376
  initialExpr = Expr.from(initialFn, FunctionType([this.key_type], this.value_type));
@@ -366,7 +378,7 @@ export class DictExpr extends Expr {
366
378
  return this[FactorySymbol]({
367
379
  ast_type: "Builtin",
368
380
  type: NullType,
369
- location: get_location(2),
381
+ loc_id: get_location_id(),
370
382
  builtin: "DictMerge",
371
383
  type_parameters: [this.key_type, this.value_type, value2Type],
372
384
  arguments: [this[AstSymbol], keyAst, valueAst, Expr.ast(updateFnExpr), Expr.ast(initialExpr)],
@@ -403,7 +415,7 @@ export class DictExpr extends Expr {
403
415
  return this[FactorySymbol]({
404
416
  ast_type: "Builtin",
405
417
  type: this.value_type,
406
- location: get_location(2),
418
+ loc_id: get_location_id(),
407
419
  builtin: "DictGetOrInsert",
408
420
  type_parameters: [this.key_type, this.value_type],
409
421
  arguments: [this[AstSymbol], keyAst, Expr.ast(defaultValueExpr)],
@@ -438,7 +450,7 @@ export class DictExpr extends Expr {
438
450
  return this[FactorySymbol]({
439
451
  ast_type: "Builtin",
440
452
  type: NullType,
441
- location: get_location(2),
453
+ loc_id: get_location_id(),
442
454
  builtin: "DictDelete",
443
455
  type_parameters: [this.key_type, this.value_type],
444
456
  arguments: [this[AstSymbol], keyAst],
@@ -469,7 +481,7 @@ export class DictExpr extends Expr {
469
481
  return this[FactorySymbol]({
470
482
  ast_type: "Builtin",
471
483
  type: BooleanType,
472
- location: get_location(2),
484
+ loc_id: get_location_id(),
473
485
  builtin: "DictTryDelete",
474
486
  type_parameters: [this.key_type, this.value_type],
475
487
  arguments: [this[AstSymbol], keyAst],
@@ -502,7 +514,7 @@ export class DictExpr extends Expr {
502
514
  return this[FactorySymbol]({
503
515
  ast_type: "Builtin",
504
516
  type: this.value_type,
505
- location: get_location(2),
517
+ loc_id: get_location_id(),
506
518
  builtin: "DictPop",
507
519
  type_parameters: [this.key_type, this.value_type],
508
520
  arguments: [this[AstSymbol], keyAst],
@@ -537,7 +549,7 @@ export class DictExpr extends Expr {
537
549
  return this[FactorySymbol]({
538
550
  ast_type: "Builtin",
539
551
  type: this.value_type,
540
- location: get_location(2),
552
+ loc_id: get_location_id(),
541
553
  builtin: "DictSwap",
542
554
  type_parameters: [this.key_type, this.value_type],
543
555
  arguments: [this[AstSymbol], keyAst, valueAst],
@@ -565,7 +577,7 @@ export class DictExpr extends Expr {
565
577
  return this[FactorySymbol]({
566
578
  ast_type: "Builtin",
567
579
  type: NullType,
568
- location: get_location(2),
580
+ loc_id: get_location_id(),
569
581
  builtin: "DictClear",
570
582
  type_parameters: [this.key_type, this.value_type],
571
583
  arguments: [this[AstSymbol]],
@@ -602,7 +614,7 @@ export class DictExpr extends Expr {
602
614
  let mergerAst;
603
615
  if (mergeFn === undefined) {
604
616
  // Default: replace existing value with new value (ignore key and existing, return new)
605
- const mergerExpr = Expr.function([this.value_type, this.value_type, this.key_type], this.value_type, ($, _v1, _v2, k) => $.error(Expr.str `Key ${k} exists in both dictionaries`, get_location(2)));
617
+ const mergerExpr = Expr.function([this.value_type, this.value_type, this.key_type], this.value_type, ($, _v1, _v2, k) => $.error(Expr.str `Key ${k} exists in both dictionaries`, get_location_id()));
606
618
  mergerAst = Expr.ast(mergerExpr);
607
619
  }
608
620
  else {
@@ -612,7 +624,7 @@ export class DictExpr extends Expr {
612
624
  return this[FactorySymbol]({
613
625
  ast_type: "Builtin",
614
626
  type: NullType,
615
- location: get_location(2),
627
+ loc_id: get_location_id(),
616
628
  builtin: "DictUnionInPlace",
617
629
  type_parameters: [this.key_type, this.value_type],
618
630
  arguments: [this[AstSymbol], Expr.ast(dict2Expr), mergerAst],
@@ -659,7 +671,7 @@ export class DictExpr extends Expr {
659
671
  let initialExpr;
660
672
  if (initialFn === undefined) {
661
673
  // Default: create function that throws error
662
- initialExpr = Expr.function([this.key_type], this.value_type, ($, key) => $.error(Expr.str `Key ${key} not found in dictionary`, get_location(2)));
674
+ initialExpr = Expr.function([this.key_type], this.value_type, ($, key) => $.error(Expr.str `Key ${key} not found in dictionary`, get_location_id()));
663
675
  }
664
676
  else {
665
677
  initialExpr = Expr.from(initialFn, FunctionType([this.key_type], this.value_type));
@@ -667,7 +679,7 @@ export class DictExpr extends Expr {
667
679
  return this[FactorySymbol]({
668
680
  ast_type: "Builtin",
669
681
  type: NullType,
670
- location: get_location(2),
682
+ loc_id: get_location_id(),
671
683
  builtin: "DictMergeAll",
672
684
  type_parameters: [this.key_type, this.value_type, value2Type],
673
685
  arguments: [this[AstSymbol], dict2Ast, Expr.ast(mergerExpr), Expr.ast(initialExpr)],
@@ -694,7 +706,7 @@ export class DictExpr extends Expr {
694
706
  return this[FactorySymbol]({
695
707
  ast_type: "Builtin",
696
708
  type: SetType(this.key_type),
697
- location: get_location(2),
709
+ loc_id: get_location_id(),
698
710
  builtin: "DictKeys",
699
711
  type_parameters: [this.key_type, this.value_type],
700
712
  arguments: [this[AstSymbol]],
@@ -738,7 +750,7 @@ export class DictExpr extends Expr {
738
750
  let onMissingAst;
739
751
  if (onMissing === undefined) {
740
752
  // Default: throw error with key information if key doesn't exist
741
- const defaultFunction = Expr.function([this.key_type], this.value_type, ($, key) => $.error(Expr.str `Key ${key} not found in dictionary`, get_location(2)));
753
+ const defaultFunction = Expr.function([this.key_type], this.value_type, ($, key) => $.error(Expr.str `Key ${key} not found in dictionary`, get_location_id()));
742
754
  onMissingAst = Expr.ast(defaultFunction);
743
755
  }
744
756
  else {
@@ -748,7 +760,7 @@ export class DictExpr extends Expr {
748
760
  return this[FactorySymbol]({
749
761
  ast_type: "Builtin",
750
762
  type: this[TypeSymbol],
751
- location: get_location(2),
763
+ loc_id: get_location_id(),
752
764
  builtin: "DictGetKeys",
753
765
  type_parameters: [this.key_type, this.value_type],
754
766
  arguments: [this[AstSymbol], keysAst, onMissingAst],
@@ -788,7 +800,7 @@ export class DictExpr extends Expr {
788
800
  return this[FactorySymbol]({
789
801
  ast_type: "Builtin",
790
802
  type: NullType,
791
- location: get_location(2),
803
+ loc_id: get_location_id(),
792
804
  builtin: "DictForEach",
793
805
  type_parameters: [this.key_type, this.value_type, returnType],
794
806
  arguments: [this[AstSymbol], fnAst],
@@ -814,7 +826,7 @@ export class DictExpr extends Expr {
814
826
  return this[FactorySymbol]({
815
827
  ast_type: "Builtin",
816
828
  type: this[TypeSymbol],
817
- location: get_location(2),
829
+ loc_id: get_location_id(),
818
830
  builtin: "DictCopy",
819
831
  type_parameters: [this.key_type, this.value_type],
820
832
  arguments: [this[AstSymbol]],
@@ -833,7 +845,7 @@ export class DictExpr extends Expr {
833
845
  return Expr.fromAst({
834
846
  ast_type: "Builtin",
835
847
  type: DictType(this.key_type, returnType),
836
- location: get_location(2),
848
+ loc_id: get_location_id(),
837
849
  builtin: "DictMap",
838
850
  type_parameters: [this.key_type, this.value_type, returnType],
839
851
  arguments: [this[AstSymbol], Expr.ast(fnExpr)],
@@ -863,7 +875,7 @@ export class DictExpr extends Expr {
863
875
  return Expr.fromAst({
864
876
  ast_type: "Builtin",
865
877
  type: this[TypeSymbol],
866
- location: get_location(2),
878
+ loc_id: get_location_id(),
867
879
  builtin: "DictFilter",
868
880
  type_parameters: [this.key_type, this.value_type],
869
881
  arguments: [this[AstSymbol], fnAst],
@@ -889,7 +901,7 @@ export class DictExpr extends Expr {
889
901
  return Expr.fromAst({
890
902
  ast_type: "Builtin",
891
903
  type: this[TypeSymbol],
892
- location: get_location(2),
904
+ loc_id: get_location_id(),
893
905
  builtin: "DictFilterMap",
894
906
  type_parameters: [this.key_type, this.value_type, someType],
895
907
  arguments: [this[AstSymbol], fnAst],
@@ -912,7 +924,7 @@ export class DictExpr extends Expr {
912
924
  return Expr.fromAst({
913
925
  ast_type: "Builtin",
914
926
  type: ArrayType(returnType),
915
- location: get_location(2),
927
+ loc_id: get_location_id(),
916
928
  builtin: "DictToArray",
917
929
  type_parameters: [this.key_type, this.value_type, returnType],
918
930
  arguments: [this[AstSymbol], Expr.ast(fnExpr)],
@@ -939,7 +951,7 @@ export class DictExpr extends Expr {
939
951
  return Expr.fromAst({
940
952
  ast_type: "Builtin",
941
953
  type: SetType(keyType),
942
- location: get_location(2),
954
+ loc_id: get_location_id(),
943
955
  builtin: "DictToSet",
944
956
  type_parameters: [this.key_type, this.value_type, keyType],
945
957
  arguments: [this[AstSymbol], keyFnAst],
@@ -952,8 +964,8 @@ export class DictExpr extends Expr {
952
964
  const valueType = valueFnAst.type.output;
953
965
  let onConflictAst;
954
966
  if (onConflictFn === undefined) {
955
- const location = get_location(2);
956
- const onConflictFunction = Expr.function([valueType, valueType, keyType], valueType, ($, existing, value, key) => $.error(Expr.str `Cannot insert duplicate key ${key} into dict`, location));
967
+ const loc_id = get_location_id();
968
+ const onConflictFunction = Expr.function([valueType, valueType, keyType], valueType, ($, existing, value, key) => $.error(Expr.str `Cannot insert duplicate key ${key} into dict`, loc_id));
957
969
  onConflictAst = Expr.ast(onConflictFunction);
958
970
  }
959
971
  else {
@@ -962,7 +974,7 @@ export class DictExpr extends Expr {
962
974
  return Expr.fromAst({
963
975
  ast_type: "Builtin",
964
976
  type: DictType(keyType, valueType),
965
- location: get_location(2),
977
+ loc_id: get_location_id(),
966
978
  builtin: "DictToDict",
967
979
  type_parameters: [this.key_type, this.value_type, keyType, valueType],
968
980
  arguments: [this[AstSymbol], keyFnAst, valueFnAst, onConflictAst],
@@ -978,7 +990,7 @@ export class DictExpr extends Expr {
978
990
  return Expr.fromAst({
979
991
  ast_type: "Builtin",
980
992
  type: ArrayType(elementType),
981
- location: get_location(2),
993
+ loc_id: get_location_id(),
982
994
  builtin: "DictFlattenToArray",
983
995
  type_parameters: [this.key_type, this.value_type, elementType],
984
996
  arguments: [this[AstSymbol], fnAst],
@@ -994,7 +1006,7 @@ export class DictExpr extends Expr {
994
1006
  return Expr.fromAst({
995
1007
  ast_type: "Builtin",
996
1008
  type: SetType(elementType),
997
- location: get_location(2),
1009
+ loc_id: get_location_id(),
998
1010
  builtin: "DictFlattenToSet",
999
1011
  type_parameters: [this.key_type, this.value_type, elementType],
1000
1012
  arguments: [this[AstSymbol], fnAst],
@@ -1010,8 +1022,8 @@ export class DictExpr extends Expr {
1010
1022
  const valueType = returnType.value;
1011
1023
  let onConflictAst;
1012
1024
  if (onConflictFn === undefined) {
1013
- const location = get_location(2);
1014
- const onConflictFunction = Expr.function([valueType, valueType, keyType], valueType, ($, existing, value, key) => $.error(Expr.str `Cannot insert duplicate key ${key} into dict`, location));
1025
+ const loc_id = get_location_id();
1026
+ const onConflictFunction = Expr.function([valueType, valueType, keyType], valueType, ($, existing, value, key) => $.error(Expr.str `Cannot insert duplicate key ${key} into dict`, loc_id));
1015
1027
  onConflictAst = Expr.ast(onConflictFunction);
1016
1028
  }
1017
1029
  else {
@@ -1020,7 +1032,7 @@ export class DictExpr extends Expr {
1020
1032
  return Expr.fromAst({
1021
1033
  ast_type: "Builtin",
1022
1034
  type: DictType(keyType, valueType),
1023
- location: get_location(2),
1035
+ loc_id: get_location_id(),
1024
1036
  builtin: "DictFlattenToDict",
1025
1037
  type_parameters: [this.key_type, this.value_type, keyType, valueType],
1026
1038
  arguments: [this[AstSymbol], fnAst, onConflictAst],
@@ -1035,7 +1047,7 @@ export class DictExpr extends Expr {
1035
1047
  return Expr.fromAst({
1036
1048
  ast_type: "Builtin",
1037
1049
  type: DictType(keyType, initType),
1038
- location: get_location(2),
1050
+ loc_id: get_location_id(),
1039
1051
  builtin: "DictGroupFold",
1040
1052
  type_parameters: [this.key_type, this.value_type, keyType, initType],
1041
1053
  arguments: [this[AstSymbol], keyFnAst, initFnAst, reduceFnAst],
@@ -1239,7 +1251,7 @@ export class DictExpr extends Expr {
1239
1251
  return this[FactorySymbol]({
1240
1252
  ast_type: "Builtin",
1241
1253
  type: returnType,
1242
- location: get_location(2),
1254
+ loc_id: get_location_id(),
1243
1255
  builtin: "DictReduce",
1244
1256
  type_parameters: [this.key_type, this.value_type, returnType],
1245
1257
  arguments: [this[AstSymbol], fnAst, initAst],
@@ -1252,7 +1264,7 @@ export class DictExpr extends Expr {
1252
1264
  return this[FactorySymbol]({
1253
1265
  ast_type: "Builtin",
1254
1266
  type: mapType,
1255
- location: get_location(2),
1267
+ loc_id: get_location_id(),
1256
1268
  builtin: "DictMapReduce",
1257
1269
  type_parameters: [this.key_type, this.value_type, mapType],
1258
1270
  arguments: [this[AstSymbol], mapAst, combineAst],
@@ -1271,7 +1283,7 @@ export class DictExpr extends Expr {
1271
1283
  return Expr.fromAst({
1272
1284
  ast_type: "Builtin",
1273
1285
  type: returnType,
1274
- location: get_location(2),
1286
+ loc_id: get_location_id(),
1275
1287
  builtin: "DictFirstMap",
1276
1288
  type_parameters: [this.key_type, this.value_type, someType],
1277
1289
  arguments: [this[AstSymbol], fnAst],
@@ -1313,20 +1325,20 @@ export class DictExpr extends Expr {
1313
1325
  const valueParam = {
1314
1326
  ast_type: "Variable",
1315
1327
  type: this.value_type,
1316
- location: get_location(2),
1328
+ loc_id: get_location_id(),
1317
1329
  mutable: false,
1318
1330
  };
1319
1331
  const keyParam = {
1320
1332
  ast_type: "Variable",
1321
1333
  type: this.key_type,
1322
- location: get_location(2),
1334
+ loc_id: get_location_id(),
1323
1335
  mutable: false,
1324
1336
  };
1325
1337
  // Check if boolean value is NOT true, then return some(null) to stop, otherwise return none to continue
1326
1338
  const notCondition = {
1327
1339
  ast_type: "Builtin",
1328
1340
  type: BooleanType,
1329
- location: get_location(2),
1341
+ loc_id: get_location_id(),
1330
1342
  builtin: "BooleanNot",
1331
1343
  type_parameters: [],
1332
1344
  arguments: [valueParam]
@@ -1334,23 +1346,23 @@ export class DictExpr extends Expr {
1334
1346
  const checkFnAst = {
1335
1347
  ast_type: "Function",
1336
1348
  type: FunctionType([this.value_type, this.key_type], optionType),
1337
- location: get_location(2),
1349
+ loc_id: get_location_id(),
1338
1350
  parameters: [valueParam, keyParam],
1339
1351
  body: {
1340
1352
  ast_type: "IfElse",
1341
1353
  type: optionType,
1342
- location: get_location(2),
1354
+ loc_id: get_location_id(),
1343
1355
  ifs: [{
1344
1356
  predicate: notCondition,
1345
- body: { ast_type: "Variant", type: optionType, location: get_location(2), case: "some", value: { ast_type: "Value", type: NullType, location: get_location(2), value: null } }
1357
+ body: { ast_type: "Variant", type: optionType, loc_id: get_location_id(), case: "some", value: { ast_type: "Value", type: NullType, loc_id: get_location_id(), value: null } }
1346
1358
  }],
1347
- else_body: { ast_type: "Variant", type: optionType, location: get_location(2), case: "none", value: { ast_type: "Value", type: NullType, location: get_location(2), value: null } }
1359
+ else_body: { ast_type: "Variant", type: optionType, loc_id: get_location_id(), case: "none", value: { ast_type: "Value", type: NullType, loc_id: get_location_id(), value: null } }
1348
1360
  }
1349
1361
  };
1350
1362
  const result = Expr.fromAst({
1351
1363
  ast_type: "Builtin",
1352
1364
  type: optionType,
1353
- location: get_location(2),
1365
+ loc_id: get_location_id(),
1354
1366
  builtin: "DictFirstMap",
1355
1367
  type_parameters: [this.key_type, this.value_type, NullType],
1356
1368
  arguments: [this[AstSymbol], checkFnAst],
@@ -1400,36 +1412,36 @@ export class DictExpr extends Expr {
1400
1412
  const valueParam = {
1401
1413
  ast_type: "Variable",
1402
1414
  type: this.value_type,
1403
- location: get_location(2),
1415
+ loc_id: get_location_id(),
1404
1416
  mutable: false,
1405
1417
  };
1406
1418
  const keyParam = {
1407
1419
  ast_type: "Variable",
1408
1420
  type: this.key_type,
1409
- location: get_location(2),
1421
+ loc_id: get_location_id(),
1410
1422
  mutable: false,
1411
1423
  };
1412
1424
  // Check if boolean value is true, then return some(null) to stop, otherwise return none to continue
1413
1425
  const checkFnAst = {
1414
1426
  ast_type: "Function",
1415
1427
  type: FunctionType([this.value_type, this.key_type], optionType),
1416
- location: get_location(2),
1428
+ loc_id: get_location_id(),
1417
1429
  parameters: [valueParam, keyParam],
1418
1430
  body: {
1419
1431
  ast_type: "IfElse",
1420
1432
  type: optionType,
1421
- location: get_location(2),
1433
+ loc_id: get_location_id(),
1422
1434
  ifs: [{
1423
1435
  predicate: valueParam,
1424
- body: { ast_type: "Variant", type: optionType, location: get_location(2), case: "some", value: { ast_type: "Value", type: NullType, location: get_location(2), value: null } }
1436
+ body: { ast_type: "Variant", type: optionType, loc_id: get_location_id(), case: "some", value: { ast_type: "Value", type: NullType, loc_id: get_location_id(), value: null } }
1425
1437
  }],
1426
- else_body: { ast_type: "Variant", type: optionType, location: get_location(2), case: "none", value: { ast_type: "Value", type: NullType, location: get_location(2), value: null } }
1438
+ else_body: { ast_type: "Variant", type: optionType, loc_id: get_location_id(), case: "none", value: { ast_type: "Value", type: NullType, loc_id: get_location_id(), value: null } }
1427
1439
  }
1428
1440
  };
1429
1441
  const result = Expr.fromAst({
1430
1442
  ast_type: "Builtin",
1431
1443
  type: optionType,
1432
- location: get_location(2),
1444
+ loc_id: get_location_id(),
1433
1445
  builtin: "DictFirstMap",
1434
1446
  type_parameters: [this.key_type, this.value_type, NullType],
1435
1447
  arguments: [this[AstSymbol], checkFnAst],
@@ -1488,5 +1500,54 @@ export class DictExpr extends Expr {
1488
1500
  }
1489
1501
  }
1490
1502
  }
1503
+ /**
1504
+ * Checks if this dictionary equals another dictionary (same key-value pairs).
1505
+ *
1506
+ * @param other - The dictionary to compare against
1507
+ * @returns A BooleanExpr that is true if the dictionaries are equal
1508
+ *
1509
+ * @example
1510
+ * ```ts
1511
+ * const isEqual = East.function([DictType(StringType, IntegerType), DictType(StringType, IntegerType)], BooleanType, ($, a, b) => {
1512
+ * $.return(a.equals(b));
1513
+ * });
1514
+ * const compiled = East.compile(isEqual.toIR(), []);
1515
+ * compiled(new Map([["a", 1n], ["b", 2n]]), new Map([["a", 1n], ["b", 2n]])); // true
1516
+ * compiled(new Map([["a", 1n]]), new Map([["a", 1n], ["b", 2n]])); // false
1517
+ * ```
1518
+ */
1519
+ equals(other) {
1520
+ return equal(this, other);
1521
+ }
1522
+ /**
1523
+ * Checks if this dictionary does not equal another dictionary.
1524
+ *
1525
+ * @param other - The dictionary to compare against
1526
+ * @returns A BooleanExpr that is true if the dictionaries are not equal
1527
+ *
1528
+ * @example
1529
+ * ```ts
1530
+ * const isNotEqual = East.function([DictType(StringType, IntegerType), DictType(StringType, IntegerType)], BooleanType, ($, a, b) => {
1531
+ * $.return(a.notEquals(b));
1532
+ * });
1533
+ * const compiled = East.compile(isNotEqual.toIR(), []);
1534
+ * compiled(new Map([["a", 1n]]), new Map([["a", 1n], ["b", 2n]])); // true
1535
+ * compiled(new Map([["a", 1n], ["b", 2n]]), new Map([["a", 1n], ["b", 2n]])); // false
1536
+ * ```
1537
+ */
1538
+ notEquals(other) {
1539
+ return notEqual(this, other);
1540
+ }
1541
+ // ============================================================================
1542
+ // Aliases for comparison operations
1543
+ // ============================================================================
1544
+ /** Alias for {@link equals} */
1545
+ eq = this.equals;
1546
+ /** Alias for {@link equals} */
1547
+ equal = this.equals;
1548
+ /** Alias for {@link notEquals} */
1549
+ ne = this.notEquals;
1550
+ /** Alias for {@link notEquals} */
1551
+ notEqual = this.notEquals;
1491
1552
  }
1492
1553
  //# sourceMappingURL=dict.js.map