redscript-mc 2.4.1 → 2.6.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 (1680) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +4 -0
  3. package/ROADMAP.md +145 -0
  4. package/dist/cli.js +0 -0
  5. package/dist/src/__tests__/compile-all.test.js +1 -0
  6. package/dist/src/__tests__/diagnostics.test.js +8 -11
  7. package/dist/src/__tests__/double.test.d.ts +7 -0
  8. package/dist/src/__tests__/double.test.js +464 -0
  9. package/dist/src/__tests__/e2e/for-in-array.test.d.ts +4 -0
  10. package/dist/src/__tests__/e2e/for-in-array.test.js +59 -0
  11. package/dist/src/__tests__/e2e/macros.test.js +7 -7
  12. package/dist/src/__tests__/e2e/stdlib-e2e.test.js +1411 -0
  13. package/dist/src/__tests__/fixed.test.d.ts +7 -0
  14. package/dist/src/__tests__/fixed.test.js +148 -0
  15. package/dist/src/__tests__/float-lint.test.d.ts +7 -0
  16. package/dist/src/__tests__/float-lint.test.js +96 -0
  17. package/dist/src/__tests__/float.test.d.ts +7 -0
  18. package/dist/src/__tests__/float.test.js +148 -0
  19. package/dist/src/__tests__/for-range.test.js +136 -0
  20. package/dist/src/__tests__/generics.test.js +4 -4
  21. package/dist/src/__tests__/impl.test.js +199 -0
  22. package/dist/src/__tests__/mc-integration.test.js +664 -0
  23. package/dist/src/__tests__/optimizer/constant_fold.test.js +105 -0
  24. package/dist/src/__tests__/optimizer/coroutine.test.js +3 -2
  25. package/dist/src/__tests__/optimizer/lir/peephole.test.js +92 -0
  26. package/dist/src/__tests__/parser.test.js +2 -2
  27. package/dist/src/__tests__/stdlib/calculus.test.d.ts +5 -0
  28. package/dist/src/__tests__/stdlib/calculus.test.js +123 -0
  29. package/dist/src/__tests__/stdlib/easing.test.d.ts +5 -0
  30. package/dist/src/__tests__/stdlib/easing.test.js +117 -0
  31. package/dist/src/__tests__/stdlib/geometry.test.d.ts +5 -0
  32. package/dist/src/__tests__/stdlib/geometry.test.js +163 -0
  33. package/dist/src/__tests__/stdlib/heap.test.d.ts +4 -0
  34. package/dist/src/__tests__/stdlib/heap.test.js +141 -0
  35. package/dist/src/__tests__/stdlib/list.test.d.ts +5 -0
  36. package/dist/src/__tests__/stdlib/list.test.js +134 -0
  37. package/dist/src/__tests__/stdlib/matrix.test.d.ts +5 -0
  38. package/dist/src/__tests__/stdlib/matrix.test.js +148 -0
  39. package/dist/src/__tests__/stdlib/pathfind.test.d.ts +4 -0
  40. package/dist/src/__tests__/stdlib/pathfind.test.js +167 -0
  41. package/dist/src/__tests__/stdlib/sort.test.d.ts +4 -0
  42. package/dist/src/__tests__/stdlib/sort.test.js +128 -0
  43. package/dist/src/__tests__/typechecker-strict.test.js +21 -21
  44. package/dist/src/ast/types.d.ts +14 -1
  45. package/dist/src/emit/compile.js +18 -1
  46. package/dist/src/emit/index.js +1 -1
  47. package/dist/src/events/types.js +1 -1
  48. package/dist/src/hir/lower.js +54 -1
  49. package/dist/src/hir/monomorphize.js +1 -1
  50. package/dist/src/hir/types.d.ts +5 -0
  51. package/dist/src/lexer/index.d.ts +1 -1
  52. package/dist/src/lexer/index.js +10 -1
  53. package/dist/src/lsp/main.js +0 -0
  54. package/dist/src/lsp/server.js +671 -28
  55. package/dist/src/mc-test/client.d.ts +13 -1
  56. package/dist/src/mc-test/client.js +29 -1
  57. package/dist/src/mir/lower.js +400 -17
  58. package/dist/src/optimizer/constant_fold.js +10 -6
  59. package/dist/src/optimizer/coroutine.js +90 -33
  60. package/dist/src/optimizer/lir/peephole.d.ts +13 -4
  61. package/dist/src/optimizer/lir/peephole.js +44 -5
  62. package/dist/src/parser/index.d.ts +4 -0
  63. package/dist/src/parser/index.js +125 -28
  64. package/dist/src/typechecker/index.d.ts +8 -1
  65. package/dist/src/typechecker/index.js +61 -9
  66. package/docs/LANGUAGE_REFERENCE.md +302 -67
  67. package/docs/stdlib/README.md +54 -0
  68. package/docs/stdlib/advanced.md +276 -0
  69. package/docs/stdlib/bigint.md +285 -0
  70. package/docs/stdlib/bits.md +159 -0
  71. package/docs/stdlib/bossbar.md +101 -0
  72. package/docs/stdlib/calculus.md +141 -0
  73. package/docs/stdlib/color.md +125 -0
  74. package/docs/stdlib/combat.md +41 -0
  75. package/docs/stdlib/cooldown.md +48 -0
  76. package/docs/stdlib/easing.md +157 -0
  77. package/docs/stdlib/effects.md +101 -0
  78. package/docs/stdlib/expr.md +38 -0
  79. package/docs/stdlib/geometry.md +130 -0
  80. package/docs/stdlib/interactions.md +111 -0
  81. package/docs/stdlib/inventory.md +53 -0
  82. package/docs/stdlib/list.md +189 -0
  83. package/docs/stdlib/math.md +334 -0
  84. package/docs/stdlib/math_hp.md +185 -0
  85. package/docs/stdlib/matrix.md +123 -0
  86. package/docs/stdlib/mobs.md +131 -0
  87. package/docs/stdlib/noise.md +103 -0
  88. package/docs/stdlib/parabola.md +119 -0
  89. package/docs/stdlib/particles.md +123 -0
  90. package/docs/stdlib/physics.md +148 -0
  91. package/docs/stdlib/player.md +43 -0
  92. package/docs/stdlib/quaternion.md +159 -0
  93. package/docs/stdlib/random.md +86 -0
  94. package/docs/stdlib/sets.md +68 -0
  95. package/docs/stdlib/signal.md +141 -0
  96. package/docs/stdlib/spawn.md +65 -0
  97. package/docs/stdlib/strings.md +17 -0
  98. package/docs/stdlib/tags.md +117 -0
  99. package/docs/stdlib/teams.md +87 -0
  100. package/docs/stdlib/timer.md +126 -0
  101. package/docs/stdlib/vec.md +193 -0
  102. package/docs/stdlib/world.md +151 -0
  103. package/editors/vscode/build.mjs +31 -12
  104. package/editors/vscode/out/extension.js +3060 -143
  105. package/editors/vscode/package-lock.json +3 -3
  106. package/editors/vscode/package.json +1 -1
  107. package/editors/vscode/src/extension.ts +11 -6
  108. package/examples/math-demo.mcrs +127 -0
  109. package/examples/readme-demo.mcrs +4 -4
  110. package/examples/showcase.mcrs +64 -109
  111. package/package.json +1 -1
  112. package/scripts/postbuild.js +20 -0
  113. package/src/__tests__/compile-all.test.ts +3 -2
  114. package/src/__tests__/diagnostics.test.ts +8 -10
  115. package/src/__tests__/double.test.ts +478 -0
  116. package/src/__tests__/e2e/for-in-array.test.ts +62 -0
  117. package/src/__tests__/e2e/macros.test.ts +7 -7
  118. package/src/__tests__/e2e/stdlib-e2e.test.ts +1686 -0
  119. package/src/__tests__/fixed.test.ts +159 -0
  120. package/src/__tests__/fixtures/coroutine-mc-test.mcrs +58 -0
  121. package/src/__tests__/fixtures/for-range.mcrs +15 -0
  122. package/src/__tests__/fixtures/heap-sort-mc-test.mcrs +87 -0
  123. package/src/__tests__/fixtures/impl-test.mcrs +13 -44
  124. package/src/__tests__/fixtures/stdlib-extra-test.mcrs +226 -0
  125. package/src/__tests__/fixtures/stdlib-math-integration.mcrs +28 -0
  126. package/src/__tests__/fixtures/stdlib-math-test.mcrs +53 -0
  127. package/src/__tests__/float-lint.test.ts +102 -0
  128. package/src/__tests__/float.test.ts +158 -0
  129. package/src/__tests__/for-range.test.ts +149 -0
  130. package/src/__tests__/generics.test.ts +4 -4
  131. package/src/__tests__/impl.test.ts +207 -0
  132. package/src/__tests__/mc-integration.test.ts +706 -0
  133. package/src/__tests__/optimizer/constant_fold.test.ts +115 -0
  134. package/src/__tests__/optimizer/coroutine.test.ts +3 -2
  135. package/src/__tests__/optimizer/lir/peephole.test.ts +100 -0
  136. package/src/__tests__/parser.test.ts +2 -2
  137. package/src/__tests__/stdlib/calculus.test.ts +99 -0
  138. package/src/__tests__/stdlib/easing.test.ts +97 -0
  139. package/src/__tests__/stdlib/geometry.test.ts +171 -0
  140. package/src/__tests__/stdlib/heap.test.ts +121 -0
  141. package/src/__tests__/stdlib/list.test.ts +117 -0
  142. package/src/__tests__/stdlib/matrix.test.ts +140 -0
  143. package/src/__tests__/stdlib/pathfind.test.ts +151 -0
  144. package/src/__tests__/stdlib/sort.test.ts +106 -0
  145. package/src/__tests__/typechecker-strict.test.ts +21 -21
  146. package/src/ast/types.ts +4 -2
  147. package/src/emit/compile.ts +21 -1
  148. package/src/emit/index.ts +1 -1
  149. package/src/events/types.ts +1 -1
  150. package/src/examples/tutorial_01_hello.mcrs +63 -0
  151. package/src/examples/tutorial_02_variables.mcrs +157 -0
  152. package/src/examples/tutorial_03_functions_structs.mcrs +162 -0
  153. package/src/examples/tutorial_04_selectors.mcrs +139 -0
  154. package/src/examples/tutorial_05_decorators.mcrs +131 -0
  155. package/src/examples/tutorial_06_math_particles.mcrs +123 -0
  156. package/src/examples/tutorial_07_random.mcrs +142 -0
  157. package/src/examples/tutorial_08_coroutine.mcrs +163 -0
  158. package/src/examples/tutorial_09_precision.mcrs +154 -0
  159. package/src/examples/tutorial_10_kill_race.mcrs +289 -0
  160. package/src/hir/lower.ts +56 -1
  161. package/src/hir/monomorphize.ts +1 -1
  162. package/src/hir/types.ts +2 -0
  163. package/src/lexer/index.ts +11 -2
  164. package/src/lsp/server.ts +667 -28
  165. package/src/mc-test/client.ts +32 -1
  166. package/src/mir/lower.ts +405 -19
  167. package/src/optimizer/constant_fold.ts +11 -6
  168. package/src/optimizer/coroutine.ts +89 -29
  169. package/src/optimizer/lir/peephole.ts +50 -5
  170. package/src/parser/index.ts +126 -28
  171. package/src/stdlib/advanced.mcrs +47 -0
  172. package/src/stdlib/bigint.mcrs +252 -100
  173. package/src/stdlib/calculus.mcrs +150 -0
  174. package/src/stdlib/color.mcrs +102 -82
  175. package/src/stdlib/easing.mcrs +182 -0
  176. package/src/stdlib/expr.mcrs +117 -0
  177. package/src/stdlib/geometry.mcrs +89 -0
  178. package/src/stdlib/heap.mcrs +175 -0
  179. package/src/stdlib/list.mcrs +99 -0
  180. package/src/stdlib/math.mcrs +121 -5
  181. package/src/stdlib/math_hp.mcrs +452 -0
  182. package/src/stdlib/matrix.mcrs +108 -0
  183. package/src/stdlib/noise.mcrs +153 -0
  184. package/src/stdlib/parabola.mcrs +160 -0
  185. package/src/stdlib/particles.mcrs +69 -0
  186. package/src/stdlib/pathfind.mcrs +321 -0
  187. package/src/stdlib/physics.mcrs +134 -0
  188. package/src/stdlib/quaternion.mcrs +192 -0
  189. package/src/stdlib/random.mcrs +46 -1
  190. package/src/stdlib/signal.mcrs +223 -0
  191. package/src/stdlib/sort.mcrs +109 -0
  192. package/src/stdlib/world.mcrs +24 -0
  193. package/src/typechecker/index.ts +73 -10
  194. package/dist/__tests__/cli.test.js +0 -278
  195. package/dist/__tests__/codegen.test.js +0 -152
  196. package/dist/__tests__/compile-all.test.d.ts +0 -10
  197. package/dist/__tests__/compile-all.test.js +0 -108
  198. package/dist/__tests__/dce.test.d.ts +0 -1
  199. package/dist/__tests__/dce.test.js +0 -138
  200. package/dist/__tests__/diagnostics.test.d.ts +0 -4
  201. package/dist/__tests__/diagnostics.test.js +0 -149
  202. package/dist/__tests__/e2e.test.d.ts +0 -6
  203. package/dist/__tests__/e2e.test.js +0 -1847
  204. package/dist/__tests__/entity-types.test.d.ts +0 -1
  205. package/dist/__tests__/entity-types.test.js +0 -203
  206. package/dist/__tests__/formatter.test.d.ts +0 -1
  207. package/dist/__tests__/formatter.test.js +0 -40
  208. package/dist/__tests__/lexer.test.d.ts +0 -1
  209. package/dist/__tests__/lexer.test.js +0 -343
  210. package/dist/__tests__/lowering.test.d.ts +0 -1
  211. package/dist/__tests__/lowering.test.js +0 -1015
  212. package/dist/__tests__/macro.test.d.ts +0 -8
  213. package/dist/__tests__/macro.test.js +0 -305
  214. package/dist/__tests__/mc-integration.test.d.ts +0 -12
  215. package/dist/__tests__/mc-integration.test.js +0 -819
  216. package/dist/__tests__/mc-syntax.test.d.ts +0 -1
  217. package/dist/__tests__/mc-syntax.test.js +0 -124
  218. package/dist/__tests__/nbt.test.d.ts +0 -1
  219. package/dist/__tests__/nbt.test.js +0 -82
  220. package/dist/__tests__/optimizer-advanced.test.d.ts +0 -1
  221. package/dist/__tests__/optimizer-advanced.test.js +0 -124
  222. package/dist/__tests__/optimizer.test.d.ts +0 -1
  223. package/dist/__tests__/optimizer.test.js +0 -149
  224. package/dist/__tests__/parser.test.d.ts +0 -1
  225. package/dist/__tests__/parser.test.js +0 -807
  226. package/dist/__tests__/repl.test.d.ts +0 -1
  227. package/dist/__tests__/repl.test.js +0 -27
  228. package/dist/__tests__/runtime.test.d.ts +0 -1
  229. package/dist/__tests__/runtime.test.js +0 -289
  230. package/dist/__tests__/stdlib-advanced.test.d.ts +0 -4
  231. package/dist/__tests__/stdlib-advanced.test.js +0 -378
  232. package/dist/__tests__/stdlib-bigint.test.d.ts +0 -7
  233. package/dist/__tests__/stdlib-bigint.test.js +0 -428
  234. package/dist/__tests__/stdlib-math.test.d.ts +0 -7
  235. package/dist/__tests__/stdlib-math.test.js +0 -352
  236. package/dist/__tests__/stdlib-vec.test.d.ts +0 -4
  237. package/dist/__tests__/stdlib-vec.test.js +0 -264
  238. package/dist/__tests__/structure-optimizer.test.d.ts +0 -1
  239. package/dist/__tests__/structure-optimizer.test.js +0 -33
  240. package/dist/__tests__/typechecker.test.d.ts +0 -1
  241. package/dist/__tests__/typechecker.test.js +0 -552
  242. package/dist/__tests__/var-allocator.test.d.ts +0 -1
  243. package/dist/__tests__/var-allocator.test.js +0 -69
  244. package/dist/ast/types.d.ts +0 -514
  245. package/dist/ast/types.js +0 -9
  246. package/dist/builtins/metadata.d.ts +0 -36
  247. package/dist/builtins/metadata.js +0 -1014
  248. package/dist/cli.d.ts +0 -11
  249. package/dist/codegen/cmdblock/index.d.ts +0 -26
  250. package/dist/codegen/cmdblock/index.js +0 -45
  251. package/dist/codegen/mcfunction/index.d.ts +0 -40
  252. package/dist/codegen/mcfunction/index.js +0 -606
  253. package/dist/codegen/structure/index.d.ts +0 -24
  254. package/dist/codegen/structure/index.js +0 -279
  255. package/dist/codegen/var-allocator.d.ts +0 -45
  256. package/dist/codegen/var-allocator.js +0 -104
  257. package/dist/compile.d.ts +0 -68
  258. package/dist/data/arena/function/__load.mcfunction +0 -6
  259. package/dist/data/arena/function/__tick.mcfunction +0 -2
  260. package/dist/data/arena/function/announce_leaders/else_1.mcfunction +0 -3
  261. package/dist/data/arena/function/announce_leaders/foreach_0/merge_2.mcfunction +0 -1
  262. package/dist/data/arena/function/announce_leaders/foreach_0/then_0.mcfunction +0 -3
  263. package/dist/data/arena/function/announce_leaders/foreach_0.mcfunction +0 -7
  264. package/dist/data/arena/function/announce_leaders/foreach_1/merge_2.mcfunction +0 -1
  265. package/dist/data/arena/function/announce_leaders/foreach_1/then_0.mcfunction +0 -4
  266. package/dist/data/arena/function/announce_leaders/foreach_1.mcfunction +0 -6
  267. package/dist/data/arena/function/announce_leaders/merge_2.mcfunction +0 -1
  268. package/dist/data/arena/function/announce_leaders/then_0.mcfunction +0 -4
  269. package/dist/data/arena/function/announce_leaders.mcfunction +0 -6
  270. package/dist/data/arena/function/arena_tick/merge_2.mcfunction +0 -1
  271. package/dist/data/arena/function/arena_tick/then_0.mcfunction +0 -4
  272. package/dist/data/arena/function/arena_tick.mcfunction +0 -11
  273. package/dist/data/capture_the_flag/function/add_to_team.mcfunction +0 -5
  274. package/dist/data/capture_the_flag/function/angry_at.mcfunction +0 -1
  275. package/dist/data/capture_the_flag/function/assign_teams.mcfunction +0 -1
  276. package/dist/data/capture_the_flag/function/assign_teams__foreach_t1.mcfunction +0 -8
  277. package/dist/data/capture_the_flag/function/assign_teams__foreach_t1__else_2.mcfunction +0 -8
  278. package/dist/data/capture_the_flag/function/assign_teams__foreach_t1__merge_1.mcfunction +0 -3
  279. package/dist/data/capture_the_flag/function/assign_teams__foreach_t1__then_0.mcfunction +0 -8
  280. package/dist/data/capture_the_flag/function/barrier_wall.mcfunction +0 -1
  281. package/dist/data/capture_the_flag/function/buff_all.mcfunction +0 -22
  282. package/dist/data/capture_the_flag/function/check_flag_capture.mcfunction +0 -2
  283. package/dist/data/capture_the_flag/function/check_flag_capture__foreach_t0.mcfunction +0 -8
  284. package/dist/data/capture_the_flag/function/check_flag_capture__foreach_t0__merge_1.mcfunction +0 -1
  285. package/dist/data/capture_the_flag/function/check_flag_capture__foreach_t0__then_0.mcfunction +0 -7
  286. package/dist/data/capture_the_flag/function/check_flag_capture__foreach_t1.mcfunction +0 -8
  287. package/dist/data/capture_the_flag/function/check_flag_capture__foreach_t1__merge_1.mcfunction +0 -1
  288. package/dist/data/capture_the_flag/function/check_flag_capture__foreach_t1__then_0.mcfunction +0 -7
  289. package/dist/data/capture_the_flag/function/check_flag_pickup.mcfunction +0 -2
  290. package/dist/data/capture_the_flag/function/check_flag_pickup__foreach_t0.mcfunction +0 -8
  291. package/dist/data/capture_the_flag/function/check_flag_pickup__foreach_t0__merge_1.mcfunction +0 -1
  292. package/dist/data/capture_the_flag/function/check_flag_pickup__foreach_t0__then_0.mcfunction +0 -7
  293. package/dist/data/capture_the_flag/function/check_flag_pickup__foreach_t1.mcfunction +0 -8
  294. package/dist/data/capture_the_flag/function/check_flag_pickup__foreach_t1__merge_1.mcfunction +0 -1
  295. package/dist/data/capture_the_flag/function/check_flag_pickup__foreach_t1__then_0.mcfunction +0 -7
  296. package/dist/data/capture_the_flag/function/check_win.mcfunction +0 -4
  297. package/dist/data/capture_the_flag/function/cleanup_teams.mcfunction +0 -8
  298. package/dist/data/capture_the_flag/function/clear_area.mcfunction +0 -1
  299. package/dist/data/capture_the_flag/function/clear_effect.mcfunction +0 -1
  300. package/dist/data/capture_the_flag/function/clear_effects.mcfunction +0 -1
  301. package/dist/data/capture_the_flag/function/clear_inventory.mcfunction +0 -1
  302. package/dist/data/capture_the_flag/function/create_blue_team.mcfunction +0 -10
  303. package/dist/data/capture_the_flag/function/create_green_team.mcfunction +0 -10
  304. package/dist/data/capture_the_flag/function/create_red_team.mcfunction +0 -10
  305. package/dist/data/capture_the_flag/function/create_team.mcfunction +0 -8
  306. package/dist/data/capture_the_flag/function/create_yellow_team.mcfunction +0 -10
  307. package/dist/data/capture_the_flag/function/disable_fire_spread.mcfunction +0 -1
  308. package/dist/data/capture_the_flag/function/disable_keep_inventory.mcfunction +0 -1
  309. package/dist/data/capture_the_flag/function/disable_mob_griefing.mcfunction +0 -1
  310. package/dist/data/capture_the_flag/function/distance_to.mcfunction +0 -6
  311. package/dist/data/capture_the_flag/function/distance_to__const_0_0_0_0.mcfunction +0 -5
  312. package/dist/data/capture_the_flag/function/enable_keep_inventory.mcfunction +0 -1
  313. package/dist/data/capture_the_flag/function/end_game.mcfunction +0 -6
  314. package/dist/data/capture_the_flag/function/end_game__else_2.mcfunction +0 -3
  315. package/dist/data/capture_the_flag/function/end_game__foreach_t7.mcfunction +0 -2
  316. package/dist/data/capture_the_flag/function/end_game__merge_1.mcfunction +0 -1
  317. package/dist/data/capture_the_flag/function/end_game__then_0.mcfunction +0 -3
  318. package/dist/data/capture_the_flag/function/end_sparkles_at.mcfunction +0 -1
  319. package/dist/data/capture_the_flag/function/explosion_effect.mcfunction +0 -1
  320. package/dist/data/capture_the_flag/function/flames.mcfunction +0 -1
  321. package/dist/data/capture_the_flag/function/game_tick.mcfunction +0 -1
  322. package/dist/data/capture_the_flag/function/give_kit_archer.mcfunction +0 -6
  323. package/dist/data/capture_the_flag/function/give_kit_mage.mcfunction +0 -5
  324. package/dist/data/capture_the_flag/function/give_kit_warrior.mcfunction +0 -6
  325. package/dist/data/capture_the_flag/function/glass_box.mcfunction +0 -2
  326. package/dist/data/capture_the_flag/function/glow.mcfunction +0 -1
  327. package/dist/data/capture_the_flag/function/happy_at.mcfunction +0 -1
  328. package/dist/data/capture_the_flag/function/hearts_at.mcfunction +0 -1
  329. package/dist/data/capture_the_flag/function/init.mcfunction +0 -11
  330. package/dist/data/capture_the_flag/function/invisible.mcfunction +0 -1
  331. package/dist/data/capture_the_flag/function/jump.mcfunction +0 -1
  332. package/dist/data/capture_the_flag/function/load.mcfunction +0 -1
  333. package/dist/data/capture_the_flag/function/night_vision.mcfunction +0 -1
  334. package/dist/data/capture_the_flag/function/place_flags.mcfunction +0 -2
  335. package/dist/data/capture_the_flag/function/portal_effect.mcfunction +0 -1
  336. package/dist/data/capture_the_flag/function/regen.mcfunction +0 -1
  337. package/dist/data/capture_the_flag/function/remove_from_teams.mcfunction +0 -3
  338. package/dist/data/capture_the_flag/function/remove_item.mcfunction +0 -1
  339. package/dist/data/capture_the_flag/function/resistance.mcfunction +0 -1
  340. package/dist/data/capture_the_flag/function/set_day.mcfunction +0 -1
  341. package/dist/data/capture_the_flag/function/set_easy.mcfunction +0 -1
  342. package/dist/data/capture_the_flag/function/set_hard.mcfunction +0 -1
  343. package/dist/data/capture_the_flag/function/set_midnight.mcfunction +0 -1
  344. package/dist/data/capture_the_flag/function/set_night.mcfunction +0 -1
  345. package/dist/data/capture_the_flag/function/set_noon.mcfunction +0 -1
  346. package/dist/data/capture_the_flag/function/set_normal.mcfunction +0 -1
  347. package/dist/data/capture_the_flag/function/set_peaceful.mcfunction +0 -1
  348. package/dist/data/capture_the_flag/function/setup_four_teams.mcfunction +0 -4
  349. package/dist/data/capture_the_flag/function/setup_two_teams.mcfunction +0 -2
  350. package/dist/data/capture_the_flag/function/slow_fall.mcfunction +0 -1
  351. package/dist/data/capture_the_flag/function/smoke.mcfunction +0 -1
  352. package/dist/data/capture_the_flag/function/sparkles_at.mcfunction +0 -1
  353. package/dist/data/capture_the_flag/function/speed.mcfunction +0 -1
  354. package/dist/data/capture_the_flag/function/start_game.mcfunction +0 -15
  355. package/dist/data/capture_the_flag/function/start_game__foreach_t10.mcfunction +0 -4
  356. package/dist/data/capture_the_flag/function/strength.mcfunction +0 -1
  357. package/dist/data/capture_the_flag/function/totem_at.mcfunction +0 -1
  358. package/dist/data/capture_the_flag/function/weather_clear.mcfunction +0 -1
  359. package/dist/data/capture_the_flag/function/weather_rain.mcfunction +0 -1
  360. package/dist/data/capture_the_flag/function/weather_thunder.mcfunction +0 -1
  361. package/dist/data/counter/function/__load.mcfunction +0 -5
  362. package/dist/data/counter/function/__tick.mcfunction +0 -2
  363. package/dist/data/counter/function/counter_tick/merge_2.mcfunction +0 -1
  364. package/dist/data/counter/function/counter_tick/then_0.mcfunction +0 -3
  365. package/dist/data/counter/function/counter_tick.mcfunction +0 -11
  366. package/dist/data/gcd2/function/__load.mcfunction +0 -3
  367. package/dist/data/gcd2/function/abs/merge_2.mcfunction +0 -3
  368. package/dist/data/gcd2/function/abs/then_0.mcfunction +0 -5
  369. package/dist/data/gcd2/function/abs.mcfunction +0 -7
  370. package/dist/data/gcd2/function/gcd/loop_body_1.mcfunction +0 -7
  371. package/dist/data/gcd2/function/gcd/loop_check_0.mcfunction +0 -5
  372. package/dist/data/gcd2/function/gcd/loop_exit_2.mcfunction +0 -3
  373. package/dist/data/gcd2/function/gcd.mcfunction +0 -14
  374. package/dist/data/gcd3/function/__load.mcfunction +0 -3
  375. package/dist/data/gcd3/function/abs/merge_2.mcfunction +0 -3
  376. package/dist/data/gcd3/function/abs/then_0.mcfunction +0 -5
  377. package/dist/data/gcd3/function/abs.mcfunction +0 -7
  378. package/dist/data/gcd3/function/gcd/loop_body_1.mcfunction +0 -7
  379. package/dist/data/gcd3/function/gcd/loop_check_0.mcfunction +0 -5
  380. package/dist/data/gcd3/function/gcd/loop_exit_2.mcfunction +0 -3
  381. package/dist/data/gcd3/function/gcd.mcfunction +0 -14
  382. package/dist/data/gcd3/function/test.mcfunction +0 -7
  383. package/dist/data/gcd3nm/function/__load.mcfunction +0 -3
  384. package/dist/data/gcd3nm/function/abs/merge_2.mcfunction +0 -3
  385. package/dist/data/gcd3nm/function/abs/then_0.mcfunction +0 -5
  386. package/dist/data/gcd3nm/function/abs.mcfunction +0 -7
  387. package/dist/data/gcd3nm/function/gcd/loop_body_1.mcfunction +0 -7
  388. package/dist/data/gcd3nm/function/gcd/loop_check_0.mcfunction +0 -5
  389. package/dist/data/gcd3nm/function/gcd/loop_exit_2.mcfunction +0 -3
  390. package/dist/data/gcd3nm/function/gcd.mcfunction +0 -14
  391. package/dist/data/gcd3nm/function/test.mcfunction +0 -7
  392. package/dist/data/gcd_test/function/__load.mcfunction +0 -3
  393. package/dist/data/gcd_test/function/abs/merge_2.mcfunction +0 -3
  394. package/dist/data/gcd_test/function/abs/then_0.mcfunction +0 -5
  395. package/dist/data/gcd_test/function/abs.mcfunction +0 -7
  396. package/dist/data/gcd_test/function/gcd/loop_body_1.mcfunction +0 -7
  397. package/dist/data/gcd_test/function/gcd/loop_check_0.mcfunction +0 -5
  398. package/dist/data/gcd_test/function/gcd/loop_exit_2.mcfunction +0 -3
  399. package/dist/data/gcd_test/function/gcd.mcfunction +0 -14
  400. package/dist/data/hunger_games/function/angry_at.mcfunction +0 -1
  401. package/dist/data/hunger_games/function/barrier_wall.mcfunction +0 -1
  402. package/dist/data/hunger_games/function/buff_all.mcfunction +0 -22
  403. package/dist/data/hunger_games/function/check_alive.mcfunction +0 -3
  404. package/dist/data/hunger_games/function/check_alive__foreach_t3.mcfunction +0 -10
  405. package/dist/data/hunger_games/function/check_alive__foreach_t3__merge_1.mcfunction +0 -1
  406. package/dist/data/hunger_games/function/check_alive__foreach_t3__then_0.mcfunction +0 -5
  407. package/dist/data/hunger_games/function/check_border_damage.mcfunction +0 -1
  408. package/dist/data/hunger_games/function/check_border_damage__foreach_t0.mcfunction +0 -1
  409. package/dist/data/hunger_games/function/clear_area.mcfunction +0 -1
  410. package/dist/data/hunger_games/function/clear_effect.mcfunction +0 -1
  411. package/dist/data/hunger_games/function/clear_effects.mcfunction +0 -1
  412. package/dist/data/hunger_games/function/countdown_tick.mcfunction +0 -1
  413. package/dist/data/hunger_games/function/create_health_bar.mcfunction +0 -24
  414. package/dist/data/hunger_games/function/create_progress_bar.mcfunction +0 -24
  415. package/dist/data/hunger_games/function/create_progress_bar__const_0_0_0.mcfunction +0 -21
  416. package/dist/data/hunger_games/function/create_timer_bar.mcfunction +0 -30
  417. package/dist/data/hunger_games/function/declare_winner.mcfunction +0 -13
  418. package/dist/data/hunger_games/function/disable_fire_spread.mcfunction +0 -1
  419. package/dist/data/hunger_games/function/disable_keep_inventory.mcfunction +0 -1
  420. package/dist/data/hunger_games/function/disable_mob_griefing.mcfunction +0 -1
  421. package/dist/data/hunger_games/function/enable_keep_inventory.mcfunction +0 -1
  422. package/dist/data/hunger_games/function/end_game_no_winner.mcfunction +0 -3
  423. package/dist/data/hunger_games/function/end_sparkles_at.mcfunction +0 -1
  424. package/dist/data/hunger_games/function/explosion_effect.mcfunction +0 -1
  425. package/dist/data/hunger_games/function/flames.mcfunction +0 -1
  426. package/dist/data/hunger_games/function/game_tick.mcfunction +0 -1
  427. package/dist/data/hunger_games/function/glass_box.mcfunction +0 -2
  428. package/dist/data/hunger_games/function/glow.mcfunction +0 -1
  429. package/dist/data/hunger_games/function/happy_at.mcfunction +0 -1
  430. package/dist/data/hunger_games/function/hearts_at.mcfunction +0 -1
  431. package/dist/data/hunger_games/function/hide_bar.mcfunction +0 -4
  432. package/dist/data/hunger_games/function/init.mcfunction +0 -7
  433. package/dist/data/hunger_games/function/invisible.mcfunction +0 -1
  434. package/dist/data/hunger_games/function/jump.mcfunction +0 -1
  435. package/dist/data/hunger_games/function/load.mcfunction +0 -1
  436. package/dist/data/hunger_games/function/main_game_tick.mcfunction +0 -4
  437. package/dist/data/hunger_games/function/night_vision.mcfunction +0 -1
  438. package/dist/data/hunger_games/function/on_player_death.mcfunction +0 -14
  439. package/dist/data/hunger_games/function/portal_effect.mcfunction +0 -1
  440. package/dist/data/hunger_games/function/regen.mcfunction +0 -1
  441. package/dist/data/hunger_games/function/remove_bar.mcfunction +0 -3
  442. package/dist/data/hunger_games/function/remove_bar__const_0.mcfunction +0 -2
  443. package/dist/data/hunger_games/function/reset_game.mcfunction +0 -3
  444. package/dist/data/hunger_games/function/reset_game__foreach_t0.mcfunction +0 -9
  445. package/dist/data/hunger_games/function/resistance.mcfunction +0 -1
  446. package/dist/data/hunger_games/function/set_day.mcfunction +0 -1
  447. package/dist/data/hunger_games/function/set_easy.mcfunction +0 -1
  448. package/dist/data/hunger_games/function/set_hard.mcfunction +0 -1
  449. package/dist/data/hunger_games/function/set_midnight.mcfunction +0 -1
  450. package/dist/data/hunger_games/function/set_night.mcfunction +0 -1
  451. package/dist/data/hunger_games/function/set_noon.mcfunction +0 -1
  452. package/dist/data/hunger_games/function/set_normal.mcfunction +0 -1
  453. package/dist/data/hunger_games/function/set_peaceful.mcfunction +0 -1
  454. package/dist/data/hunger_games/function/show_bar.mcfunction +0 -4
  455. package/dist/data/hunger_games/function/shrink_border.mcfunction +0 -1
  456. package/dist/data/hunger_games/function/slow_fall.mcfunction +0 -1
  457. package/dist/data/hunger_games/function/smoke.mcfunction +0 -1
  458. package/dist/data/hunger_games/function/sparkles_at.mcfunction +0 -1
  459. package/dist/data/hunger_games/function/speed.mcfunction +0 -1
  460. package/dist/data/hunger_games/function/start_countdown.mcfunction +0 -3
  461. package/dist/data/hunger_games/function/start_countdown__foreach_t0.mcfunction +0 -16
  462. package/dist/data/hunger_games/function/start_game.mcfunction +0 -4
  463. package/dist/data/hunger_games/function/start_game__foreach_t3.mcfunction +0 -4
  464. package/dist/data/hunger_games/function/strength.mcfunction +0 -1
  465. package/dist/data/hunger_games/function/totem_at.mcfunction +0 -1
  466. package/dist/data/hunger_games/function/update_bar.mcfunction +0 -5
  467. package/dist/data/hunger_games/function/update_bar__const_0_0.mcfunction +0 -3
  468. package/dist/data/hunger_games/function/update_bar_color.mcfunction +0 -7
  469. package/dist/data/hunger_games/function/update_bar_color__else_2.mcfunction +0 -5
  470. package/dist/data/hunger_games/function/update_bar_color__else_5.mcfunction +0 -4
  471. package/dist/data/hunger_games/function/update_bar_color__merge_1.mcfunction +0 -1
  472. package/dist/data/hunger_games/function/update_bar_color__merge_4.mcfunction +0 -1
  473. package/dist/data/hunger_games/function/update_bar_color__then_0.mcfunction +0 -4
  474. package/dist/data/hunger_games/function/update_bar_color__then_3.mcfunction +0 -4
  475. package/dist/data/hunger_games/function/weather_clear.mcfunction +0 -1
  476. package/dist/data/hunger_games/function/weather_rain.mcfunction +0 -1
  477. package/dist/data/hunger_games/function/weather_thunder.mcfunction +0 -1
  478. package/dist/data/isqrttest/function/__load.mcfunction +0 -6
  479. package/dist/data/isqrttest/function/isqrt/loop_body_4.mcfunction +0 -12
  480. package/dist/data/isqrttest/function/isqrt/loop_check_3.mcfunction +0 -5
  481. package/dist/data/isqrttest/function/isqrt/loop_exit_5.mcfunction +0 -3
  482. package/dist/data/isqrttest/function/isqrt/merge_2.mcfunction +0 -4
  483. package/dist/data/isqrttest/function/isqrt/merge_8.mcfunction +0 -6
  484. package/dist/data/isqrttest/function/isqrt/then_0.mcfunction +0 -3
  485. package/dist/data/isqrttest/function/isqrt/then_6.mcfunction +0 -3
  486. package/dist/data/isqrttest/function/isqrt.mcfunction +0 -7
  487. package/dist/data/isqrttest/function/test.mcfunction +0 -6
  488. package/dist/data/macrotest/function/get_element.mcfunction +0 -2
  489. package/dist/data/macrotest/function/load.mcfunction +0 -1
  490. package/dist/data/macrotest/function/test_dynamic_index.mcfunction +0 -2
  491. package/dist/data/mathtest/function/__load.mcfunction +0 -3
  492. package/dist/data/mathtest/function/abs/merge_2.mcfunction +0 -3
  493. package/dist/data/mathtest/function/abs/then_0.mcfunction +0 -5
  494. package/dist/data/mathtest/function/abs.mcfunction +0 -6
  495. package/dist/data/mathtest/function/test.mcfunction +0 -5
  496. package/dist/data/minecraft/tags/function/load.json +0 -5
  497. package/dist/data/minecraft/tags/function/tick.json +0 -5
  498. package/dist/data/mypack/function/__load.mcfunction +0 -13
  499. package/dist/data/mypack/function/_atan_init.mcfunction +0 -2
  500. package/dist/data/mypack/function/abs/merge_2.mcfunction +0 -3
  501. package/dist/data/mypack/function/abs/then_0.mcfunction +0 -5
  502. package/dist/data/mypack/function/abs.mcfunction +0 -6
  503. package/dist/data/mypack/function/atan2_fixed/__sgi_1.mcfunction +0 -2
  504. package/dist/data/mypack/function/atan2_fixed/else_34.mcfunction +0 -3
  505. package/dist/data/mypack/function/atan2_fixed/loop_body_31.mcfunction +0 -19
  506. package/dist/data/mypack/function/atan2_fixed/loop_check_30.mcfunction +0 -5
  507. package/dist/data/mypack/function/atan2_fixed/loop_exit_32.mcfunction +0 -6
  508. package/dist/data/mypack/function/atan2_fixed/merge_11.mcfunction +0 -6
  509. package/dist/data/mypack/function/atan2_fixed/merge_14.mcfunction +0 -3
  510. package/dist/data/mypack/function/atan2_fixed/merge_17.mcfunction +0 -6
  511. package/dist/data/mypack/function/atan2_fixed/merge_2.mcfunction +0 -5
  512. package/dist/data/mypack/function/atan2_fixed/merge_20.mcfunction +0 -5
  513. package/dist/data/mypack/function/atan2_fixed/merge_23.mcfunction +0 -5
  514. package/dist/data/mypack/function/atan2_fixed/merge_26.mcfunction +0 -6
  515. package/dist/data/mypack/function/atan2_fixed/merge_29.mcfunction +0 -4
  516. package/dist/data/mypack/function/atan2_fixed/merge_38.mcfunction +0 -5
  517. package/dist/data/mypack/function/atan2_fixed/merge_41.mcfunction +0 -5
  518. package/dist/data/mypack/function/atan2_fixed/merge_44.mcfunction +0 -5
  519. package/dist/data/mypack/function/atan2_fixed/merge_47.mcfunction +0 -5
  520. package/dist/data/mypack/function/atan2_fixed/merge_5.mcfunction +0 -5
  521. package/dist/data/mypack/function/atan2_fixed/merge_8.mcfunction +0 -3
  522. package/dist/data/mypack/function/atan2_fixed/then_0.mcfunction +0 -5
  523. package/dist/data/mypack/function/atan2_fixed/then_12.mcfunction +0 -3
  524. package/dist/data/mypack/function/atan2_fixed/then_15.mcfunction +0 -5
  525. package/dist/data/mypack/function/atan2_fixed/then_18.mcfunction +0 -5
  526. package/dist/data/mypack/function/atan2_fixed/then_21.mcfunction +0 -3
  527. package/dist/data/mypack/function/atan2_fixed/then_24.mcfunction +0 -3
  528. package/dist/data/mypack/function/atan2_fixed/then_27.mcfunction +0 -6
  529. package/dist/data/mypack/function/atan2_fixed/then_3.mcfunction +0 -3
  530. package/dist/data/mypack/function/atan2_fixed/then_33.mcfunction +0 -5
  531. package/dist/data/mypack/function/atan2_fixed/then_36.mcfunction +0 -5
  532. package/dist/data/mypack/function/atan2_fixed/then_39.mcfunction +0 -5
  533. package/dist/data/mypack/function/atan2_fixed/then_42.mcfunction +0 -3
  534. package/dist/data/mypack/function/atan2_fixed/then_45.mcfunction +0 -5
  535. package/dist/data/mypack/function/atan2_fixed/then_6.mcfunction +0 -3
  536. package/dist/data/mypack/function/atan2_fixed/then_9.mcfunction +0 -5
  537. package/dist/data/mypack/function/atan2_fixed.mcfunction +0 -7
  538. package/dist/data/mypack/function/my_game.mcfunction +0 -10
  539. package/dist/data/parkour_race/function/angry_at.mcfunction +0 -1
  540. package/dist/data/parkour_race/function/barrier_wall.mcfunction +0 -1
  541. package/dist/data/parkour_race/function/buff_all.mcfunction +0 -22
  542. package/dist/data/parkour_race/function/check_checkpoints.mcfunction +0 -11
  543. package/dist/data/parkour_race/function/check_checkpoints__exec_t11.mcfunction +0 -4
  544. package/dist/data/parkour_race/function/check_checkpoints__exec_t13.mcfunction +0 -3
  545. package/dist/data/parkour_race/function/check_checkpoints__exec_t5.mcfunction +0 -4
  546. package/dist/data/parkour_race/function/check_checkpoints__exec_t7.mcfunction +0 -4
  547. package/dist/data/parkour_race/function/check_checkpoints__exec_t9.mcfunction +0 -4
  548. package/dist/data/parkour_race/function/check_checkpoints__merge_1.mcfunction +0 -5
  549. package/dist/data/parkour_race/function/check_checkpoints__merge_3.mcfunction +0 -5
  550. package/dist/data/parkour_race/function/check_checkpoints__merge_5.mcfunction +0 -5
  551. package/dist/data/parkour_race/function/check_checkpoints__merge_7.mcfunction +0 -5
  552. package/dist/data/parkour_race/function/check_checkpoints__merge_9.mcfunction +0 -1
  553. package/dist/data/parkour_race/function/check_checkpoints__then_0.mcfunction +0 -2
  554. package/dist/data/parkour_race/function/check_checkpoints__then_2.mcfunction +0 -2
  555. package/dist/data/parkour_race/function/check_checkpoints__then_4.mcfunction +0 -2
  556. package/dist/data/parkour_race/function/check_checkpoints__then_6.mcfunction +0 -2
  557. package/dist/data/parkour_race/function/check_checkpoints__then_8.mcfunction +0 -2
  558. package/dist/data/parkour_race/function/check_fall.mcfunction +0 -1
  559. package/dist/data/parkour_race/function/check_fall__exec_t1.mcfunction +0 -10
  560. package/dist/data/parkour_race/function/clear_area.mcfunction +0 -1
  561. package/dist/data/parkour_race/function/clear_effect.mcfunction +0 -1
  562. package/dist/data/parkour_race/function/clear_effects.mcfunction +0 -1
  563. package/dist/data/parkour_race/function/create_health_bar.mcfunction +0 -24
  564. package/dist/data/parkour_race/function/create_progress_bar.mcfunction +0 -24
  565. package/dist/data/parkour_race/function/create_timer_bar.mcfunction +0 -30
  566. package/dist/data/parkour_race/function/disable_fire_spread.mcfunction +0 -1
  567. package/dist/data/parkour_race/function/disable_keep_inventory.mcfunction +0 -1
  568. package/dist/data/parkour_race/function/disable_mob_griefing.mcfunction +0 -1
  569. package/dist/data/parkour_race/function/enable_keep_inventory.mcfunction +0 -1
  570. package/dist/data/parkour_race/function/end_sparkles_at.mcfunction +0 -1
  571. package/dist/data/parkour_race/function/explosion_effect.mcfunction +0 -1
  572. package/dist/data/parkour_race/function/finish_race.mcfunction +0 -20
  573. package/dist/data/parkour_race/function/finish_race__else_2.mcfunction +0 -4
  574. package/dist/data/parkour_race/function/finish_race__else_5.mcfunction +0 -3
  575. package/dist/data/parkour_race/function/finish_race__merge_1.mcfunction +0 -3
  576. package/dist/data/parkour_race/function/finish_race__merge_4.mcfunction +0 -1
  577. package/dist/data/parkour_race/function/finish_race__then_0.mcfunction +0 -8
  578. package/dist/data/parkour_race/function/finish_race__then_3.mcfunction +0 -10
  579. package/dist/data/parkour_race/function/flames.mcfunction +0 -1
  580. package/dist/data/parkour_race/function/glass_box.mcfunction +0 -2
  581. package/dist/data/parkour_race/function/glow.mcfunction +0 -1
  582. package/dist/data/parkour_race/function/happy_at.mcfunction +0 -1
  583. package/dist/data/parkour_race/function/hearts_at.mcfunction +0 -1
  584. package/dist/data/parkour_race/function/hide_bar.mcfunction +0 -4
  585. package/dist/data/parkour_race/function/init.mcfunction +0 -18
  586. package/dist/data/parkour_race/function/invisible.mcfunction +0 -1
  587. package/dist/data/parkour_race/function/jump.mcfunction +0 -1
  588. package/dist/data/parkour_race/function/load.mcfunction +0 -1
  589. package/dist/data/parkour_race/function/night_vision.mcfunction +0 -1
  590. package/dist/data/parkour_race/function/portal_effect.mcfunction +0 -1
  591. package/dist/data/parkour_race/function/quit_race.mcfunction +0 -10
  592. package/dist/data/parkour_race/function/quit_race__merge_1.mcfunction +0 -1
  593. package/dist/data/parkour_race/function/quit_race__then_0.mcfunction +0 -11
  594. package/dist/data/parkour_race/function/race_tick.mcfunction +0 -1
  595. package/dist/data/parkour_race/function/race_tick__foreach_t0.mcfunction +0 -10
  596. package/dist/data/parkour_race/function/race_tick__foreach_t0__merge_1.mcfunction +0 -1
  597. package/dist/data/parkour_race/function/race_tick__foreach_t0__then_0.mcfunction +0 -13
  598. package/dist/data/parkour_race/function/reach_checkpoint.mcfunction +0 -11
  599. package/dist/data/parkour_race/function/regen.mcfunction +0 -1
  600. package/dist/data/parkour_race/function/remove_bar.mcfunction +0 -3
  601. package/dist/data/parkour_race/function/resistance.mcfunction +0 -1
  602. package/dist/data/parkour_race/function/respawn_at_checkpoint.mcfunction +0 -7
  603. package/dist/data/parkour_race/function/respawn_at_checkpoint__merge_1.mcfunction +0 -5
  604. package/dist/data/parkour_race/function/respawn_at_checkpoint__merge_3.mcfunction +0 -5
  605. package/dist/data/parkour_race/function/respawn_at_checkpoint__merge_5.mcfunction +0 -5
  606. package/dist/data/parkour_race/function/respawn_at_checkpoint__merge_7.mcfunction +0 -5
  607. package/dist/data/parkour_race/function/respawn_at_checkpoint__merge_9.mcfunction +0 -1
  608. package/dist/data/parkour_race/function/respawn_at_checkpoint__then_0.mcfunction +0 -6
  609. package/dist/data/parkour_race/function/respawn_at_checkpoint__then_2.mcfunction +0 -6
  610. package/dist/data/parkour_race/function/respawn_at_checkpoint__then_4.mcfunction +0 -6
  611. package/dist/data/parkour_race/function/respawn_at_checkpoint__then_6.mcfunction +0 -6
  612. package/dist/data/parkour_race/function/respawn_at_checkpoint__then_8.mcfunction +0 -6
  613. package/dist/data/parkour_race/function/set_day.mcfunction +0 -1
  614. package/dist/data/parkour_race/function/set_easy.mcfunction +0 -1
  615. package/dist/data/parkour_race/function/set_hard.mcfunction +0 -1
  616. package/dist/data/parkour_race/function/set_midnight.mcfunction +0 -1
  617. package/dist/data/parkour_race/function/set_night.mcfunction +0 -1
  618. package/dist/data/parkour_race/function/set_noon.mcfunction +0 -1
  619. package/dist/data/parkour_race/function/set_normal.mcfunction +0 -1
  620. package/dist/data/parkour_race/function/set_peaceful.mcfunction +0 -1
  621. package/dist/data/parkour_race/function/show_bar.mcfunction +0 -4
  622. package/dist/data/parkour_race/function/show_leaderboard.mcfunction +0 -4
  623. package/dist/data/parkour_race/function/slow_fall.mcfunction +0 -1
  624. package/dist/data/parkour_race/function/smoke.mcfunction +0 -1
  625. package/dist/data/parkour_race/function/sparkles_at.mcfunction +0 -1
  626. package/dist/data/parkour_race/function/speed.mcfunction +0 -1
  627. package/dist/data/parkour_race/function/start_race.mcfunction +0 -10
  628. package/dist/data/parkour_race/function/start_race__merge_1.mcfunction +0 -23
  629. package/dist/data/parkour_race/function/start_race__then_0.mcfunction +0 -1
  630. package/dist/data/parkour_race/function/strength.mcfunction +0 -1
  631. package/dist/data/parkour_race/function/totem_at.mcfunction +0 -1
  632. package/dist/data/parkour_race/function/update_bar.mcfunction +0 -5
  633. package/dist/data/parkour_race/function/update_bar_color.mcfunction +0 -7
  634. package/dist/data/parkour_race/function/update_bar_color__else_2.mcfunction +0 -5
  635. package/dist/data/parkour_race/function/update_bar_color__else_5.mcfunction +0 -4
  636. package/dist/data/parkour_race/function/update_bar_color__merge_1.mcfunction +0 -1
  637. package/dist/data/parkour_race/function/update_bar_color__merge_4.mcfunction +0 -1
  638. package/dist/data/parkour_race/function/update_bar_color__then_0.mcfunction +0 -4
  639. package/dist/data/parkour_race/function/update_bar_color__then_3.mcfunction +0 -4
  640. package/dist/data/parkour_race/function/weather_clear.mcfunction +0 -1
  641. package/dist/data/parkour_race/function/weather_rain.mcfunction +0 -1
  642. package/dist/data/parkour_race/function/weather_thunder.mcfunction +0 -1
  643. package/dist/data/quiz/function/__load.mcfunction +0 -16
  644. package/dist/data/quiz/function/__tick.mcfunction +0 -6
  645. package/dist/data/quiz/function/__trigger_quiz_a_dispatch.mcfunction +0 -4
  646. package/dist/data/quiz/function/__trigger_quiz_b_dispatch.mcfunction +0 -4
  647. package/dist/data/quiz/function/__trigger_quiz_c_dispatch.mcfunction +0 -4
  648. package/dist/data/quiz/function/__trigger_quiz_start_dispatch.mcfunction +0 -4
  649. package/dist/data/quiz/function/answer_a.mcfunction +0 -4
  650. package/dist/data/quiz/function/answer_b.mcfunction +0 -4
  651. package/dist/data/quiz/function/answer_c.mcfunction +0 -4
  652. package/dist/data/quiz/function/ask_question/else_1.mcfunction +0 -5
  653. package/dist/data/quiz/function/ask_question/else_4.mcfunction +0 -5
  654. package/dist/data/quiz/function/ask_question/else_7.mcfunction +0 -4
  655. package/dist/data/quiz/function/ask_question/merge_2.mcfunction +0 -1
  656. package/dist/data/quiz/function/ask_question/merge_5.mcfunction +0 -2
  657. package/dist/data/quiz/function/ask_question/merge_8.mcfunction +0 -2
  658. package/dist/data/quiz/function/ask_question/then_0.mcfunction +0 -4
  659. package/dist/data/quiz/function/ask_question/then_3.mcfunction +0 -4
  660. package/dist/data/quiz/function/ask_question/then_6.mcfunction +0 -4
  661. package/dist/data/quiz/function/ask_question.mcfunction +0 -7
  662. package/dist/data/quiz/function/finish_quiz.mcfunction +0 -6
  663. package/dist/data/quiz/function/handle_answer/else_1.mcfunction +0 -5
  664. package/dist/data/quiz/function/handle_answer/else_10.mcfunction +0 -3
  665. package/dist/data/quiz/function/handle_answer/else_16.mcfunction +0 -3
  666. package/dist/data/quiz/function/handle_answer/else_4.mcfunction +0 -3
  667. package/dist/data/quiz/function/handle_answer/else_7.mcfunction +0 -5
  668. package/dist/data/quiz/function/handle_answer/merge_11.mcfunction +0 -2
  669. package/dist/data/quiz/function/handle_answer/merge_14.mcfunction +0 -2
  670. package/dist/data/quiz/function/handle_answer/merge_17.mcfunction +0 -2
  671. package/dist/data/quiz/function/handle_answer/merge_2.mcfunction +0 -8
  672. package/dist/data/quiz/function/handle_answer/merge_5.mcfunction +0 -2
  673. package/dist/data/quiz/function/handle_answer/merge_8.mcfunction +0 -2
  674. package/dist/data/quiz/function/handle_answer/then_0.mcfunction +0 -5
  675. package/dist/data/quiz/function/handle_answer/then_12.mcfunction +0 -5
  676. package/dist/data/quiz/function/handle_answer/then_15.mcfunction +0 -6
  677. package/dist/data/quiz/function/handle_answer/then_3.mcfunction +0 -6
  678. package/dist/data/quiz/function/handle_answer/then_6.mcfunction +0 -5
  679. package/dist/data/quiz/function/handle_answer/then_9.mcfunction +0 -6
  680. package/dist/data/quiz/function/handle_answer.mcfunction +0 -11
  681. package/dist/data/quiz/function/start_quiz.mcfunction +0 -5
  682. package/dist/data/rawtest/function/load.mcfunction +0 -1
  683. package/dist/data/rawtest/function/test.mcfunction +0 -2
  684. package/dist/data/reqtest/function/__load.mcfunction +0 -4
  685. package/dist/data/reqtest/function/_table_init.mcfunction +0 -2
  686. package/dist/data/reqtest/function/no_trig.mcfunction +0 -3
  687. package/dist/data/reqtest/function/use_table.mcfunction +0 -4
  688. package/dist/data/reqtest2/function/__load.mcfunction +0 -3
  689. package/dist/data/reqtest2/function/no_trig.mcfunction +0 -3
  690. package/dist/data/runtime/function/__load.mcfunction +0 -5
  691. package/dist/data/runtime/function/__tick.mcfunction +0 -2
  692. package/dist/data/runtime/function/counter_tick/then_0.mcfunction +0 -3
  693. package/dist/data/runtime/function/counter_tick.mcfunction +0 -13
  694. package/dist/data/shop/function/__load.mcfunction +0 -7
  695. package/dist/data/shop/function/__tick.mcfunction +0 -3
  696. package/dist/data/shop/function/__trigger_shop_buy_dispatch.mcfunction +0 -4
  697. package/dist/data/shop/function/complete_purchase/else_1.mcfunction +0 -5
  698. package/dist/data/shop/function/complete_purchase/else_4.mcfunction +0 -5
  699. package/dist/data/shop/function/complete_purchase/else_7.mcfunction +0 -3
  700. package/dist/data/shop/function/complete_purchase/merge_2.mcfunction +0 -2
  701. package/dist/data/shop/function/complete_purchase/merge_5.mcfunction +0 -2
  702. package/dist/data/shop/function/complete_purchase/merge_8.mcfunction +0 -2
  703. package/dist/data/shop/function/complete_purchase/then_0.mcfunction +0 -4
  704. package/dist/data/shop/function/complete_purchase/then_3.mcfunction +0 -4
  705. package/dist/data/shop/function/complete_purchase/then_6.mcfunction +0 -4
  706. package/dist/data/shop/function/complete_purchase.mcfunction +0 -7
  707. package/dist/data/shop/function/handle_shop_trigger.mcfunction +0 -3
  708. package/dist/data/swap_test/function/__load.mcfunction +0 -3
  709. package/dist/data/swap_test/function/gcd_old/loop_body_1.mcfunction +0 -7
  710. package/dist/data/swap_test/function/gcd_old/loop_check_0.mcfunction +0 -5
  711. package/dist/data/swap_test/function/gcd_old/loop_exit_2.mcfunction +0 -3
  712. package/dist/data/swap_test/function/gcd_old.mcfunction +0 -8
  713. package/dist/data/test/function/_atan_init.mcfunction +0 -4
  714. package/dist/data/test/function/_hsl_chroma_x.mcfunction +0 -11
  715. package/dist/data/test/function/_hsl_chroma_x__merge_1.mcfunction +0 -6
  716. package/dist/data/test/function/_hsl_chroma_x__then_0.mcfunction +0 -4
  717. package/dist/data/test/function/_math_init.mcfunction +0 -4
  718. package/dist/data/test/function/aabb_contains.mcfunction +0 -13
  719. package/dist/data/test/function/aabb_contains__merge_1.mcfunction +0 -4
  720. package/dist/data/test/function/aabb_contains__merge_10.mcfunction +0 -4
  721. package/dist/data/test/function/aabb_contains__merge_13.mcfunction +0 -4
  722. package/dist/data/test/function/aabb_contains__merge_16.mcfunction +0 -2
  723. package/dist/data/test/function/aabb_contains__merge_4.mcfunction +0 -4
  724. package/dist/data/test/function/aabb_contains__merge_7.mcfunction +0 -4
  725. package/dist/data/test/function/aabb_contains__then_0.mcfunction +0 -2
  726. package/dist/data/test/function/aabb_contains__then_12.mcfunction +0 -2
  727. package/dist/data/test/function/aabb_contains__then_15.mcfunction +0 -2
  728. package/dist/data/test/function/aabb_contains__then_3.mcfunction +0 -2
  729. package/dist/data/test/function/aabb_contains__then_6.mcfunction +0 -2
  730. package/dist/data/test/function/aabb_contains__then_9.mcfunction +0 -2
  731. package/dist/data/test/function/add2d_x.mcfunction +0 -5
  732. package/dist/data/test/function/add2d_y.mcfunction +0 -5
  733. package/dist/data/test/function/add3d_x.mcfunction +0 -5
  734. package/dist/data/test/function/add3d_y.mcfunction +0 -5
  735. package/dist/data/test/function/add3d_z.mcfunction +0 -5
  736. package/dist/data/test/function/angle_diff.mcfunction +0 -13
  737. package/dist/data/test/function/angle_diff__merge_1.mcfunction +0 -1
  738. package/dist/data/test/function/angle_diff__then_0.mcfunction +0 -4
  739. package/dist/data/test/function/angle_normalize.mcfunction +0 -3
  740. package/dist/data/test/function/angle_normalize__loop_body_1.mcfunction +0 -4
  741. package/dist/data/test/function/angle_normalize__loop_body_4.mcfunction +0 -4
  742. package/dist/data/test/function/angle_normalize__loop_exit_2.mcfunction +0 -1
  743. package/dist/data/test/function/angle_normalize__loop_exit_5.mcfunction +0 -1
  744. package/dist/data/test/function/angle_normalize__loop_header_0.mcfunction +0 -5
  745. package/dist/data/test/function/angle_normalize__loop_header_3.mcfunction +0 -5
  746. package/dist/data/test/function/approx_eq.mcfunction +0 -11
  747. package/dist/data/test/function/approx_eq__merge_1.mcfunction +0 -4
  748. package/dist/data/test/function/approx_eq__merge_3.mcfunction +0 -2
  749. package/dist/data/test/function/approx_eq__then_0.mcfunction +0 -4
  750. package/dist/data/test/function/approx_eq__then_2.mcfunction +0 -2
  751. package/dist/data/test/function/atan2_fixed.mcfunction +0 -7
  752. package/dist/data/test/function/atan2_fixed__else_30.mcfunction +0 -2
  753. package/dist/data/test/function/atan2_fixed__loop_body_26.mcfunction +0 -22
  754. package/dist/data/test/function/atan2_fixed__loop_exit_27.mcfunction +0 -6
  755. package/dist/data/test/function/atan2_fixed__loop_header_25.mcfunction +0 -4
  756. package/dist/data/test/function/atan2_fixed__merge_1.mcfunction +0 -5
  757. package/dist/data/test/function/atan2_fixed__merge_10.mcfunction +0 -6
  758. package/dist/data/test/function/atan2_fixed__merge_12.mcfunction +0 -2
  759. package/dist/data/test/function/atan2_fixed__merge_16.mcfunction +0 -6
  760. package/dist/data/test/function/atan2_fixed__merge_18.mcfunction +0 -5
  761. package/dist/data/test/function/atan2_fixed__merge_20.mcfunction +0 -5
  762. package/dist/data/test/function/atan2_fixed__merge_22.mcfunction +0 -5
  763. package/dist/data/test/function/atan2_fixed__merge_24.mcfunction +0 -3
  764. package/dist/data/test/function/atan2_fixed__merge_29.mcfunction +0 -1
  765. package/dist/data/test/function/atan2_fixed__merge_3.mcfunction +0 -5
  766. package/dist/data/test/function/atan2_fixed__merge_32.mcfunction +0 -5
  767. package/dist/data/test/function/atan2_fixed__merge_34.mcfunction +0 -5
  768. package/dist/data/test/function/atan2_fixed__merge_36.mcfunction +0 -3
  769. package/dist/data/test/function/atan2_fixed__merge_40.mcfunction +0 -3
  770. package/dist/data/test/function/atan2_fixed__merge_6.mcfunction +0 -2
  771. package/dist/data/test/function/atan2_fixed__then_0.mcfunction +0 -5
  772. package/dist/data/test/function/atan2_fixed__then_11.mcfunction +0 -2
  773. package/dist/data/test/function/atan2_fixed__then_15.mcfunction +0 -4
  774. package/dist/data/test/function/atan2_fixed__then_17.mcfunction +0 -4
  775. package/dist/data/test/function/atan2_fixed__then_19.mcfunction +0 -2
  776. package/dist/data/test/function/atan2_fixed__then_2.mcfunction +0 -2
  777. package/dist/data/test/function/atan2_fixed__then_21.mcfunction +0 -2
  778. package/dist/data/test/function/atan2_fixed__then_23.mcfunction +0 -5
  779. package/dist/data/test/function/atan2_fixed__then_28.mcfunction +0 -4
  780. package/dist/data/test/function/atan2_fixed__then_31.mcfunction +0 -4
  781. package/dist/data/test/function/atan2_fixed__then_33.mcfunction +0 -5
  782. package/dist/data/test/function/atan2_fixed__then_35.mcfunction +0 -1
  783. package/dist/data/test/function/atan2_fixed__then_39.mcfunction +0 -3
  784. package/dist/data/test/function/atan2_fixed__then_5.mcfunction +0 -2
  785. package/dist/data/test/function/atan2_fixed__then_9.mcfunction +0 -5
  786. package/dist/data/test/function/avg3.mcfunction +0 -11
  787. package/dist/data/test/function/avg5.mcfunction +0 -17
  788. package/dist/data/test/function/bernoulli.mcfunction +0 -13
  789. package/dist/data/test/function/bernoulli__merge_1.mcfunction +0 -7
  790. package/dist/data/test/function/bernoulli__merge_3.mcfunction +0 -2
  791. package/dist/data/test/function/bernoulli__then_0.mcfunction +0 -4
  792. package/dist/data/test/function/bernoulli__then_2.mcfunction +0 -2
  793. package/dist/data/test/function/bigint3_add_hi.mcfunction +0 -11
  794. package/dist/data/test/function/bigint3_add_lo.mcfunction +0 -8
  795. package/dist/data/test/function/bigint3_add_mid.mcfunction +0 -11
  796. package/dist/data/test/function/bigint3_borrow_lo.mcfunction +0 -6
  797. package/dist/data/test/function/bigint3_borrow_lo__merge_1.mcfunction +0 -2
  798. package/dist/data/test/function/bigint3_borrow_lo__then_0.mcfunction +0 -2
  799. package/dist/data/test/function/bigint3_borrow_mid.mcfunction +0 -9
  800. package/dist/data/test/function/bigint3_borrow_mid__merge_1.mcfunction +0 -2
  801. package/dist/data/test/function/bigint3_borrow_mid__then_0.mcfunction +0 -2
  802. package/dist/data/test/function/bigint3_carry_lo.mcfunction +0 -8
  803. package/dist/data/test/function/bigint3_carry_mid.mcfunction +0 -11
  804. package/dist/data/test/function/bigint3_cmp.mcfunction +0 -10
  805. package/dist/data/test/function/bigint3_cmp__merge_1.mcfunction +0 -4
  806. package/dist/data/test/function/bigint3_cmp__merge_10.mcfunction +0 -4
  807. package/dist/data/test/function/bigint3_cmp__merge_13.mcfunction +0 -4
  808. package/dist/data/test/function/bigint3_cmp__merge_16.mcfunction +0 -2
  809. package/dist/data/test/function/bigint3_cmp__merge_4.mcfunction +0 -4
  810. package/dist/data/test/function/bigint3_cmp__merge_7.mcfunction +0 -4
  811. package/dist/data/test/function/bigint3_cmp__then_0.mcfunction +0 -2
  812. package/dist/data/test/function/bigint3_cmp__then_12.mcfunction +0 -2
  813. package/dist/data/test/function/bigint3_cmp__then_15.mcfunction +0 -2
  814. package/dist/data/test/function/bigint3_cmp__then_3.mcfunction +0 -2
  815. package/dist/data/test/function/bigint3_cmp__then_6.mcfunction +0 -2
  816. package/dist/data/test/function/bigint3_cmp__then_9.mcfunction +0 -2
  817. package/dist/data/test/function/bigint3_div_chunk.mcfunction +0 -11
  818. package/dist/data/test/function/bigint3_mul1_hi.mcfunction +0 -8
  819. package/dist/data/test/function/bigint3_mul1_lo.mcfunction +0 -8
  820. package/dist/data/test/function/bigint3_mul1_mid.mcfunction +0 -2
  821. package/dist/data/test/function/bigint3_rem_chunk.mcfunction +0 -11
  822. package/dist/data/test/function/bigint3_sub_hi.mcfunction +0 -8
  823. package/dist/data/test/function/bigint3_sub_lo.mcfunction +0 -6
  824. package/dist/data/test/function/bigint3_sub_lo__merge_1.mcfunction +0 -5
  825. package/dist/data/test/function/bigint3_sub_lo__then_0.mcfunction +0 -3
  826. package/dist/data/test/function/bigint3_sub_mid.mcfunction +0 -13
  827. package/dist/data/test/function/bigint3_sub_mid__merge_1.mcfunction +0 -1
  828. package/dist/data/test/function/bigint3_sub_mid__then_0.mcfunction +0 -4
  829. package/dist/data/test/function/bigint3_to_int32.mcfunction +0 -14
  830. package/dist/data/test/function/bigint_base.mcfunction +0 -2
  831. package/dist/data/test/function/bit_and.mcfunction +0 -6
  832. package/dist/data/test/function/bit_and__loop_body_1.mcfunction +0 -10
  833. package/dist/data/test/function/bit_and__loop_exit_2.mcfunction +0 -1
  834. package/dist/data/test/function/bit_and__loop_header_0.mcfunction +0 -5
  835. package/dist/data/test/function/bit_and__merge_4.mcfunction +0 -8
  836. package/dist/data/test/function/bit_and__merge_6.mcfunction +0 -1
  837. package/dist/data/test/function/bit_and__then_3.mcfunction +0 -10
  838. package/dist/data/test/function/bit_and__then_5.mcfunction +0 -4
  839. package/dist/data/test/function/bit_clear.mcfunction +0 -5
  840. package/dist/data/test/function/bit_clear__loop_body_1.mcfunction +0 -8
  841. package/dist/data/test/function/bit_clear__loop_exit_2.mcfunction +0 -10
  842. package/dist/data/test/function/bit_clear__loop_header_0.mcfunction +0 -4
  843. package/dist/data/test/function/bit_clear__merge_4.mcfunction +0 -1
  844. package/dist/data/test/function/bit_clear__then_3.mcfunction +0 -3
  845. package/dist/data/test/function/bit_get.mcfunction +0 -5
  846. package/dist/data/test/function/bit_get__loop_body_1.mcfunction +0 -8
  847. package/dist/data/test/function/bit_get__loop_exit_2.mcfunction +0 -6
  848. package/dist/data/test/function/bit_get__loop_header_0.mcfunction +0 -4
  849. package/dist/data/test/function/bit_not.mcfunction +0 -5
  850. package/dist/data/test/function/bit_not__loop_body_1.mcfunction +0 -10
  851. package/dist/data/test/function/bit_not__loop_exit_2.mcfunction +0 -1
  852. package/dist/data/test/function/bit_not__loop_header_0.mcfunction +0 -5
  853. package/dist/data/test/function/bit_not__merge_4.mcfunction +0 -8
  854. package/dist/data/test/function/bit_not__then_3.mcfunction +0 -4
  855. package/dist/data/test/function/bit_or.mcfunction +0 -6
  856. package/dist/data/test/function/bit_or__loop_body_1.mcfunction +0 -10
  857. package/dist/data/test/function/bit_or__loop_exit_2.mcfunction +0 -1
  858. package/dist/data/test/function/bit_or__loop_header_0.mcfunction +0 -5
  859. package/dist/data/test/function/bit_or__merge_4.mcfunction +0 -10
  860. package/dist/data/test/function/bit_or__merge_6.mcfunction +0 -8
  861. package/dist/data/test/function/bit_or__merge_8.mcfunction +0 -1
  862. package/dist/data/test/function/bit_or__then_3.mcfunction +0 -4
  863. package/dist/data/test/function/bit_or__then_5.mcfunction +0 -10
  864. package/dist/data/test/function/bit_or__then_7.mcfunction +0 -4
  865. package/dist/data/test/function/bit_set.mcfunction +0 -5
  866. package/dist/data/test/function/bit_set__loop_body_1.mcfunction +0 -8
  867. package/dist/data/test/function/bit_set__loop_exit_2.mcfunction +0 -10
  868. package/dist/data/test/function/bit_set__loop_header_0.mcfunction +0 -4
  869. package/dist/data/test/function/bit_set__merge_4.mcfunction +0 -1
  870. package/dist/data/test/function/bit_set__then_3.mcfunction +0 -3
  871. package/dist/data/test/function/bit_shl.mcfunction +0 -5
  872. package/dist/data/test/function/bit_shl__loop_body_1.mcfunction +0 -8
  873. package/dist/data/test/function/bit_shl__loop_exit_2.mcfunction +0 -1
  874. package/dist/data/test/function/bit_shl__loop_header_0.mcfunction +0 -4
  875. package/dist/data/test/function/bit_shr.mcfunction +0 -5
  876. package/dist/data/test/function/bit_shr__loop_body_1.mcfunction +0 -8
  877. package/dist/data/test/function/bit_shr__loop_exit_2.mcfunction +0 -1
  878. package/dist/data/test/function/bit_shr__loop_header_0.mcfunction +0 -4
  879. package/dist/data/test/function/bit_toggle.mcfunction +0 -5
  880. package/dist/data/test/function/bit_toggle__loop_body_1.mcfunction +0 -8
  881. package/dist/data/test/function/bit_toggle__loop_exit_2.mcfunction +0 -10
  882. package/dist/data/test/function/bit_toggle__loop_header_0.mcfunction +0 -4
  883. package/dist/data/test/function/bit_toggle__merge_4.mcfunction +0 -3
  884. package/dist/data/test/function/bit_toggle__then_3.mcfunction +0 -3
  885. package/dist/data/test/function/bit_xor.mcfunction +0 -6
  886. package/dist/data/test/function/bit_xor__loop_body_1.mcfunction +0 -14
  887. package/dist/data/test/function/bit_xor__loop_exit_2.mcfunction +0 -1
  888. package/dist/data/test/function/bit_xor__loop_header_0.mcfunction +0 -5
  889. package/dist/data/test/function/bit_xor__merge_4.mcfunction +0 -8
  890. package/dist/data/test/function/bit_xor__then_3.mcfunction +0 -4
  891. package/dist/data/test/function/cbrt_fx.mcfunction +0 -6
  892. package/dist/data/test/function/cbrt_fx__loop_body_6.mcfunction +0 -8
  893. package/dist/data/test/function/cbrt_fx__loop_exit_7.mcfunction +0 -1
  894. package/dist/data/test/function/cbrt_fx__loop_header_5.mcfunction +0 -5
  895. package/dist/data/test/function/cbrt_fx__merge_1.mcfunction +0 -9
  896. package/dist/data/test/function/cbrt_fx__merge_11.mcfunction +0 -6
  897. package/dist/data/test/function/cbrt_fx__merge_13.mcfunction +0 -4
  898. package/dist/data/test/function/cbrt_fx__merge_4.mcfunction +0 -2
  899. package/dist/data/test/function/cbrt_fx__merge_9.mcfunction +0 -14
  900. package/dist/data/test/function/cbrt_fx__then_0.mcfunction +0 -2
  901. package/dist/data/test/function/cbrt_fx__then_10.mcfunction +0 -2
  902. package/dist/data/test/function/cbrt_fx__then_12.mcfunction +0 -2
  903. package/dist/data/test/function/cbrt_fx__then_3.mcfunction +0 -2
  904. package/dist/data/test/function/cbrt_fx__then_8.mcfunction +0 -2
  905. package/dist/data/test/function/ceil_div.mcfunction +0 -9
  906. package/dist/data/test/function/chebyshev.mcfunction +0 -15
  907. package/dist/data/test/function/chebyshev3d.mcfunction +0 -20
  908. package/dist/data/test/function/chebyshev3d__merge_1.mcfunction +0 -5
  909. package/dist/data/test/function/chebyshev3d__merge_3.mcfunction +0 -5
  910. package/dist/data/test/function/chebyshev3d__merge_5.mcfunction +0 -5
  911. package/dist/data/test/function/chebyshev3d__merge_7.mcfunction +0 -4
  912. package/dist/data/test/function/chebyshev3d__merge_9.mcfunction +0 -1
  913. package/dist/data/test/function/chebyshev3d__then_0.mcfunction +0 -4
  914. package/dist/data/test/function/chebyshev3d__then_2.mcfunction +0 -4
  915. package/dist/data/test/function/chebyshev3d__then_4.mcfunction +0 -4
  916. package/dist/data/test/function/chebyshev3d__then_6.mcfunction +0 -2
  917. package/dist/data/test/function/chebyshev3d__then_8.mcfunction +0 -2
  918. package/dist/data/test/function/chebyshev__merge_1.mcfunction +0 -5
  919. package/dist/data/test/function/chebyshev__merge_3.mcfunction +0 -4
  920. package/dist/data/test/function/chebyshev__merge_5.mcfunction +0 -1
  921. package/dist/data/test/function/chebyshev__then_0.mcfunction +0 -4
  922. package/dist/data/test/function/chebyshev__then_2.mcfunction +0 -4
  923. package/dist/data/test/function/chebyshev__then_4.mcfunction +0 -1
  924. package/dist/data/test/function/chunk_hi.mcfunction +0 -5
  925. package/dist/data/test/function/chunk_lo.mcfunction +0 -5
  926. package/dist/data/test/function/clamp3.mcfunction +0 -7
  927. package/dist/data/test/function/clamp3__merge_1.mcfunction +0 -4
  928. package/dist/data/test/function/clamp3__merge_4.mcfunction +0 -1
  929. package/dist/data/test/function/clamp3__then_0.mcfunction +0 -1
  930. package/dist/data/test/function/clamp3__then_3.mcfunction +0 -1
  931. package/dist/data/test/function/combinations.mcfunction +0 -7
  932. package/dist/data/test/function/combinations__loop_body_9.mcfunction +0 -15
  933. package/dist/data/test/function/combinations__loop_exit_10.mcfunction +0 -1
  934. package/dist/data/test/function/combinations__loop_header_8.mcfunction +0 -4
  935. package/dist/data/test/function/combinations__merge_1.mcfunction +0 -4
  936. package/dist/data/test/function/combinations__merge_4.mcfunction +0 -7
  937. package/dist/data/test/function/combinations__merge_7.mcfunction +0 -3
  938. package/dist/data/test/function/combinations__then_0.mcfunction +0 -2
  939. package/dist/data/test/function/combinations__then_3.mcfunction +0 -2
  940. package/dist/data/test/function/combinations__then_6.mcfunction +0 -4
  941. package/dist/data/test/function/cos_fixed.mcfunction +0 -7
  942. package/dist/data/test/function/cos_hp.mcfunction +0 -6
  943. package/dist/data/test/function/cross2d.mcfunction +0 -11
  944. package/dist/data/test/function/cross3d_x.mcfunction +0 -11
  945. package/dist/data/test/function/cross3d_y.mcfunction +0 -11
  946. package/dist/data/test/function/cross3d_z.mcfunction +0 -11
  947. package/dist/data/test/function/cylinder_contains.mcfunction +0 -21
  948. package/dist/data/test/function/cylinder_contains__merge_1.mcfunction +0 -2
  949. package/dist/data/test/function/cylinder_contains__then_0.mcfunction +0 -2
  950. package/dist/data/test/function/distance2d_fixed.mcfunction +0 -13
  951. package/dist/data/test/function/distance3d_fixed.mcfunction +0 -18
  952. package/dist/data/test/function/divfix.mcfunction +0 -7
  953. package/dist/data/test/function/divfix__merge_1.mcfunction +0 -6
  954. package/dist/data/test/function/divfix__then_0.mcfunction +0 -2
  955. package/dist/data/test/function/dot2d.mcfunction +0 -11
  956. package/dist/data/test/function/dot3d.mcfunction +0 -17
  957. package/dist/data/test/function/exp_dist_approx.mcfunction +0 -13
  958. package/dist/data/test/function/exp_dist_approx__merge_1.mcfunction +0 -16
  959. package/dist/data/test/function/exp_dist_approx__merge_3.mcfunction +0 -11
  960. package/dist/data/test/function/exp_dist_approx__merge_5.mcfunction +0 -1
  961. package/dist/data/test/function/exp_dist_approx__then_0.mcfunction +0 -4
  962. package/dist/data/test/function/exp_dist_approx__then_2.mcfunction +0 -2
  963. package/dist/data/test/function/exp_dist_approx__then_4.mcfunction +0 -2
  964. package/dist/data/test/function/exp_fx.mcfunction +0 -17
  965. package/dist/data/test/function/exp_fx__loop_body_10.mcfunction +0 -8
  966. package/dist/data/test/function/exp_fx__loop_body_5.mcfunction +0 -8
  967. package/dist/data/test/function/exp_fx__loop_exit_11.mcfunction +0 -1
  968. package/dist/data/test/function/exp_fx__loop_exit_6.mcfunction +0 -1
  969. package/dist/data/test/function/exp_fx__loop_header_4.mcfunction +0 -4
  970. package/dist/data/test/function/exp_fx__loop_header_9.mcfunction +0 -4
  971. package/dist/data/test/function/exp_fx__merge_1.mcfunction +0 -48
  972. package/dist/data/test/function/exp_fx__merge_3.mcfunction +0 -5
  973. package/dist/data/test/function/exp_fx__merge_8.mcfunction +0 -1
  974. package/dist/data/test/function/exp_fx__then_0.mcfunction +0 -7
  975. package/dist/data/test/function/exp_fx__then_2.mcfunction +0 -2
  976. package/dist/data/test/function/exp_fx__then_7.mcfunction +0 -5
  977. package/dist/data/test/function/factorial.mcfunction +0 -6
  978. package/dist/data/test/function/factorial__loop_body_4.mcfunction +0 -7
  979. package/dist/data/test/function/factorial__loop_exit_5.mcfunction +0 -1
  980. package/dist/data/test/function/factorial__loop_header_3.mcfunction +0 -4
  981. package/dist/data/test/function/factorial__merge_1.mcfunction +0 -3
  982. package/dist/data/test/function/factorial__then_0.mcfunction +0 -2
  983. package/dist/data/test/function/format_time_h.mcfunction +0 -5
  984. package/dist/data/test/function/format_time_m.mcfunction +0 -8
  985. package/dist/data/test/function/format_time_s.mcfunction +0 -8
  986. package/dist/data/test/function/gamma_int.mcfunction +0 -6
  987. package/dist/data/test/function/gamma_int__merge_1.mcfunction +0 -6
  988. package/dist/data/test/function/gamma_int__then_0.mcfunction +0 -2
  989. package/dist/data/test/function/gcd.mcfunction +0 -8
  990. package/dist/data/test/function/gcd__loop_body_5.mcfunction +0 -5
  991. package/dist/data/test/function/gcd__loop_exit_6.mcfunction +0 -1
  992. package/dist/data/test/function/gcd__loop_header_4.mcfunction +0 -5
  993. package/dist/data/test/function/gcd__merge_1.mcfunction +0 -6
  994. package/dist/data/test/function/gcd__merge_3.mcfunction +0 -1
  995. package/dist/data/test/function/gcd__then_0.mcfunction +0 -4
  996. package/dist/data/test/function/gcd__then_2.mcfunction +0 -4
  997. package/dist/data/test/function/hsl_to_b.mcfunction +0 -24
  998. package/dist/data/test/function/hsl_to_b__merge_1.mcfunction +0 -30
  999. package/dist/data/test/function/hsl_to_b__merge_12.mcfunction +0 -5
  1000. package/dist/data/test/function/hsl_to_b__merge_15.mcfunction +0 -3
  1001. package/dist/data/test/function/hsl_to_b__merge_3.mcfunction +0 -5
  1002. package/dist/data/test/function/hsl_to_b__merge_6.mcfunction +0 -5
  1003. package/dist/data/test/function/hsl_to_b__merge_9.mcfunction +0 -5
  1004. package/dist/data/test/function/hsl_to_b__then_0.mcfunction +0 -4
  1005. package/dist/data/test/function/hsl_to_b__then_11.mcfunction +0 -3
  1006. package/dist/data/test/function/hsl_to_b__then_14.mcfunction +0 -3
  1007. package/dist/data/test/function/hsl_to_b__then_2.mcfunction +0 -1
  1008. package/dist/data/test/function/hsl_to_b__then_5.mcfunction +0 -1
  1009. package/dist/data/test/function/hsl_to_b__then_8.mcfunction +0 -3
  1010. package/dist/data/test/function/hsl_to_g.mcfunction +0 -24
  1011. package/dist/data/test/function/hsl_to_g__merge_1.mcfunction +0 -30
  1012. package/dist/data/test/function/hsl_to_g__merge_12.mcfunction +0 -5
  1013. package/dist/data/test/function/hsl_to_g__merge_15.mcfunction +0 -1
  1014. package/dist/data/test/function/hsl_to_g__merge_3.mcfunction +0 -5
  1015. package/dist/data/test/function/hsl_to_g__merge_6.mcfunction +0 -5
  1016. package/dist/data/test/function/hsl_to_g__merge_9.mcfunction +0 -5
  1017. package/dist/data/test/function/hsl_to_g__then_0.mcfunction +0 -4
  1018. package/dist/data/test/function/hsl_to_g__then_11.mcfunction +0 -3
  1019. package/dist/data/test/function/hsl_to_g__then_14.mcfunction +0 -1
  1020. package/dist/data/test/function/hsl_to_g__then_2.mcfunction +0 -3
  1021. package/dist/data/test/function/hsl_to_g__then_5.mcfunction +0 -3
  1022. package/dist/data/test/function/hsl_to_g__then_8.mcfunction +0 -3
  1023. package/dist/data/test/function/hsl_to_packed.mcfunction +0 -24
  1024. package/dist/data/test/function/hsl_to_r.mcfunction +0 -24
  1025. package/dist/data/test/function/hsl_to_r__merge_1.mcfunction +0 -30
  1026. package/dist/data/test/function/hsl_to_r__merge_12.mcfunction +0 -5
  1027. package/dist/data/test/function/hsl_to_r__merge_15.mcfunction +0 -3
  1028. package/dist/data/test/function/hsl_to_r__merge_3.mcfunction +0 -5
  1029. package/dist/data/test/function/hsl_to_r__merge_6.mcfunction +0 -5
  1030. package/dist/data/test/function/hsl_to_r__merge_9.mcfunction +0 -5
  1031. package/dist/data/test/function/hsl_to_r__then_0.mcfunction +0 -4
  1032. package/dist/data/test/function/hsl_to_r__then_11.mcfunction +0 -1
  1033. package/dist/data/test/function/hsl_to_r__then_14.mcfunction +0 -3
  1034. package/dist/data/test/function/hsl_to_r__then_2.mcfunction +0 -3
  1035. package/dist/data/test/function/hsl_to_r__then_5.mcfunction +0 -3
  1036. package/dist/data/test/function/hsl_to_r__then_8.mcfunction +0 -1
  1037. package/dist/data/test/function/init_trig.mcfunction +0 -1
  1038. package/dist/data/test/function/int32_to_bigint3_hi.mcfunction +0 -6
  1039. package/dist/data/test/function/int32_to_bigint3_hi__merge_1.mcfunction +0 -4
  1040. package/dist/data/test/function/int32_to_bigint3_hi__then_0.mcfunction +0 -4
  1041. package/dist/data/test/function/int32_to_bigint3_lo.mcfunction +0 -6
  1042. package/dist/data/test/function/int32_to_bigint3_lo__merge_1.mcfunction +0 -4
  1043. package/dist/data/test/function/int32_to_bigint3_lo__then_0.mcfunction +0 -4
  1044. package/dist/data/test/function/int32_to_bigint3_mid.mcfunction +0 -6
  1045. package/dist/data/test/function/int32_to_bigint3_mid__merge_1.mcfunction +0 -7
  1046. package/dist/data/test/function/int32_to_bigint3_mid__then_0.mcfunction +0 -4
  1047. package/dist/data/test/function/isqrt.mcfunction +0 -6
  1048. package/dist/data/test/function/isqrt__loop_body_10.mcfunction +0 -8
  1049. package/dist/data/test/function/isqrt__loop_body_13.mcfunction +0 -12
  1050. package/dist/data/test/function/isqrt__loop_body_7.mcfunction +0 -8
  1051. package/dist/data/test/function/isqrt__loop_exit_11.mcfunction +0 -2
  1052. package/dist/data/test/function/isqrt__loop_exit_14.mcfunction +0 -1
  1053. package/dist/data/test/function/isqrt__loop_exit_8.mcfunction +0 -9
  1054. package/dist/data/test/function/isqrt__loop_header_12.mcfunction +0 -5
  1055. package/dist/data/test/function/isqrt__loop_header_6.mcfunction +0 -5
  1056. package/dist/data/test/function/isqrt__loop_header_9.mcfunction +0 -4
  1057. package/dist/data/test/function/isqrt__merge_1.mcfunction +0 -5
  1058. package/dist/data/test/function/isqrt__merge_16.mcfunction +0 -5
  1059. package/dist/data/test/function/isqrt__merge_4.mcfunction +0 -3
  1060. package/dist/data/test/function/isqrt__then_0.mcfunction +0 -2
  1061. package/dist/data/test/function/isqrt__then_15.mcfunction +0 -1
  1062. package/dist/data/test/function/isqrt__then_3.mcfunction +0 -2
  1063. package/dist/data/test/function/lcm.mcfunction +0 -12
  1064. package/dist/data/test/function/lcm__merge_1.mcfunction +0 -5
  1065. package/dist/data/test/function/lcm__then_0.mcfunction +0 -2
  1066. package/dist/data/test/function/length2d_fixed.mcfunction +0 -15
  1067. package/dist/data/test/function/length3d_fixed.mcfunction +0 -20
  1068. package/dist/data/test/function/lerp.mcfunction +0 -13
  1069. package/dist/data/test/function/lerp2d_x.mcfunction +0 -13
  1070. package/dist/data/test/function/lerp2d_y.mcfunction +0 -13
  1071. package/dist/data/test/function/list_avg.mcfunction +0 -9
  1072. package/dist/data/test/function/list_clamp_all.mcfunction +0 -6
  1073. package/dist/data/test/function/list_clamp_all__loop_body_1.mcfunction +0 -4
  1074. package/dist/data/test/function/list_clamp_all__loop_exit_2.mcfunction +0 -1
  1075. package/dist/data/test/function/list_clamp_all__loop_header_0.mcfunction +0 -4
  1076. package/dist/data/test/function/list_clamp_all__merge_4.mcfunction +0 -4
  1077. package/dist/data/test/function/list_clamp_all__merge_6.mcfunction +0 -4
  1078. package/dist/data/test/function/list_clamp_all__then_3.mcfunction +0 -1
  1079. package/dist/data/test/function/list_clamp_all__then_5.mcfunction +0 -1
  1080. package/dist/data/test/function/list_contains.mcfunction +0 -5
  1081. package/dist/data/test/function/list_contains__loop_body_1.mcfunction +0 -4
  1082. package/dist/data/test/function/list_contains__loop_exit_2.mcfunction +0 -2
  1083. package/dist/data/test/function/list_contains__loop_header_0.mcfunction +0 -4
  1084. package/dist/data/test/function/list_contains__merge_4.mcfunction +0 -4
  1085. package/dist/data/test/function/list_contains__then_3.mcfunction +0 -2
  1086. package/dist/data/test/function/list_count_if_gt.mcfunction +0 -6
  1087. package/dist/data/test/function/list_count_if_gt__loop_body_1.mcfunction +0 -4
  1088. package/dist/data/test/function/list_count_if_gt__loop_exit_2.mcfunction +0 -1
  1089. package/dist/data/test/function/list_count_if_gt__loop_header_0.mcfunction +0 -4
  1090. package/dist/data/test/function/list_count_if_gt__merge_4.mcfunction +0 -4
  1091. package/dist/data/test/function/list_count_if_gt__then_3.mcfunction +0 -4
  1092. package/dist/data/test/function/list_fill.mcfunction +0 -3
  1093. package/dist/data/test/function/list_fill__loop_body_1.mcfunction +0 -4
  1094. package/dist/data/test/function/list_fill__loop_exit_2.mcfunction +0 -1
  1095. package/dist/data/test/function/list_fill__loop_header_0.mcfunction +0 -4
  1096. package/dist/data/test/function/list_index_of.mcfunction +0 -5
  1097. package/dist/data/test/function/list_index_of__loop_body_1.mcfunction +0 -4
  1098. package/dist/data/test/function/list_index_of__loop_exit_2.mcfunction +0 -2
  1099. package/dist/data/test/function/list_index_of__loop_header_0.mcfunction +0 -4
  1100. package/dist/data/test/function/list_index_of__merge_4.mcfunction +0 -4
  1101. package/dist/data/test/function/list_index_of__then_3.mcfunction +0 -1
  1102. package/dist/data/test/function/list_max.mcfunction +0 -5
  1103. package/dist/data/test/function/list_max3.mcfunction +0 -8
  1104. package/dist/data/test/function/list_max3__merge_1.mcfunction +0 -4
  1105. package/dist/data/test/function/list_max3__merge_3.mcfunction +0 -1
  1106. package/dist/data/test/function/list_max3__then_0.mcfunction +0 -2
  1107. package/dist/data/test/function/list_max3__then_2.mcfunction +0 -2
  1108. package/dist/data/test/function/list_max5.mcfunction +0 -10
  1109. package/dist/data/test/function/list_max5__merge_1.mcfunction +0 -4
  1110. package/dist/data/test/function/list_max5__merge_3.mcfunction +0 -4
  1111. package/dist/data/test/function/list_max5__merge_5.mcfunction +0 -4
  1112. package/dist/data/test/function/list_max5__merge_7.mcfunction +0 -1
  1113. package/dist/data/test/function/list_max5__then_0.mcfunction +0 -2
  1114. package/dist/data/test/function/list_max5__then_2.mcfunction +0 -2
  1115. package/dist/data/test/function/list_max5__then_4.mcfunction +0 -2
  1116. package/dist/data/test/function/list_max5__then_6.mcfunction +0 -2
  1117. package/dist/data/test/function/list_max__loop_body_1.mcfunction +0 -4
  1118. package/dist/data/test/function/list_max__loop_exit_2.mcfunction +0 -1
  1119. package/dist/data/test/function/list_max__loop_header_0.mcfunction +0 -4
  1120. package/dist/data/test/function/list_max__merge_4.mcfunction +0 -4
  1121. package/dist/data/test/function/list_max__then_3.mcfunction +0 -2
  1122. package/dist/data/test/function/list_min.mcfunction +0 -5
  1123. package/dist/data/test/function/list_min3.mcfunction +0 -8
  1124. package/dist/data/test/function/list_min3__merge_1.mcfunction +0 -4
  1125. package/dist/data/test/function/list_min3__merge_3.mcfunction +0 -1
  1126. package/dist/data/test/function/list_min3__then_0.mcfunction +0 -2
  1127. package/dist/data/test/function/list_min3__then_2.mcfunction +0 -2
  1128. package/dist/data/test/function/list_min5.mcfunction +0 -10
  1129. package/dist/data/test/function/list_min5__merge_1.mcfunction +0 -4
  1130. package/dist/data/test/function/list_min5__merge_3.mcfunction +0 -4
  1131. package/dist/data/test/function/list_min5__merge_5.mcfunction +0 -4
  1132. package/dist/data/test/function/list_min5__merge_7.mcfunction +0 -1
  1133. package/dist/data/test/function/list_min5__then_0.mcfunction +0 -2
  1134. package/dist/data/test/function/list_min5__then_2.mcfunction +0 -2
  1135. package/dist/data/test/function/list_min5__then_4.mcfunction +0 -2
  1136. package/dist/data/test/function/list_min5__then_6.mcfunction +0 -2
  1137. package/dist/data/test/function/list_min__loop_body_1.mcfunction +0 -4
  1138. package/dist/data/test/function/list_min__loop_exit_2.mcfunction +0 -1
  1139. package/dist/data/test/function/list_min__loop_header_0.mcfunction +0 -4
  1140. package/dist/data/test/function/list_min__merge_4.mcfunction +0 -4
  1141. package/dist/data/test/function/list_min__then_3.mcfunction +0 -2
  1142. package/dist/data/test/function/list_reverse.mcfunction +0 -6
  1143. package/dist/data/test/function/list_reverse__loop_body_1.mcfunction +0 -9
  1144. package/dist/data/test/function/list_reverse__loop_exit_2.mcfunction +0 -1
  1145. package/dist/data/test/function/list_reverse__loop_header_0.mcfunction +0 -4
  1146. package/dist/data/test/function/list_sort_asc.mcfunction +0 -4
  1147. package/dist/data/test/function/list_sort_asc__loop_body_1.mcfunction +0 -2
  1148. package/dist/data/test/function/list_sort_asc__loop_body_4.mcfunction +0 -4
  1149. package/dist/data/test/function/list_sort_asc__loop_exit_2.mcfunction +0 -1
  1150. package/dist/data/test/function/list_sort_asc__loop_exit_5.mcfunction +0 -4
  1151. package/dist/data/test/function/list_sort_asc__loop_header_0.mcfunction +0 -6
  1152. package/dist/data/test/function/list_sort_asc__loop_header_3.mcfunction +0 -8
  1153. package/dist/data/test/function/list_sort_asc__merge_7.mcfunction +0 -4
  1154. package/dist/data/test/function/list_sort_asc__then_6.mcfunction +0 -1
  1155. package/dist/data/test/function/list_sort_desc.mcfunction +0 -4
  1156. package/dist/data/test/function/list_sort_desc__loop_body_1.mcfunction +0 -2
  1157. package/dist/data/test/function/list_sort_desc__loop_body_4.mcfunction +0 -4
  1158. package/dist/data/test/function/list_sort_desc__loop_exit_2.mcfunction +0 -1
  1159. package/dist/data/test/function/list_sort_desc__loop_exit_5.mcfunction +0 -4
  1160. package/dist/data/test/function/list_sort_desc__loop_header_0.mcfunction +0 -6
  1161. package/dist/data/test/function/list_sort_desc__loop_header_3.mcfunction +0 -8
  1162. package/dist/data/test/function/list_sort_desc__merge_7.mcfunction +0 -4
  1163. package/dist/data/test/function/list_sort_desc__then_6.mcfunction +0 -1
  1164. package/dist/data/test/function/list_sum.mcfunction +0 -5
  1165. package/dist/data/test/function/list_sum3.mcfunction +0 -8
  1166. package/dist/data/test/function/list_sum4.mcfunction +0 -11
  1167. package/dist/data/test/function/list_sum5.mcfunction +0 -14
  1168. package/dist/data/test/function/list_sum__loop_body_1.mcfunction +0 -7
  1169. package/dist/data/test/function/list_sum__loop_exit_2.mcfunction +0 -1
  1170. package/dist/data/test/function/list_sum__loop_header_0.mcfunction +0 -4
  1171. package/dist/data/test/function/ln.mcfunction +0 -9
  1172. package/dist/data/test/function/ln__loop_body_1.mcfunction +0 -8
  1173. package/dist/data/test/function/ln__loop_body_4.mcfunction +0 -8
  1174. package/dist/data/test/function/ln__loop_exit_2.mcfunction +0 -1
  1175. package/dist/data/test/function/ln__loop_exit_5.mcfunction +0 -37
  1176. package/dist/data/test/function/ln__loop_header_0.mcfunction +0 -4
  1177. package/dist/data/test/function/ln__loop_header_3.mcfunction +0 -7
  1178. package/dist/data/test/function/load.mcfunction +0 -1
  1179. package/dist/data/test/function/log10_fx.mcfunction +0 -11
  1180. package/dist/data/test/function/log2_fx.mcfunction +0 -11
  1181. package/dist/data/test/function/log2_int.mcfunction +0 -6
  1182. package/dist/data/test/function/log2_int__loop_body_4.mcfunction +0 -8
  1183. package/dist/data/test/function/log2_int__loop_exit_5.mcfunction +0 -1
  1184. package/dist/data/test/function/log2_int__loop_header_3.mcfunction +0 -5
  1185. package/dist/data/test/function/log2_int__merge_1.mcfunction +0 -3
  1186. package/dist/data/test/function/log2_int__then_0.mcfunction +0 -2
  1187. package/dist/data/test/function/loga_fx.mcfunction +0 -11
  1188. package/dist/data/test/function/loga_fx__merge_1.mcfunction +0 -9
  1189. package/dist/data/test/function/loga_fx__then_0.mcfunction +0 -2
  1190. package/dist/data/test/function/manhattan.mcfunction +0 -15
  1191. package/dist/data/test/function/manhattan3d.mcfunction +0 -20
  1192. package/dist/data/test/function/manhattan3d__merge_1.mcfunction +0 -5
  1193. package/dist/data/test/function/manhattan3d__merge_3.mcfunction +0 -5
  1194. package/dist/data/test/function/manhattan3d__merge_5.mcfunction +0 -5
  1195. package/dist/data/test/function/manhattan3d__then_0.mcfunction +0 -4
  1196. package/dist/data/test/function/manhattan3d__then_2.mcfunction +0 -4
  1197. package/dist/data/test/function/manhattan3d__then_4.mcfunction +0 -4
  1198. package/dist/data/test/function/manhattan__merge_1.mcfunction +0 -5
  1199. package/dist/data/test/function/manhattan__merge_3.mcfunction +0 -3
  1200. package/dist/data/test/function/manhattan__then_0.mcfunction +0 -4
  1201. package/dist/data/test/function/manhattan__then_2.mcfunction +0 -4
  1202. package/dist/data/test/function/map.mcfunction +0 -13
  1203. package/dist/data/test/function/map__merge_1.mcfunction +0 -11
  1204. package/dist/data/test/function/map__then_0.mcfunction +0 -1
  1205. package/dist/data/test/function/mc_day_angle.mcfunction +0 -16
  1206. package/dist/data/test/function/midpoint.mcfunction +0 -8
  1207. package/dist/data/test/function/mulfix.mcfunction +0 -8
  1208. package/dist/data/test/function/neg2d_x.mcfunction +0 -4
  1209. package/dist/data/test/function/neg2d_y.mcfunction +0 -4
  1210. package/dist/data/test/function/neg3d_x.mcfunction +0 -4
  1211. package/dist/data/test/function/neg3d_y.mcfunction +0 -4
  1212. package/dist/data/test/function/neg3d_z.mcfunction +0 -4
  1213. package/dist/data/test/function/next_lcg.mcfunction +0 -7
  1214. package/dist/data/test/function/normal_approx12.mcfunction +0 -16
  1215. package/dist/data/test/function/normal_approx12__merge_1.mcfunction +0 -18
  1216. package/dist/data/test/function/normal_approx12__merge_11.mcfunction +0 -18
  1217. package/dist/data/test/function/normal_approx12__merge_13.mcfunction +0 -18
  1218. package/dist/data/test/function/normal_approx12__merge_15.mcfunction +0 -18
  1219. package/dist/data/test/function/normal_approx12__merge_17.mcfunction +0 -18
  1220. package/dist/data/test/function/normal_approx12__merge_19.mcfunction +0 -18
  1221. package/dist/data/test/function/normal_approx12__merge_21.mcfunction +0 -18
  1222. package/dist/data/test/function/normal_approx12__merge_23.mcfunction +0 -9
  1223. package/dist/data/test/function/normal_approx12__merge_3.mcfunction +0 -18
  1224. package/dist/data/test/function/normal_approx12__merge_5.mcfunction +0 -18
  1225. package/dist/data/test/function/normal_approx12__merge_7.mcfunction +0 -18
  1226. package/dist/data/test/function/normal_approx12__merge_9.mcfunction +0 -18
  1227. package/dist/data/test/function/normal_approx12__then_0.mcfunction +0 -4
  1228. package/dist/data/test/function/normal_approx12__then_10.mcfunction +0 -4
  1229. package/dist/data/test/function/normal_approx12__then_12.mcfunction +0 -4
  1230. package/dist/data/test/function/normal_approx12__then_14.mcfunction +0 -4
  1231. package/dist/data/test/function/normal_approx12__then_16.mcfunction +0 -4
  1232. package/dist/data/test/function/normal_approx12__then_18.mcfunction +0 -4
  1233. package/dist/data/test/function/normal_approx12__then_2.mcfunction +0 -4
  1234. package/dist/data/test/function/normal_approx12__then_20.mcfunction +0 -4
  1235. package/dist/data/test/function/normal_approx12__then_22.mcfunction +0 -4
  1236. package/dist/data/test/function/normal_approx12__then_4.mcfunction +0 -4
  1237. package/dist/data/test/function/normal_approx12__then_6.mcfunction +0 -4
  1238. package/dist/data/test/function/normal_approx12__then_8.mcfunction +0 -4
  1239. package/dist/data/test/function/normalize2d_x.mcfunction +0 -12
  1240. package/dist/data/test/function/normalize2d_x__merge_1.mcfunction +0 -6
  1241. package/dist/data/test/function/normalize2d_x__then_0.mcfunction +0 -2
  1242. package/dist/data/test/function/normalize2d_y.mcfunction +0 -12
  1243. package/dist/data/test/function/normalize2d_y__merge_1.mcfunction +0 -6
  1244. package/dist/data/test/function/normalize2d_y__then_0.mcfunction +0 -2
  1245. package/dist/data/test/function/parabola_land_t.mcfunction +0 -7
  1246. package/dist/data/test/function/parabola_x.mcfunction +0 -8
  1247. package/dist/data/test/function/parabola_y.mcfunction +0 -17
  1248. package/dist/data/test/function/pcg_next_hi.mcfunction +0 -8
  1249. package/dist/data/test/function/pcg_next_lo.mcfunction +0 -7
  1250. package/dist/data/test/function/pcg_output.mcfunction +0 -15
  1251. package/dist/data/test/function/pcg_output__merge_1.mcfunction +0 -1
  1252. package/dist/data/test/function/pcg_output__then_0.mcfunction +0 -4
  1253. package/dist/data/test/function/popcount.mcfunction +0 -5
  1254. package/dist/data/test/function/popcount__loop_body_1.mcfunction +0 -8
  1255. package/dist/data/test/function/popcount__loop_exit_2.mcfunction +0 -1
  1256. package/dist/data/test/function/popcount__loop_header_0.mcfunction +0 -5
  1257. package/dist/data/test/function/popcount__merge_4.mcfunction +0 -8
  1258. package/dist/data/test/function/popcount__then_3.mcfunction +0 -4
  1259. package/dist/data/test/function/pow_int.mcfunction +0 -7
  1260. package/dist/data/test/function/pow_int__loop_body_4.mcfunction +0 -8
  1261. package/dist/data/test/function/pow_int__loop_exit_5.mcfunction +0 -1
  1262. package/dist/data/test/function/pow_int__loop_header_3.mcfunction +0 -5
  1263. package/dist/data/test/function/pow_int__merge_1.mcfunction +0 -4
  1264. package/dist/data/test/function/pow_int__merge_7.mcfunction +0 -8
  1265. package/dist/data/test/function/pow_int__then_0.mcfunction +0 -2
  1266. package/dist/data/test/function/pow_int__then_6.mcfunction +0 -4
  1267. package/dist/data/test/function/quadratic_disc.mcfunction +0 -12
  1268. package/dist/data/test/function/quadratic_x1.mcfunction +0 -8
  1269. package/dist/data/test/function/quadratic_x1__merge_1.mcfunction +0 -14
  1270. package/dist/data/test/function/quadratic_x1__merge_4.mcfunction +0 -15
  1271. package/dist/data/test/function/quadratic_x1__then_0.mcfunction +0 -2
  1272. package/dist/data/test/function/quadratic_x1__then_3.mcfunction +0 -2
  1273. package/dist/data/test/function/quadratic_x2.mcfunction +0 -8
  1274. package/dist/data/test/function/quadratic_x2__merge_1.mcfunction +0 -14
  1275. package/dist/data/test/function/quadratic_x2__merge_4.mcfunction +0 -15
  1276. package/dist/data/test/function/quadratic_x2__then_0.mcfunction +0 -2
  1277. package/dist/data/test/function/quadratic_x2__then_3.mcfunction +0 -2
  1278. package/dist/data/test/function/random_bool.mcfunction +0 -7
  1279. package/dist/data/test/function/random_bool__merge_1.mcfunction +0 -4
  1280. package/dist/data/test/function/random_bool__then_0.mcfunction +0 -4
  1281. package/dist/data/test/function/random_range.mcfunction +0 -9
  1282. package/dist/data/test/function/random_range__merge_1.mcfunction +0 -7
  1283. package/dist/data/test/function/random_range__then_0.mcfunction +0 -4
  1284. package/dist/data/test/function/rgb_b.mcfunction +0 -5
  1285. package/dist/data/test/function/rgb_g.mcfunction +0 -8
  1286. package/dist/data/test/function/rgb_lerp.mcfunction +0 -71
  1287. package/dist/data/test/function/rgb_pack.mcfunction +0 -14
  1288. package/dist/data/test/function/rgb_r.mcfunction +0 -8
  1289. package/dist/data/test/function/rgb_to_h.mcfunction +0 -8
  1290. package/dist/data/test/function/rgb_to_h__merge_1.mcfunction +0 -4
  1291. package/dist/data/test/function/rgb_to_h__merge_12.mcfunction +0 -4
  1292. package/dist/data/test/function/rgb_to_h__merge_14.mcfunction +0 -1
  1293. package/dist/data/test/function/rgb_to_h__merge_17.mcfunction +0 -9
  1294. package/dist/data/test/function/rgb_to_h__merge_3.mcfunction +0 -5
  1295. package/dist/data/test/function/rgb_to_h__merge_5.mcfunction +0 -4
  1296. package/dist/data/test/function/rgb_to_h__merge_7.mcfunction +0 -8
  1297. package/dist/data/test/function/rgb_to_h__merge_9.mcfunction +0 -4
  1298. package/dist/data/test/function/rgb_to_h__then_0.mcfunction +0 -2
  1299. package/dist/data/test/function/rgb_to_h__then_11.mcfunction +0 -12
  1300. package/dist/data/test/function/rgb_to_h__then_13.mcfunction +0 -4
  1301. package/dist/data/test/function/rgb_to_h__then_16.mcfunction +0 -9
  1302. package/dist/data/test/function/rgb_to_h__then_2.mcfunction +0 -2
  1303. package/dist/data/test/function/rgb_to_h__then_4.mcfunction +0 -2
  1304. package/dist/data/test/function/rgb_to_h__then_6.mcfunction +0 -2
  1305. package/dist/data/test/function/rgb_to_h__then_8.mcfunction +0 -2
  1306. package/dist/data/test/function/rgb_to_l.mcfunction +0 -8
  1307. package/dist/data/test/function/rgb_to_l__merge_1.mcfunction +0 -4
  1308. package/dist/data/test/function/rgb_to_l__merge_3.mcfunction +0 -5
  1309. package/dist/data/test/function/rgb_to_l__merge_5.mcfunction +0 -4
  1310. package/dist/data/test/function/rgb_to_l__merge_7.mcfunction +0 -9
  1311. package/dist/data/test/function/rgb_to_l__then_0.mcfunction +0 -2
  1312. package/dist/data/test/function/rgb_to_l__then_2.mcfunction +0 -2
  1313. package/dist/data/test/function/rgb_to_l__then_4.mcfunction +0 -2
  1314. package/dist/data/test/function/rgb_to_l__then_6.mcfunction +0 -2
  1315. package/dist/data/test/function/rgb_to_s.mcfunction +0 -8
  1316. package/dist/data/test/function/rgb_to_s__merge_1.mcfunction +0 -4
  1317. package/dist/data/test/function/rgb_to_s__merge_12.mcfunction +0 -10
  1318. package/dist/data/test/function/rgb_to_s__merge_3.mcfunction +0 -5
  1319. package/dist/data/test/function/rgb_to_s__merge_5.mcfunction +0 -4
  1320. package/dist/data/test/function/rgb_to_s__merge_7.mcfunction +0 -8
  1321. package/dist/data/test/function/rgb_to_s__merge_9.mcfunction +0 -13
  1322. package/dist/data/test/function/rgb_to_s__then_0.mcfunction +0 -2
  1323. package/dist/data/test/function/rgb_to_s__then_11.mcfunction +0 -8
  1324. package/dist/data/test/function/rgb_to_s__then_2.mcfunction +0 -2
  1325. package/dist/data/test/function/rgb_to_s__then_4.mcfunction +0 -2
  1326. package/dist/data/test/function/rgb_to_s__then_6.mcfunction +0 -2
  1327. package/dist/data/test/function/rgb_to_s__then_8.mcfunction +0 -2
  1328. package/dist/data/test/function/rotate2d_x.mcfunction +0 -20
  1329. package/dist/data/test/function/rotate2d_y.mcfunction +0 -20
  1330. package/dist/data/test/function/scale2d_x.mcfunction +0 -8
  1331. package/dist/data/test/function/scale2d_y.mcfunction +0 -8
  1332. package/dist/data/test/function/scale3d_x.mcfunction +0 -8
  1333. package/dist/data/test/function/scale3d_y.mcfunction +0 -8
  1334. package/dist/data/test/function/scale3d_z.mcfunction +0 -8
  1335. package/dist/data/test/function/seconds_to_ticks.mcfunction +0 -5
  1336. package/dist/data/test/function/sign.mcfunction +0 -6
  1337. package/dist/data/test/function/sign__merge_1.mcfunction +0 -5
  1338. package/dist/data/test/function/sign__merge_4.mcfunction +0 -2
  1339. package/dist/data/test/function/sign__then_0.mcfunction +0 -2
  1340. package/dist/data/test/function/sign__then_3.mcfunction +0 -2
  1341. package/dist/data/test/function/sin_fixed.mcfunction +0 -10
  1342. package/dist/data/test/function/sin_fixed__merge_1.mcfunction +0 -5
  1343. package/dist/data/test/function/sin_fixed__merge_3.mcfunction +0 -5
  1344. package/dist/data/test/function/sin_fixed__merge_6.mcfunction +0 -5
  1345. package/dist/data/test/function/sin_fixed__merge_9.mcfunction +0 -10
  1346. package/dist/data/test/function/sin_fixed__then_0.mcfunction +0 -4
  1347. package/dist/data/test/function/sin_fixed__then_2.mcfunction +0 -6
  1348. package/dist/data/test/function/sin_fixed__then_5.mcfunction +0 -8
  1349. package/dist/data/test/function/sin_fixed__then_8.mcfunction +0 -10
  1350. package/dist/data/test/function/sin_hp.mcfunction +0 -6
  1351. package/dist/data/test/function/smootherstep.mcfunction +0 -11
  1352. package/dist/data/test/function/smootherstep__merge_1.mcfunction +0 -13
  1353. package/dist/data/test/function/smootherstep__merge_4.mcfunction +0 -5
  1354. package/dist/data/test/function/smootherstep__merge_6.mcfunction +0 -27
  1355. package/dist/data/test/function/smootherstep__then_0.mcfunction +0 -2
  1356. package/dist/data/test/function/smootherstep__then_3.mcfunction +0 -2
  1357. package/dist/data/test/function/smootherstep__then_5.mcfunction +0 -2
  1358. package/dist/data/test/function/smoothstep.mcfunction +0 -11
  1359. package/dist/data/test/function/smoothstep__merge_1.mcfunction +0 -13
  1360. package/dist/data/test/function/smoothstep__merge_4.mcfunction +0 -5
  1361. package/dist/data/test/function/smoothstep__merge_6.mcfunction +0 -15
  1362. package/dist/data/test/function/smoothstep__then_0.mcfunction +0 -2
  1363. package/dist/data/test/function/smoothstep__then_3.mcfunction +0 -2
  1364. package/dist/data/test/function/smoothstep__then_5.mcfunction +0 -2
  1365. package/dist/data/test/function/solve2x2_x.mcfunction +0 -18
  1366. package/dist/data/test/function/solve2x2_x__merge_1.mcfunction +0 -12
  1367. package/dist/data/test/function/solve2x2_x__then_0.mcfunction +0 -2
  1368. package/dist/data/test/function/solve2x2_y.mcfunction +0 -18
  1369. package/dist/data/test/function/solve2x2_y__merge_1.mcfunction +0 -12
  1370. package/dist/data/test/function/solve2x2_y__then_0.mcfunction +0 -2
  1371. package/dist/data/test/function/sort2_max.mcfunction +0 -6
  1372. package/dist/data/test/function/sort2_max__merge_1.mcfunction +0 -1
  1373. package/dist/data/test/function/sort2_max__then_0.mcfunction +0 -1
  1374. package/dist/data/test/function/sort2_min.mcfunction +0 -6
  1375. package/dist/data/test/function/sort2_min__merge_1.mcfunction +0 -1
  1376. package/dist/data/test/function/sort2_min__then_0.mcfunction +0 -1
  1377. package/dist/data/test/function/sort3.mcfunction +0 -11
  1378. package/dist/data/test/function/sort3__merge_1.mcfunction +0 -4
  1379. package/dist/data/test/function/sort3__merge_10.mcfunction +0 -1
  1380. package/dist/data/test/function/sort3__merge_3.mcfunction +0 -4
  1381. package/dist/data/test/function/sort3__merge_5.mcfunction +0 -5
  1382. package/dist/data/test/function/sort3__merge_7.mcfunction +0 -5
  1383. package/dist/data/test/function/sort3__then_0.mcfunction +0 -4
  1384. package/dist/data/test/function/sort3__then_2.mcfunction +0 -4
  1385. package/dist/data/test/function/sort3__then_4.mcfunction +0 -4
  1386. package/dist/data/test/function/sort3__then_6.mcfunction +0 -1
  1387. package/dist/data/test/function/sort3__then_9.mcfunction +0 -1
  1388. package/dist/data/test/function/sort4.mcfunction +0 -13
  1389. package/dist/data/test/function/sort4__merge_1.mcfunction +0 -4
  1390. package/dist/data/test/function/sort4__merge_11.mcfunction +0 -5
  1391. package/dist/data/test/function/sort4__merge_14.mcfunction +0 -5
  1392. package/dist/data/test/function/sort4__merge_17.mcfunction +0 -1
  1393. package/dist/data/test/function/sort4__merge_3.mcfunction +0 -4
  1394. package/dist/data/test/function/sort4__merge_5.mcfunction +0 -4
  1395. package/dist/data/test/function/sort4__merge_7.mcfunction +0 -4
  1396. package/dist/data/test/function/sort4__merge_9.mcfunction +0 -5
  1397. package/dist/data/test/function/sort4__then_0.mcfunction +0 -4
  1398. package/dist/data/test/function/sort4__then_10.mcfunction +0 -1
  1399. package/dist/data/test/function/sort4__then_13.mcfunction +0 -1
  1400. package/dist/data/test/function/sort4__then_16.mcfunction +0 -1
  1401. package/dist/data/test/function/sort4__then_2.mcfunction +0 -4
  1402. package/dist/data/test/function/sort4__then_4.mcfunction +0 -4
  1403. package/dist/data/test/function/sort4__then_6.mcfunction +0 -4
  1404. package/dist/data/test/function/sort4__then_8.mcfunction +0 -4
  1405. package/dist/data/test/function/sort5.mcfunction +0 -15
  1406. package/dist/data/test/function/sort5__merge_1.mcfunction +0 -4
  1407. package/dist/data/test/function/sort5__merge_11.mcfunction +0 -4
  1408. package/dist/data/test/function/sort5__merge_13.mcfunction +0 -4
  1409. package/dist/data/test/function/sort5__merge_15.mcfunction +0 -4
  1410. package/dist/data/test/function/sort5__merge_17.mcfunction +0 -5
  1411. package/dist/data/test/function/sort5__merge_19.mcfunction +0 -5
  1412. package/dist/data/test/function/sort5__merge_22.mcfunction +0 -5
  1413. package/dist/data/test/function/sort5__merge_25.mcfunction +0 -5
  1414. package/dist/data/test/function/sort5__merge_28.mcfunction +0 -1
  1415. package/dist/data/test/function/sort5__merge_3.mcfunction +0 -4
  1416. package/dist/data/test/function/sort5__merge_5.mcfunction +0 -4
  1417. package/dist/data/test/function/sort5__merge_7.mcfunction +0 -4
  1418. package/dist/data/test/function/sort5__merge_9.mcfunction +0 -4
  1419. package/dist/data/test/function/sort5__then_0.mcfunction +0 -4
  1420. package/dist/data/test/function/sort5__then_10.mcfunction +0 -4
  1421. package/dist/data/test/function/sort5__then_12.mcfunction +0 -4
  1422. package/dist/data/test/function/sort5__then_14.mcfunction +0 -4
  1423. package/dist/data/test/function/sort5__then_16.mcfunction +0 -4
  1424. package/dist/data/test/function/sort5__then_18.mcfunction +0 -1
  1425. package/dist/data/test/function/sort5__then_2.mcfunction +0 -4
  1426. package/dist/data/test/function/sort5__then_21.mcfunction +0 -1
  1427. package/dist/data/test/function/sort5__then_24.mcfunction +0 -1
  1428. package/dist/data/test/function/sort5__then_27.mcfunction +0 -1
  1429. package/dist/data/test/function/sort5__then_4.mcfunction +0 -4
  1430. package/dist/data/test/function/sort5__then_6.mcfunction +0 -4
  1431. package/dist/data/test/function/sort5__then_8.mcfunction +0 -4
  1432. package/dist/data/test/function/sphere_contains.mcfunction +0 -29
  1433. package/dist/data/test/function/sphere_contains__merge_1.mcfunction +0 -2
  1434. package/dist/data/test/function/sphere_contains__then_0.mcfunction +0 -2
  1435. package/dist/data/test/function/sqrt_fixed.mcfunction +0 -8
  1436. package/dist/data/test/function/sqrt_fx.mcfunction +0 -11
  1437. package/dist/data/test/function/sub2d_x.mcfunction +0 -5
  1438. package/dist/data/test/function/sub2d_y.mcfunction +0 -5
  1439. package/dist/data/test/function/sub3d_x.mcfunction +0 -5
  1440. package/dist/data/test/function/sub3d_y.mcfunction +0 -5
  1441. package/dist/data/test/function/sub3d_z.mcfunction +0 -5
  1442. package/dist/data/test/function/tick_to_ms.mcfunction +0 -5
  1443. package/dist/data/test/function/tick_to_seconds.mcfunction +0 -5
  1444. package/dist/data/test/function/tile_center.mcfunction +0 -10
  1445. package/dist/data/test/function/tile_of.mcfunction +0 -7
  1446. package/dist/data/test/function/tile_of__merge_1.mcfunction +0 -7
  1447. package/dist/data/test/function/tile_of__then_0.mcfunction +0 -3
  1448. package/dist/data/test/function/timer/done.mcfunction +0 -5
  1449. package/dist/data/test/function/timer/elapsed.mcfunction +0 -2
  1450. package/dist/data/test/function/timer/new.mcfunction +0 -5
  1451. package/dist/data/test/function/timer/pause.mcfunction +0 -1
  1452. package/dist/data/test/function/timer/remaining.mcfunction +0 -10
  1453. package/dist/data/test/function/timer/remaining__merge_1.mcfunction +0 -2
  1454. package/dist/data/test/function/timer/remaining__then_0.mcfunction +0 -1
  1455. package/dist/data/test/function/timer/reset.mcfunction +0 -1
  1456. package/dist/data/test/function/timer/start.mcfunction +0 -1
  1457. package/dist/data/test/function/timer/tick.mcfunction +0 -9
  1458. package/dist/data/test/function/timer/tick__merge_1.mcfunction +0 -1
  1459. package/dist/data/test/function/timer/tick__merge_3.mcfunction +0 -1
  1460. package/dist/data/test/function/timer/tick__then_0.mcfunction +0 -4
  1461. package/dist/data/test/function/timer/tick__then_2.mcfunction +0 -4
  1462. package/dist/data/test/function/uniform_frac.mcfunction +0 -12
  1463. package/dist/data/test/function/uniform_frac__merge_1.mcfunction +0 -4
  1464. package/dist/data/test/function/uniform_frac__then_0.mcfunction +0 -4
  1465. package/dist/data/test/function/uniform_int.mcfunction +0 -14
  1466. package/dist/data/test/function/uniform_int__merge_1.mcfunction +0 -9
  1467. package/dist/data/test/function/uniform_int__then_0.mcfunction +0 -4
  1468. package/dist/data/test/function/weighted2.mcfunction +0 -17
  1469. package/dist/data/test/function/weighted2__merge_1.mcfunction +0 -6
  1470. package/dist/data/test/function/weighted2__merge_3.mcfunction +0 -2
  1471. package/dist/data/test/function/weighted2__then_0.mcfunction +0 -4
  1472. package/dist/data/test/function/weighted2__then_2.mcfunction +0 -2
  1473. package/dist/data/test/function/weighted3.mcfunction +0 -20
  1474. package/dist/data/test/function/weighted3__merge_1.mcfunction +0 -7
  1475. package/dist/data/test/function/weighted3__merge_3.mcfunction +0 -6
  1476. package/dist/data/test/function/weighted3__merge_6.mcfunction +0 -2
  1477. package/dist/data/test/function/weighted3__then_0.mcfunction +0 -4
  1478. package/dist/data/test/function/weighted3__then_2.mcfunction +0 -2
  1479. package/dist/data/test/function/weighted3__then_5.mcfunction +0 -2
  1480. package/dist/data/turret/function/__load.mcfunction +0 -5
  1481. package/dist/data/turret/function/__tick.mcfunction +0 -4
  1482. package/dist/data/turret/function/__trigger_deploy_turret_dispatch.mcfunction +0 -4
  1483. package/dist/data/turret/function/deploy_turret.mcfunction +0 -8
  1484. package/dist/data/turret/function/turret_tick/at_1.mcfunction +0 -2
  1485. package/dist/data/turret/function/turret_tick/foreach_0.mcfunction +0 -2
  1486. package/dist/data/turret/function/turret_tick/foreach_2.mcfunction +0 -2
  1487. package/dist/data/turret/function/turret_tick/tick_body.mcfunction +0 -3
  1488. package/dist/data/turret/function/turret_tick/tick_skip.mcfunction +0 -1
  1489. package/dist/data/turret/function/turret_tick.mcfunction +0 -5
  1490. package/dist/diagnostics/index.d.ts +0 -44
  1491. package/dist/diagnostics/index.js +0 -140
  1492. package/dist/events/types.d.ts +0 -35
  1493. package/dist/events/types.js +0 -59
  1494. package/dist/formatter/index.d.ts +0 -1
  1495. package/dist/formatter/index.js +0 -26
  1496. package/dist/gcd2.map.json +0 -15
  1497. package/dist/gcd3.map.json +0 -17
  1498. package/dist/gcd_test.map.json +0 -15
  1499. package/dist/index.d.ts +0 -62
  1500. package/dist/ir/builder.d.ts +0 -33
  1501. package/dist/ir/builder.js +0 -99
  1502. package/dist/ir/types.d.ts +0 -132
  1503. package/dist/ir/types.js +0 -15
  1504. package/dist/isqrttest.map.json +0 -15
  1505. package/dist/lexer/index.d.ts +0 -37
  1506. package/dist/lexer/index.js +0 -569
  1507. package/dist/lowering/index.d.ts +0 -188
  1508. package/dist/lowering/index.js +0 -3405
  1509. package/dist/mathtest.map.json +0 -6
  1510. package/dist/mc-test/client.d.ts +0 -128
  1511. package/dist/mc-test/client.js +0 -174
  1512. package/dist/mc-test/runner.d.ts +0 -28
  1513. package/dist/mc-test/runner.js +0 -150
  1514. package/dist/mc-test/setup.d.ts +0 -11
  1515. package/dist/mc-test/setup.js +0 -98
  1516. package/dist/mc-validator/index.d.ts +0 -17
  1517. package/dist/mc-validator/index.js +0 -322
  1518. package/dist/mypack.map.json +0 -27
  1519. package/dist/nbt/index.d.ts +0 -86
  1520. package/dist/nbt/index.js +0 -250
  1521. package/dist/optimizer/commands.d.ts +0 -38
  1522. package/dist/optimizer/commands.js +0 -451
  1523. package/dist/optimizer/dce.d.ts +0 -34
  1524. package/dist/optimizer/dce.js +0 -639
  1525. package/dist/optimizer/passes.d.ts +0 -34
  1526. package/dist/optimizer/passes.js +0 -243
  1527. package/dist/optimizer/structure.d.ts +0 -9
  1528. package/dist/optimizer/structure.js +0 -356
  1529. package/dist/pack.mcmeta +0 -6
  1530. package/dist/parser/index.d.ts +0 -93
  1531. package/dist/parser/index.js +0 -1687
  1532. package/dist/repl.d.ts +0 -16
  1533. package/dist/repl.js +0 -165
  1534. package/dist/reqtest.map.json +0 -4
  1535. package/dist/reqtest2.map.json +0 -4
  1536. package/dist/runtime/index.d.ts +0 -107
  1537. package/dist/runtime/index.js +0 -1409
  1538. package/dist/runtime.map.json +0 -7
  1539. package/dist/src/__tests__/codegen.test.d.ts +0 -1
  1540. package/dist/src/__tests__/codegen.test.js +0 -152
  1541. package/dist/src/__tests__/debug-compile.test.d.ts +0 -1
  1542. package/dist/src/__tests__/debug-compile.test.js +0 -24
  1543. package/dist/src/__tests__/debug-compile2.test.d.ts +0 -1
  1544. package/dist/src/__tests__/debug-compile2.test.js +0 -19
  1545. package/dist/src/__tests__/debug-compile3.test.d.ts +0 -1
  1546. package/dist/src/__tests__/debug-compile3.test.js +0 -22
  1547. package/dist/src/__tests__/debug-wm.test.d.ts +0 -1
  1548. package/dist/src/__tests__/debug-wm.test.js +0 -50
  1549. package/dist/src/__tests__/debug_gen.d.ts +0 -1
  1550. package/dist/src/__tests__/debug_gen.js +0 -24
  1551. package/dist/src/__tests__/debug_scoreboard.test.d.ts +0 -1
  1552. package/dist/src/__tests__/debug_scoreboard.test.js +0 -19
  1553. package/dist/src/__tests__/debug_scoreboard2.test.d.ts +0 -1
  1554. package/dist/src/__tests__/debug_scoreboard2.test.js +0 -27
  1555. package/dist/src/__tests__/debug_scoreboard3.test.d.ts +0 -1
  1556. package/dist/src/__tests__/debug_scoreboard3.test.js +0 -37
  1557. package/dist/src/__tests__/e2e.test.d.ts +0 -6
  1558. package/dist/src/__tests__/e2e.test.js +0 -1789
  1559. package/dist/src/__tests__/entity-types.test.d.ts +0 -1
  1560. package/dist/src/__tests__/entity-types.test.js +0 -203
  1561. package/dist/src/__tests__/lowering.test.d.ts +0 -1
  1562. package/dist/src/__tests__/lowering.test.js +0 -1015
  1563. package/dist/src/__tests__/macro.test.d.ts +0 -8
  1564. package/dist/src/__tests__/macro.test.js +0 -306
  1565. package/dist/src/__tests__/nbt.test.d.ts +0 -1
  1566. package/dist/src/__tests__/nbt.test.js +0 -82
  1567. package/dist/src/__tests__/optimizer-advanced.test.d.ts +0 -1
  1568. package/dist/src/__tests__/optimizer-advanced.test.js +0 -124
  1569. package/dist/src/__tests__/optimizer.test.d.ts +0 -1
  1570. package/dist/src/__tests__/optimizer.test.js +0 -149
  1571. package/dist/src/__tests__/runtime.test.d.ts +0 -1
  1572. package/dist/src/__tests__/runtime.test.js +0 -289
  1573. package/dist/src/__tests__/stdlib-advanced.test.d.ts +0 -4
  1574. package/dist/src/__tests__/stdlib-advanced.test.js +0 -374
  1575. package/dist/src/__tests__/stdlib-bigint.test.d.ts +0 -7
  1576. package/dist/src/__tests__/stdlib-bigint.test.js +0 -426
  1577. package/dist/src/__tests__/stdlib-math.test.d.ts +0 -7
  1578. package/dist/src/__tests__/stdlib-math.test.js +0 -351
  1579. package/dist/src/__tests__/stdlib-vec.test.d.ts +0 -4
  1580. package/dist/src/__tests__/stdlib-vec.test.js +0 -263
  1581. package/dist/src/__tests__/structure-optimizer.test.d.ts +0 -1
  1582. package/dist/src/__tests__/structure-optimizer.test.js +0 -33
  1583. package/dist/src/__tests__/timer-debug.test.d.ts +0 -1
  1584. package/dist/src/__tests__/timer-debug.test.js +0 -33
  1585. package/dist/src/__tests__/var-allocator.test.d.ts +0 -1
  1586. package/dist/src/__tests__/var-allocator.test.js +0 -69
  1587. package/dist/src/codegen/cmdblock/index.d.ts +0 -26
  1588. package/dist/src/codegen/cmdblock/index.js +0 -45
  1589. package/dist/src/codegen/mcfunction/index.d.ts +0 -40
  1590. package/dist/src/codegen/mcfunction/index.js +0 -606
  1591. package/dist/src/codegen/structure/index.d.ts +0 -24
  1592. package/dist/src/codegen/structure/index.js +0 -279
  1593. package/dist/src/codegen/var-allocator.d.ts +0 -45
  1594. package/dist/src/codegen/var-allocator.js +0 -104
  1595. package/dist/src/ir/builder.d.ts +0 -33
  1596. package/dist/src/ir/builder.js +0 -99
  1597. package/dist/src/ir/types.d.ts +0 -132
  1598. package/dist/src/ir/types.js +0 -15
  1599. package/dist/src/lowering/index.d.ts +0 -188
  1600. package/dist/src/lowering/index.js +0 -3405
  1601. package/dist/src/optimizer/commands.d.ts +0 -38
  1602. package/dist/src/optimizer/commands.js +0 -451
  1603. package/dist/src/optimizer/passes.d.ts +0 -34
  1604. package/dist/src/optimizer/passes.js +0 -243
  1605. package/dist/src/optimizer/structure.d.ts +0 -9
  1606. package/dist/src/optimizer/structure.js +0 -356
  1607. package/dist/src2/__tests__/e2e/basic.test.d.ts +0 -8
  1608. package/dist/src2/__tests__/e2e/basic.test.js +0 -140
  1609. package/dist/src2/__tests__/e2e/macros.test.d.ts +0 -9
  1610. package/dist/src2/__tests__/e2e/macros.test.js +0 -182
  1611. package/dist/src2/__tests__/e2e/migrate.test.d.ts +0 -13
  1612. package/dist/src2/__tests__/e2e/migrate.test.js +0 -2739
  1613. package/dist/src2/__tests__/hir/desugar.test.d.ts +0 -1
  1614. package/dist/src2/__tests__/hir/desugar.test.js +0 -234
  1615. package/dist/src2/__tests__/lir/lower.test.d.ts +0 -1
  1616. package/dist/src2/__tests__/lir/lower.test.js +0 -559
  1617. package/dist/src2/__tests__/lir/types.test.d.ts +0 -1
  1618. package/dist/src2/__tests__/lir/types.test.js +0 -185
  1619. package/dist/src2/__tests__/lir/verify.test.d.ts +0 -1
  1620. package/dist/src2/__tests__/lir/verify.test.js +0 -221
  1621. package/dist/src2/__tests__/mir/arithmetic.test.d.ts +0 -1
  1622. package/dist/src2/__tests__/mir/arithmetic.test.js +0 -130
  1623. package/dist/src2/__tests__/mir/control-flow.test.d.ts +0 -1
  1624. package/dist/src2/__tests__/mir/control-flow.test.js +0 -205
  1625. package/dist/src2/__tests__/mir/verify.test.d.ts +0 -1
  1626. package/dist/src2/__tests__/mir/verify.test.js +0 -223
  1627. package/dist/src2/__tests__/optimizer/block_merge.test.d.ts +0 -1
  1628. package/dist/src2/__tests__/optimizer/block_merge.test.js +0 -78
  1629. package/dist/src2/__tests__/optimizer/branch_simplify.test.d.ts +0 -1
  1630. package/dist/src2/__tests__/optimizer/branch_simplify.test.js +0 -58
  1631. package/dist/src2/__tests__/optimizer/constant_fold.test.d.ts +0 -1
  1632. package/dist/src2/__tests__/optimizer/constant_fold.test.js +0 -131
  1633. package/dist/src2/__tests__/optimizer/copy_prop.test.d.ts +0 -1
  1634. package/dist/src2/__tests__/optimizer/copy_prop.test.js +0 -91
  1635. package/dist/src2/__tests__/optimizer/dce.test.d.ts +0 -1
  1636. package/dist/src2/__tests__/optimizer/dce.test.js +0 -76
  1637. package/dist/src2/__tests__/optimizer/pipeline.test.d.ts +0 -1
  1638. package/dist/src2/__tests__/optimizer/pipeline.test.js +0 -102
  1639. package/dist/src2/emit/compile.d.ts +0 -19
  1640. package/dist/src2/emit/compile.js +0 -80
  1641. package/dist/src2/emit/index.d.ts +0 -17
  1642. package/dist/src2/emit/index.js +0 -172
  1643. package/dist/src2/hir/lower.d.ts +0 -15
  1644. package/dist/src2/hir/lower.js +0 -378
  1645. package/dist/src2/hir/types.d.ts +0 -373
  1646. package/dist/src2/hir/types.js +0 -16
  1647. package/dist/src2/lir/lower.d.ts +0 -15
  1648. package/dist/src2/lir/lower.js +0 -453
  1649. package/dist/src2/lir/types.d.ts +0 -136
  1650. package/dist/src2/lir/types.js +0 -11
  1651. package/dist/src2/lir/verify.d.ts +0 -14
  1652. package/dist/src2/lir/verify.js +0 -113
  1653. package/dist/src2/mir/lower.d.ts +0 -9
  1654. package/dist/src2/mir/lower.js +0 -1030
  1655. package/dist/src2/mir/macro.d.ts +0 -22
  1656. package/dist/src2/mir/macro.js +0 -168
  1657. package/dist/src2/mir/types.d.ts +0 -183
  1658. package/dist/src2/mir/types.js +0 -11
  1659. package/dist/src2/mir/verify.d.ts +0 -16
  1660. package/dist/src2/mir/verify.js +0 -216
  1661. package/dist/src2/optimizer/block_merge.d.ts +0 -12
  1662. package/dist/src2/optimizer/block_merge.js +0 -84
  1663. package/dist/src2/optimizer/branch_simplify.d.ts +0 -9
  1664. package/dist/src2/optimizer/branch_simplify.js +0 -28
  1665. package/dist/src2/optimizer/constant_fold.d.ts +0 -10
  1666. package/dist/src2/optimizer/constant_fold.js +0 -85
  1667. package/dist/src2/optimizer/copy_prop.d.ts +0 -9
  1668. package/dist/src2/optimizer/copy_prop.js +0 -113
  1669. package/dist/src2/optimizer/dce.d.ts +0 -8
  1670. package/dist/src2/optimizer/dce.js +0 -155
  1671. package/dist/src2/optimizer/pipeline.d.ts +0 -10
  1672. package/dist/src2/optimizer/pipeline.js +0 -42
  1673. package/dist/swap_test.map.json +0 -14
  1674. package/dist/tsconfig.tsbuildinfo +0 -1
  1675. package/dist/typechecker/index.d.ts +0 -61
  1676. package/dist/typechecker/index.js +0 -1034
  1677. package/dist/types/entity-hierarchy.d.ts +0 -29
  1678. package/dist/types/entity-hierarchy.js +0 -107
  1679. /package/dist/{__tests__/cli.test.d.ts → src/__tests__/for-range.test.d.ts} +0 -0
  1680. /package/dist/{__tests__/codegen.test.d.ts → src/__tests__/impl.test.d.ts} +0 -0
@@ -18263,6 +18263,7 @@ var require_lexer = __commonJS({
18263
18263
  int: "int",
18264
18264
  bool: "bool",
18265
18265
  float: "float",
18266
+ fixed: "fixed",
18266
18267
  string: "string",
18267
18268
  void: "void",
18268
18269
  BlockPos: "BlockPos",
@@ -18826,6 +18827,7 @@ var require_parser = __commonJS({
18826
18827
  constructor(tokens, source, filePath) {
18827
18828
  this.pos = 0;
18828
18829
  this.inLibraryMode = false;
18830
+ this.warnings = [];
18829
18831
  this.tokens = tokens;
18830
18832
  this.sourceLines = source?.split("\n") ?? [];
18831
18833
  this.filePath = filePath;
@@ -18897,12 +18899,14 @@ var require_parser = __commonJS({
18897
18899
  const implBlocks = [];
18898
18900
  const enums = [];
18899
18901
  const consts = [];
18902
+ const imports = [];
18900
18903
  let isLibrary = false;
18904
+ let moduleName;
18901
18905
  if (this.check("namespace")) {
18902
18906
  this.advance();
18903
18907
  const name = this.expect("ident");
18904
18908
  namespace = name.value;
18905
- this.expect(";");
18909
+ this.match(";");
18906
18910
  }
18907
18911
  if (this.check("module")) {
18908
18912
  this.advance();
@@ -18910,8 +18914,10 @@ var require_parser = __commonJS({
18910
18914
  if (modKind.value === "library") {
18911
18915
  isLibrary = true;
18912
18916
  this.inLibraryMode = true;
18917
+ } else {
18918
+ moduleName = modKind.value;
18913
18919
  }
18914
- this.expect(";");
18920
+ this.match(";");
18915
18921
  }
18916
18922
  while (!this.check("eof")) {
18917
18923
  if (this.check("let")) {
@@ -18929,11 +18935,25 @@ var require_parser = __commonJS({
18929
18935
  this.parseDeclareStub();
18930
18936
  } else if (this.check("export")) {
18931
18937
  declarations.push(this.parseExportedFnDecl());
18938
+ } else if (this.check("ident") && this.peek().value === "import") {
18939
+ this.advance();
18940
+ const importToken = this.peek();
18941
+ const modName = this.expect("ident").value;
18942
+ this.expect("::");
18943
+ let symbol;
18944
+ if (this.check("*")) {
18945
+ this.advance();
18946
+ symbol = "*";
18947
+ } else {
18948
+ symbol = this.expect("ident").value;
18949
+ }
18950
+ this.match(";");
18951
+ imports.push(this.withLoc({ moduleName: modName, symbol }, importToken));
18932
18952
  } else {
18933
18953
  declarations.push(this.parseFnDecl());
18934
18954
  }
18935
18955
  }
18936
- return { namespace, globals, declarations, structs, implBlocks, enums, consts, isLibrary };
18956
+ return { namespace, moduleName, globals, declarations, structs, implBlocks, enums, consts, imports, isLibrary };
18937
18957
  }
18938
18958
  // -------------------------------------------------------------------------
18939
18959
  // Struct Declaration
@@ -18998,7 +19018,7 @@ var require_parser = __commonJS({
18998
19018
  this.expect("=");
18999
19019
  const value = this.parseLiteralExpr();
19000
19020
  this.match(";");
19001
- const inferredType = type ?? (value.kind === "str_lit" ? { kind: "named", name: "string" } : value.kind === "bool_lit" ? { kind: "named", name: "bool" } : value.kind === "float_lit" ? { kind: "named", name: "float" } : { kind: "named", name: "int" });
19021
+ const inferredType = type ?? (value.kind === "str_lit" ? { kind: "named", name: "string" } : value.kind === "bool_lit" ? { kind: "named", name: "bool" } : value.kind === "float_lit" ? { kind: "named", name: "fixed" } : { kind: "named", name: "int" });
19002
19022
  return this.withLoc({ name, type: inferredType, value }, constToken);
19003
19023
  }
19004
19024
  parseGlobalDecl(mutable) {
@@ -19008,7 +19028,7 @@ var require_parser = __commonJS({
19008
19028
  const type = this.parseType();
19009
19029
  this.expect("=");
19010
19030
  const init = this.parseExpr();
19011
- this.expect(";");
19031
+ this.match(";");
19012
19032
  return this.withLoc({ kind: "global", name, type, init, mutable }, token);
19013
19033
  }
19014
19034
  // -------------------------------------------------------------------------
@@ -19142,6 +19162,8 @@ var require_parser = __commonJS({
19142
19162
  const [key, val] = part.split("=").map((s) => s.trim());
19143
19163
  if (key === "rate") {
19144
19164
  args.rate = parseInt(val, 10);
19165
+ } else if (key === "ticks") {
19166
+ args.ticks = parseInt(val, 10);
19145
19167
  } else if (key === "batch") {
19146
19168
  args.batch = parseInt(val, 10);
19147
19169
  } else if (key === "onDone") {
@@ -19199,7 +19221,12 @@ var require_parser = __commonJS({
19199
19221
  }
19200
19222
  return { kind: "tuple", elements };
19201
19223
  }
19202
- if (token.kind === "int" || token.kind === "bool" || token.kind === "float" || token.kind === "string" || token.kind === "void" || token.kind === "BlockPos") {
19224
+ if (token.kind === "float") {
19225
+ this.advance();
19226
+ const filePart = this.filePath ? `${this.filePath}:` : "";
19227
+ this.warnings.push(`[DeprecatedType] ${filePart}line ${token.line}, col ${token.col}: 'float' is deprecated, use 'fixed' instead (\xD710000 fixed-point)`);
19228
+ type = { kind: "named", name: "float" };
19229
+ } else if (token.kind === "int" || token.kind === "bool" || token.kind === "fixed" || token.kind === "string" || token.kind === "void" || token.kind === "BlockPos") {
19203
19230
  this.advance();
19204
19231
  type = { kind: "named", name: token.kind };
19205
19232
  } else if (token.kind === "ident") {
@@ -19211,6 +19238,13 @@ var require_parser = __commonJS({
19211
19238
  type = { kind: "selector", entityType };
19212
19239
  } else if (token.value === "selector") {
19213
19240
  type = { kind: "selector" };
19241
+ } else if (token.value === "Option" && this.check("<")) {
19242
+ this.advance();
19243
+ const inner = this.parseType();
19244
+ this.expect(">");
19245
+ type = { kind: "option", inner };
19246
+ } else if (token.value === "double" || token.value === "byte" || token.value === "short" || token.value === "long" || token.value === "format_string") {
19247
+ type = { kind: "named", name: token.value };
19214
19248
  } else {
19215
19249
  type = { kind: "struct", name: token.value };
19216
19250
  }
@@ -19312,7 +19346,7 @@ var require_parser = __commonJS({
19312
19346
  }
19313
19347
  this.expect("=");
19314
19348
  const init2 = this.parseExpr();
19315
- this.expect(";");
19349
+ this.match(";");
19316
19350
  return this.withLoc({ kind: "let_destruct", names, type: type2, init: init2 }, letToken);
19317
19351
  }
19318
19352
  const name = this.expect("ident").value;
@@ -19322,20 +19356,39 @@ var require_parser = __commonJS({
19322
19356
  }
19323
19357
  this.expect("=");
19324
19358
  const init = this.parseExpr();
19325
- this.expect(";");
19359
+ this.match(";");
19326
19360
  return this.withLoc({ kind: "let", name, type, init }, letToken);
19327
19361
  }
19328
19362
  parseReturnStmt() {
19329
19363
  const returnToken = this.expect("return");
19330
19364
  let value;
19331
- if (!this.check(";")) {
19365
+ if (!this.check(";") && !this.check("}") && !this.check("eof")) {
19332
19366
  value = this.parseExpr();
19333
19367
  }
19334
- this.expect(";");
19368
+ this.match(";");
19335
19369
  return this.withLoc({ kind: "return", value }, returnToken);
19336
19370
  }
19337
19371
  parseIfStmt() {
19338
19372
  const ifToken = this.expect("if");
19373
+ if (this.check("let") && this.peek(1).kind === "ident" && this.peek(1).value === "Some") {
19374
+ this.advance();
19375
+ this.advance();
19376
+ this.expect("(");
19377
+ const binding = this.expect("ident").value;
19378
+ this.expect(")");
19379
+ this.expect("=");
19380
+ const init = this.parseExpr();
19381
+ const then2 = this.parseBlock();
19382
+ let else_2;
19383
+ if (this.match("else")) {
19384
+ if (this.check("if")) {
19385
+ else_2 = [this.parseIfStmt()];
19386
+ } else {
19387
+ else_2 = this.parseBlock();
19388
+ }
19389
+ }
19390
+ return this.withLoc({ kind: "if_let_some", binding, init, then: then2, else_: else_2 }, ifToken);
19391
+ }
19339
19392
  this.expect("(");
19340
19393
  const cond = this.parseExpr();
19341
19394
  this.expect(")");
@@ -19364,6 +19417,17 @@ var require_parser = __commonJS({
19364
19417
  return this.parseForRangeStmt(forToken);
19365
19418
  }
19366
19419
  this.expect("(");
19420
+ if (this.check("let") && this.peek(1).kind === "ident" && this.peek(2).kind === "in" && this.peek(3).kind === "ident" && this.peek(4).kind === ",") {
19421
+ this.advance();
19422
+ const binding = this.expect("ident").value;
19423
+ this.expect("in");
19424
+ const arrayName = this.expect("ident").value;
19425
+ this.expect(",");
19426
+ const lenExpr = this.parseExpr();
19427
+ this.expect(")");
19428
+ const body2 = this.parseBlock();
19429
+ return this.withLoc({ kind: "for_in_array", binding, arrayName, lenExpr, body: body2 }, forToken);
19430
+ }
19367
19431
  let init;
19368
19432
  if (this.check("let")) {
19369
19433
  const letToken = this.expect("let");
@@ -19623,7 +19687,7 @@ var require_parser = __commonJS({
19623
19687
  }
19624
19688
  parseExprStmt() {
19625
19689
  const expr = this.parseExpr();
19626
- this.expect(";");
19690
+ this.match(";");
19627
19691
  const exprToken = this.getLocToken(expr) ?? this.peek();
19628
19692
  return this.withLoc({ kind: "expr", expr }, exprToken);
19629
19693
  }
@@ -19646,6 +19710,10 @@ var require_parser = __commonJS({
19646
19710
  const value = this.parseAssignment();
19647
19711
  return this.withLoc({ kind: "member_assign", obj: left.obj, field: left.field, op, value }, this.getLocToken(left) ?? token);
19648
19712
  }
19713
+ if (left.kind === "index") {
19714
+ const value = this.parseAssignment();
19715
+ return this.withLoc({ kind: "index_assign", obj: left.obj, index: left.index, op, value }, this.getLocToken(left) ?? token);
19716
+ }
19649
19717
  }
19650
19718
  return left;
19651
19719
  }
@@ -19781,10 +19849,28 @@ var require_parser = __commonJS({
19781
19849
  expr = this.withLoc({ kind: "member", obj: expr, field }, this.getLocToken(expr) ?? this.tokens[this.pos - 1]);
19782
19850
  continue;
19783
19851
  }
19852
+ if (this.check("as") && this.isTypeCastAs()) {
19853
+ const asToken = this.advance();
19854
+ const targetType = this.parseType();
19855
+ expr = this.withLoc({ kind: "type_cast", expr, targetType }, this.getLocToken(expr) ?? asToken);
19856
+ continue;
19857
+ }
19784
19858
  break;
19785
19859
  }
19786
19860
  return expr;
19787
19861
  }
19862
+ /** Returns true if the current 'as' token is a type cast (not a context block) */
19863
+ isTypeCastAs() {
19864
+ const next = this.tokens[this.pos + 1];
19865
+ if (!next)
19866
+ return false;
19867
+ const typeStartTokens = /* @__PURE__ */ new Set(["int", "bool", "float", "fixed", "string", "void", "BlockPos", "("]);
19868
+ if (typeStartTokens.has(next.kind))
19869
+ return true;
19870
+ if (next.kind === "ident" && (next.value === "double" || next.value === "byte" || next.value === "short" || next.value === "long" || next.value === "selector" || next.value === "Option"))
19871
+ return true;
19872
+ return false;
19873
+ }
19788
19874
  parseArgs() {
19789
19875
  const args = [];
19790
19876
  if (!this.check(")")) {
@@ -19876,6 +19962,17 @@ var require_parser = __commonJS({
19876
19962
  sel: this.parseSelectorValue(token.value)
19877
19963
  }, token);
19878
19964
  }
19965
+ if (token.kind === "ident" && token.value === "Some" && this.peek(1).kind === "(") {
19966
+ this.advance();
19967
+ this.advance();
19968
+ const value = this.parseExpr();
19969
+ this.expect(")");
19970
+ return this.withLoc({ kind: "some_lit", value }, token);
19971
+ }
19972
+ if (token.kind === "ident" && token.value === "None") {
19973
+ this.advance();
19974
+ return this.withLoc({ kind: "none_lit" }, token);
19975
+ }
19879
19976
  if (token.kind === "ident") {
19880
19977
  this.advance();
19881
19978
  return this.withLoc({ kind: "ident", name: token.value }, token);
@@ -20168,7 +20265,7 @@ var require_parser = __commonJS({
20168
20265
  const returnLen = this.typeTokenLength(inner);
20169
20266
  return returnLen === 0 ? 0 : inner + returnLen - offset;
20170
20267
  }
20171
- const isNamedType = token.kind === "int" || token.kind === "bool" || token.kind === "float" || token.kind === "string" || token.kind === "void" || token.kind === "BlockPos" || token.kind === "ident";
20268
+ const isNamedType = token.kind === "int" || token.kind === "bool" || token.kind === "float" || token.kind === "fixed" || token.kind === "string" || token.kind === "void" || token.kind === "BlockPos" || token.kind === "ident";
20172
20269
  if (!isNamedType) {
20173
20270
  return 0;
20174
20271
  }
@@ -20480,6 +20577,25 @@ var require_compile = __commonJS({
20480
20577
  }
20481
20578
  return false;
20482
20579
  }
20580
+ function resolveImportPath(spec, fromFile, includeDirs) {
20581
+ const candidates = spec.endsWith(".mcrs") ? [spec] : [spec, spec + ".mcrs"];
20582
+ for (const candidate of candidates) {
20583
+ const rel = path3.resolve(path3.dirname(fromFile), candidate);
20584
+ if (fs2.existsSync(rel))
20585
+ return rel;
20586
+ const stdlibDir = path3.resolve(__dirname, "..", "src", "stdlib");
20587
+ const stdlibCandidate = candidate.replace(/^stdlib\//, "");
20588
+ const stdlib = path3.resolve(stdlibDir, stdlibCandidate);
20589
+ if (fs2.existsSync(stdlib))
20590
+ return stdlib;
20591
+ for (const dir of includeDirs) {
20592
+ const extra = path3.resolve(dir, candidate);
20593
+ if (fs2.existsSync(extra))
20594
+ return extra;
20595
+ }
20596
+ }
20597
+ return null;
20598
+ }
20483
20599
  function countLines(source) {
20484
20600
  return source === "" ? 0 : source.split("\n").length;
20485
20601
  }
@@ -20493,6 +20609,7 @@ var require_compile = __commonJS({
20493
20609
  function preprocessSourceWithMetadata(source, options = {}) {
20494
20610
  const { filePath } = options;
20495
20611
  const seen = options.seen ?? /* @__PURE__ */ new Set();
20612
+ const includeDirs = options.includeDirs ?? [];
20496
20613
  if (filePath) {
20497
20614
  seen.add(path3.resolve(filePath));
20498
20615
  }
@@ -20509,22 +20626,20 @@ var require_compile = __commonJS({
20509
20626
  if (!filePath) {
20510
20627
  throw new diagnostics_1.DiagnosticError("ParseError", "Import statements require a file path", { line: i + 1, col: 1 }, lines);
20511
20628
  }
20512
- const importPath = path3.resolve(path3.dirname(filePath), match[1]);
20629
+ const importPath = resolveImportPath(match[1], filePath, includeDirs);
20630
+ if (!importPath) {
20631
+ throw new diagnostics_1.DiagnosticError("ParseError", `Cannot import '${match[1]}'`, { file: filePath, line: i + 1, col: 1 }, lines);
20632
+ }
20513
20633
  if (!seen.has(importPath)) {
20514
20634
  seen.add(importPath);
20515
- let importedSource;
20516
- try {
20517
- importedSource = fs2.readFileSync(importPath, "utf-8");
20518
- } catch {
20519
- throw new diagnostics_1.DiagnosticError("ParseError", `Cannot import '${match[1]}'`, { file: filePath, line: i + 1, col: 1 }, lines);
20520
- }
20635
+ const importedSource = fs2.readFileSync(importPath, "utf-8");
20521
20636
  if (isLibrarySource(importedSource)) {
20522
- const nested = preprocessSourceWithMetadata(importedSource, { filePath: importPath, seen });
20637
+ const nested = preprocessSourceWithMetadata(importedSource, { filePath: importPath, seen, includeDirs });
20523
20638
  libraryImports.push({ source: importedSource, filePath: importPath });
20524
20639
  if (nested.libraryImports)
20525
20640
  libraryImports.push(...nested.libraryImports);
20526
20641
  } else {
20527
- imports.push(preprocessSourceWithMetadata(importedSource, { filePath: importPath, seen }));
20642
+ imports.push(preprocessSourceWithMetadata(importedSource, { filePath: importPath, seen, includeDirs }));
20528
20643
  }
20529
20644
  }
20530
20645
  continue;
@@ -20717,6 +20832,57 @@ var require_lower = __commonJS({
20717
20832
  };
20718
20833
  return [initStmt, whileStmt];
20719
20834
  }
20835
+ // --- Desugaring: for_in_array → let idx = 0; while(idx < len) { let v = arr[idx]; body; idx = idx + 1 } ---
20836
+ case "for_in_array": {
20837
+ const idxName = `__forin_idx_${stmt.binding}`;
20838
+ const initStmt = {
20839
+ kind: "let",
20840
+ name: idxName,
20841
+ type: { kind: "named", name: "int" },
20842
+ init: { kind: "int_lit", value: 0 },
20843
+ span: stmt.span
20844
+ };
20845
+ const bindingInit = {
20846
+ kind: "let",
20847
+ name: stmt.binding,
20848
+ type: void 0,
20849
+ init: {
20850
+ kind: "index",
20851
+ obj: { kind: "ident", name: stmt.arrayName },
20852
+ index: { kind: "ident", name: idxName }
20853
+ },
20854
+ span: stmt.span
20855
+ };
20856
+ const stepStmt = {
20857
+ kind: "expr",
20858
+ expr: {
20859
+ kind: "assign",
20860
+ target: idxName,
20861
+ value: {
20862
+ kind: "binary",
20863
+ op: "+",
20864
+ left: { kind: "ident", name: idxName },
20865
+ right: { kind: "int_lit", value: 1 }
20866
+ }
20867
+ },
20868
+ span: stmt.span
20869
+ };
20870
+ const body = [bindingInit, ...lowerBlock(stmt.body)];
20871
+ const step = [stepStmt];
20872
+ const whileStmt = {
20873
+ kind: "while",
20874
+ cond: {
20875
+ kind: "binary",
20876
+ op: "<",
20877
+ left: { kind: "ident", name: idxName },
20878
+ right: lowerExpr(stmt.lenExpr)
20879
+ },
20880
+ body,
20881
+ step,
20882
+ span: stmt.span
20883
+ };
20884
+ return [initStmt, whileStmt];
20885
+ }
20720
20886
  case "foreach":
20721
20887
  return {
20722
20888
  kind: "foreach",
@@ -20772,6 +20938,15 @@ var require_lower = __commonJS({
20772
20938
  };
20773
20939
  case "raw":
20774
20940
  return { kind: "raw", cmd: stmt.cmd, span: stmt.span };
20941
+ case "if_let_some":
20942
+ return {
20943
+ kind: "if_let_some",
20944
+ binding: stmt.binding,
20945
+ init: lowerExpr(stmt.init),
20946
+ then: lowerBlock(stmt.then),
20947
+ else_: stmt.else_ ? lowerBlock(stmt.else_) : void 0,
20948
+ span: stmt.span
20949
+ };
20775
20950
  default: {
20776
20951
  const _exhaustive = stmt;
20777
20952
  throw new Error(`Unknown statement kind: ${_exhaustive.kind}`);
@@ -20886,6 +21061,35 @@ var require_lower = __commonJS({
20886
21061
  return { kind: "member", obj: lowerExpr(expr.obj), field: expr.field, span: expr.span };
20887
21062
  case "index":
20888
21063
  return { kind: "index", obj: lowerExpr(expr.obj), index: lowerExpr(expr.index), span: expr.span };
21064
+ // --- Desugaring: compound index_assign → plain index_assign ---
21065
+ case "index_assign":
21066
+ if (expr.op !== "=") {
21067
+ const binOp = COMPOUND_TO_BINOP[expr.op];
21068
+ const obj = lowerExpr(expr.obj);
21069
+ const index = lowerExpr(expr.index);
21070
+ return {
21071
+ kind: "index_assign",
21072
+ obj,
21073
+ index,
21074
+ op: "=",
21075
+ value: {
21076
+ kind: "binary",
21077
+ op: binOp,
21078
+ left: { kind: "index", obj, index },
21079
+ right: lowerExpr(expr.value),
21080
+ span: expr.span
21081
+ },
21082
+ span: expr.span
21083
+ };
21084
+ }
21085
+ return {
21086
+ kind: "index_assign",
21087
+ obj: lowerExpr(expr.obj),
21088
+ index: lowerExpr(expr.index),
21089
+ op: expr.op,
21090
+ value: lowerExpr(expr.value),
21091
+ span: expr.span
21092
+ };
20889
21093
  case "call":
20890
21094
  return { kind: "call", fn: expr.fn, args: expr.args.map(lowerExpr), typeArgs: expr.typeArgs, span: expr.span };
20891
21095
  case "invoke":
@@ -20902,6 +21106,12 @@ var require_lower = __commonJS({
20902
21106
  return { kind: "path_expr", enumName: expr.enumName, variant: expr.variant, span: expr.span };
20903
21107
  case "tuple_lit":
20904
21108
  return { kind: "tuple_lit", elements: expr.elements.map(lowerExpr), span: expr.span };
21109
+ case "some_lit":
21110
+ return { kind: "some_lit", value: lowerExpr(expr.value), span: expr.span };
21111
+ case "none_lit":
21112
+ return { kind: "none_lit", span: expr.span };
21113
+ case "type_cast":
21114
+ return { kind: "type_cast", expr: lowerExpr(expr.expr), targetType: expr.targetType, span: expr.span };
20905
21115
  case "lambda": {
20906
21116
  const body = Array.isArray(expr.body) ? lowerBlock(expr.body) : lowerExpr(expr.body);
20907
21117
  return {
@@ -20943,6 +21153,8 @@ var require_monomorphize = __commonJS({
20943
21153
  return `arr_${typeSuffix(t.elem)}`;
20944
21154
  case "tuple":
20945
21155
  return `tup_${t.elements.map(typeSuffix).join("_")}`;
21156
+ case "option":
21157
+ return `opt_${typeSuffix(t.inner)}`;
20946
21158
  default:
20947
21159
  return "unknown";
20948
21160
  }
@@ -20969,6 +21181,8 @@ var require_monomorphize = __commonJS({
20969
21181
  return { kind: "array", elem: substType(t.elem, subst) };
20970
21182
  case "tuple":
20971
21183
  return { kind: "tuple", elements: t.elements.map((e) => substType(e, subst)) };
21184
+ case "option":
21185
+ return { kind: "option", inner: substType(t.inner, subst) };
20972
21186
  case "function_type":
20973
21187
  return { kind: "function_type", params: t.params.map((p) => substType(p, subst)), return: substType(t.return, subst) };
20974
21188
  default:
@@ -21116,6 +21330,13 @@ var require_monomorphize = __commonJS({
21116
21330
  };
21117
21331
  case "execute":
21118
21332
  return { ...stmt, body: this.rewriteBlock(stmt.body, ctx) };
21333
+ case "if_let_some":
21334
+ return {
21335
+ ...stmt,
21336
+ init: this.rewriteExpr(stmt.init, ctx),
21337
+ then: this.rewriteBlock(stmt.then, ctx),
21338
+ else_: stmt.else_ ? this.rewriteBlock(stmt.else_, ctx) : void 0
21339
+ };
21119
21340
  case "break":
21120
21341
  case "continue":
21121
21342
  case "raw":
@@ -21152,6 +21373,8 @@ var require_monomorphize = __commonJS({
21152
21373
  return { ...expr, value: this.rewriteExpr(expr.value, ctx) };
21153
21374
  case "member_assign":
21154
21375
  return { ...expr, obj: this.rewriteExpr(expr.obj, ctx), value: this.rewriteExpr(expr.value, ctx) };
21376
+ case "index_assign":
21377
+ return { ...expr, obj: this.rewriteExpr(expr.obj, ctx), index: this.rewriteExpr(expr.index, ctx), value: this.rewriteExpr(expr.value, ctx) };
21155
21378
  case "member":
21156
21379
  return { ...expr, obj: this.rewriteExpr(expr.obj, ctx) };
21157
21380
  case "index":
@@ -21172,6 +21395,10 @@ var require_monomorphize = __commonJS({
21172
21395
  return { ...expr, parts: expr.parts.map((p) => typeof p === "string" ? p : this.rewriteExpr(p, ctx)) };
21173
21396
  case "f_string":
21174
21397
  return expr;
21398
+ case "some_lit":
21399
+ return { ...expr, value: this.rewriteExpr(expr.value, ctx) };
21400
+ case "none_lit":
21401
+ return expr;
21175
21402
  // Literals / terminals — pass through unchanged
21176
21403
  default:
21177
21404
  return expr;
@@ -21223,7 +21450,7 @@ var require_monomorphize = __commonJS({
21223
21450
  case "int_lit":
21224
21451
  return { kind: "named", name: "int" };
21225
21452
  case "float_lit":
21226
- return { kind: "named", name: "float" };
21453
+ return { kind: "named", name: "fixed" };
21227
21454
  case "bool_lit":
21228
21455
  return { kind: "named", name: "bool" };
21229
21456
  case "str_lit":
@@ -21400,6 +21627,11 @@ var require_macro = __commonJS({
21400
21627
  scanExpr(expr.obj, paramNames, macroParams);
21401
21628
  scanExpr(expr.value, paramNames, macroParams);
21402
21629
  break;
21630
+ case "index_assign":
21631
+ scanExpr(expr.obj, paramNames, macroParams);
21632
+ scanExpr(expr.index, paramNames, macroParams);
21633
+ scanExpr(expr.value, paramNames, macroParams);
21634
+ break;
21403
21635
  case "member":
21404
21636
  scanExpr(expr.obj, paramNames, macroParams);
21405
21637
  break;
@@ -21465,17 +21697,26 @@ var require_lower2 = __commonJS({
21465
21697
  fnParamInfo.set(`${ib.typeName}::${m.name}`, m.params);
21466
21698
  }
21467
21699
  }
21700
+ const timerCounter = { count: 0, timerId: 0 };
21701
+ const hirFnMap = /* @__PURE__ */ new Map();
21702
+ for (const f of hir.functions) {
21703
+ hirFnMap.set(f.name, f);
21704
+ }
21705
+ const specializedFnsRegistry = /* @__PURE__ */ new Map();
21468
21706
  const allFunctions = [];
21469
21707
  for (const f of hir.functions) {
21470
- const { fn, helpers } = lowerFunction(f, hir.namespace, structDefs, implMethods, macroInfo, fnParamInfo, enumDefs, sourceFile);
21708
+ const { fn, helpers } = lowerFunction(f, hir.namespace, structDefs, implMethods, macroInfo, fnParamInfo, enumDefs, sourceFile, timerCounter, void 0, hirFnMap, specializedFnsRegistry);
21471
21709
  allFunctions.push(fn, ...helpers);
21472
21710
  }
21473
21711
  for (const ib of hir.implBlocks) {
21474
21712
  for (const m of ib.methods) {
21475
- const { fn, helpers } = lowerImplMethod(m, ib.typeName, hir.namespace, structDefs, implMethods, macroInfo, fnParamInfo, enumDefs, sourceFile);
21713
+ const { fn, helpers } = lowerImplMethod(m, ib.typeName, hir.namespace, structDefs, implMethods, macroInfo, fnParamInfo, enumDefs, sourceFile, timerCounter);
21476
21714
  allFunctions.push(fn, ...helpers);
21477
21715
  }
21478
21716
  }
21717
+ for (const fns of specializedFnsRegistry.values()) {
21718
+ allFunctions.push(...fns);
21719
+ }
21479
21720
  return {
21480
21721
  functions: allFunctions,
21481
21722
  namespace: hir.namespace,
@@ -21483,7 +21724,7 @@ var require_lower2 = __commonJS({
21483
21724
  };
21484
21725
  }
21485
21726
  var FnContext = class {
21486
- constructor(namespace, fnName, structDefs = /* @__PURE__ */ new Map(), implMethods = /* @__PURE__ */ new Map(), macroInfo = /* @__PURE__ */ new Map(), fnParamInfo = /* @__PURE__ */ new Map(), enumDefs = /* @__PURE__ */ new Map()) {
21727
+ constructor(namespace, fnName, structDefs = /* @__PURE__ */ new Map(), implMethods = /* @__PURE__ */ new Map(), macroInfo = /* @__PURE__ */ new Map(), fnParamInfo = /* @__PURE__ */ new Map(), enumDefs = /* @__PURE__ */ new Map(), timerCounter = { count: 0, timerId: 0 }) {
21487
21728
  this.tempCounter = 0;
21488
21729
  this.blockCounter = 0;
21489
21730
  this.blocks = [];
@@ -21491,8 +21732,15 @@ var require_lower2 = __commonJS({
21491
21732
  this.helperFunctions = [];
21492
21733
  this.structVars = /* @__PURE__ */ new Map();
21493
21734
  this.tupleVars = /* @__PURE__ */ new Map();
21735
+ this.arrayVars = /* @__PURE__ */ new Map();
21494
21736
  this.currentSourceLoc = void 0;
21495
21737
  this.sourceFile = void 0;
21738
+ this.constTemps = /* @__PURE__ */ new Map();
21739
+ this.floatTemps = /* @__PURE__ */ new Set();
21740
+ this.doubleVars = /* @__PURE__ */ new Map();
21741
+ this.doubleVarCount = 0;
21742
+ this.hirFunctions = /* @__PURE__ */ new Map();
21743
+ this.specializedFnsRegistry = /* @__PURE__ */ new Map();
21496
21744
  this.namespace = namespace;
21497
21745
  this.fnName = fnName;
21498
21746
  this.structDefs = structDefs;
@@ -21501,6 +21749,7 @@ var require_lower2 = __commonJS({
21501
21749
  this.fnParamInfo = fnParamInfo;
21502
21750
  this.currentMacroParams = macroInfo.get(fnName)?.macroParams ?? /* @__PURE__ */ new Set();
21503
21751
  this.enumDefs = enumDefs;
21752
+ this.timerCounter = timerCounter;
21504
21753
  const entry = this.makeBlock("entry");
21505
21754
  this.currentBlock = entry;
21506
21755
  }
@@ -21554,18 +21803,42 @@ var require_lower2 = __commonJS({
21554
21803
  getFnName() {
21555
21804
  return this.fnName;
21556
21805
  }
21806
+ /** Allocate a unique NBT storage path for a double variable */
21807
+ freshDoubleVar(varName) {
21808
+ const path3 = `${this.namespace}_${this.fnName}_${varName}_${this.doubleVarCount++}`;
21809
+ this.doubleVars.set(varName, path3);
21810
+ return path3;
21811
+ }
21557
21812
  };
21558
- function lowerFunction(fn, namespace, structDefs = /* @__PURE__ */ new Map(), implMethods = /* @__PURE__ */ new Map(), macroInfo = /* @__PURE__ */ new Map(), fnParamInfo = /* @__PURE__ */ new Map(), enumDefs = /* @__PURE__ */ new Map(), sourceFile) {
21559
- const ctx = new FnContext(namespace, fn.name, structDefs, implMethods, macroInfo, fnParamInfo, enumDefs);
21813
+ function lowerFunction(fn, namespace, structDefs = /* @__PURE__ */ new Map(), implMethods = /* @__PURE__ */ new Map(), macroInfo = /* @__PURE__ */ new Map(), fnParamInfo = /* @__PURE__ */ new Map(), enumDefs = /* @__PURE__ */ new Map(), sourceFile, timerCounter = { count: 0, timerId: 0 }, arrayArgBindings, hirFnMap, specializedFnsRegistry, overrideName) {
21814
+ const mirFnName = overrideName ?? fn.name;
21815
+ const ctx = new FnContext(namespace, mirFnName, structDefs, implMethods, macroInfo, fnParamInfo, enumDefs, timerCounter);
21560
21816
  ctx.sourceFile = sourceFile;
21817
+ if (hirFnMap)
21818
+ ctx.hirFunctions = hirFnMap;
21819
+ if (specializedFnsRegistry)
21820
+ ctx.specializedFnsRegistry = specializedFnsRegistry;
21561
21821
  const fnMacroInfo = macroInfo.get(fn.name);
21562
- const params = fn.params.map((p) => {
21563
- const t = ctx.freshTemp();
21564
- return { name: t, isMacroParam: fnMacroInfo?.macroParams.has(p.name) ?? false };
21565
- });
21822
+ if (arrayArgBindings) {
21823
+ for (const [paramName, arrInfo] of arrayArgBindings) {
21824
+ ctx.arrayVars.set(paramName, arrInfo);
21825
+ }
21826
+ }
21827
+ const params = [];
21566
21828
  const scope = /* @__PURE__ */ new Map();
21567
- fn.params.forEach((p, i) => {
21568
- scope.set(p.name, params[i].name);
21829
+ let doubleParamSlot = 0;
21830
+ fn.params.forEach((p) => {
21831
+ if (p.type.kind === "array" && arrayArgBindings?.has(p.name)) {
21832
+ return;
21833
+ }
21834
+ if (p.type.kind === "named" && p.type.name === "double") {
21835
+ const path3 = `__dp${doubleParamSlot++}`;
21836
+ ctx.doubleVars.set(p.name, path3);
21837
+ return;
21838
+ }
21839
+ const t = ctx.freshTemp();
21840
+ params.push({ name: t, isMacroParam: fnMacroInfo?.macroParams.has(p.name) ?? false });
21841
+ scope.set(p.name, t);
21569
21842
  });
21570
21843
  lowerBlock(fn.body, ctx, scope);
21571
21844
  const cur = ctx.current();
@@ -21576,7 +21849,7 @@ var require_lower2 = __commonJS({
21576
21849
  const liveBlocks = ctx.blocks.filter((b) => reachable.has(b.id));
21577
21850
  computePreds(liveBlocks);
21578
21851
  const result = {
21579
- name: fn.name,
21852
+ name: mirFnName,
21580
21853
  params,
21581
21854
  blocks: liveBlocks,
21582
21855
  entry: "entry",
@@ -21584,9 +21857,9 @@ var require_lower2 = __commonJS({
21584
21857
  };
21585
21858
  return { fn: result, helpers: ctx.helperFunctions };
21586
21859
  }
21587
- function lowerImplMethod(method, typeName, namespace, structDefs, implMethods, macroInfo = /* @__PURE__ */ new Map(), fnParamInfo = /* @__PURE__ */ new Map(), enumDefs = /* @__PURE__ */ new Map(), sourceFile) {
21860
+ function lowerImplMethod(method, typeName, namespace, structDefs, implMethods, macroInfo = /* @__PURE__ */ new Map(), fnParamInfo = /* @__PURE__ */ new Map(), enumDefs = /* @__PURE__ */ new Map(), sourceFile, timerCounter = { count: 0, timerId: 0 }) {
21588
21861
  const fnName = `${typeName}::${method.name}`;
21589
- const ctx = new FnContext(namespace, fnName, structDefs, implMethods, macroInfo, fnParamInfo, enumDefs);
21862
+ const ctx = new FnContext(namespace, fnName, structDefs, implMethods, macroInfo, fnParamInfo, enumDefs, timerCounter);
21590
21863
  ctx.sourceFile = sourceFile;
21591
21864
  const fields = structDefs.get(typeName) ?? [];
21592
21865
  const hasSelf = method.params.length > 0 && method.params[0].name === "self";
@@ -21686,7 +21959,22 @@ var require_lower2 = __commonJS({
21686
21959
  }
21687
21960
  switch (stmt.kind) {
21688
21961
  case "let": {
21689
- if (stmt.init.kind === "struct_lit") {
21962
+ if (stmt.init.kind === "some_lit") {
21963
+ const hasTemp = `__opt_${stmt.name}_has`;
21964
+ const valTemp = `__opt_${stmt.name}_val`;
21965
+ ctx.emit({ kind: "const", dst: hasTemp, value: 1 });
21966
+ const valOp = lowerExpr(stmt.init.value, ctx, scope);
21967
+ ctx.emit({ kind: "copy", dst: valTemp, src: valOp });
21968
+ const fieldTemps = /* @__PURE__ */ new Map([["has", hasTemp], ["val", valTemp]]);
21969
+ ctx.structVars.set(stmt.name, { typeName: "__option", fields: fieldTemps });
21970
+ } else if (stmt.init.kind === "none_lit") {
21971
+ const hasTemp = `__opt_${stmt.name}_has`;
21972
+ const valTemp = `__opt_${stmt.name}_val`;
21973
+ ctx.emit({ kind: "const", dst: hasTemp, value: 0 });
21974
+ ctx.emit({ kind: "const", dst: valTemp, value: 0 });
21975
+ const fieldTemps = /* @__PURE__ */ new Map([["has", hasTemp], ["val", valTemp]]);
21976
+ ctx.structVars.set(stmt.name, { typeName: "__option", fields: fieldTemps });
21977
+ } else if (stmt.init.kind === "struct_lit") {
21690
21978
  const typeName = stmt.type?.kind === "struct" ? stmt.type.name : "__anon";
21691
21979
  const fieldTemps = /* @__PURE__ */ new Map();
21692
21980
  for (const field of stmt.init.fields) {
@@ -21696,6 +21984,14 @@ var require_lower2 = __commonJS({
21696
21984
  fieldTemps.set(field.name, t);
21697
21985
  }
21698
21986
  ctx.structVars.set(stmt.name, { typeName, fields: fieldTemps });
21987
+ } else if (stmt.type?.kind === "option") {
21988
+ lowerExpr(stmt.init, ctx, scope);
21989
+ const hasTemp = `__opt_${stmt.name}_has`;
21990
+ const valTemp = `__opt_${stmt.name}_val`;
21991
+ ctx.emit({ kind: "copy", dst: hasTemp, src: { kind: "temp", name: "__rf_has" } });
21992
+ ctx.emit({ kind: "copy", dst: valTemp, src: { kind: "temp", name: "__rf_val" } });
21993
+ const fieldTemps = /* @__PURE__ */ new Map([["has", hasTemp], ["val", valTemp]]);
21994
+ ctx.structVars.set(stmt.name, { typeName: "__option", fields: fieldTemps });
21699
21995
  } else if (stmt.type?.kind === "struct") {
21700
21996
  const fields = ctx.structDefs.get(stmt.type.name);
21701
21997
  if (fields) {
@@ -21705,6 +22001,11 @@ var require_lower2 = __commonJS({
21705
22001
  const t = ctx.freshTemp();
21706
22002
  ctx.emit({ kind: "copy", dst: t, src: { kind: "temp", name: `__rf_${fieldName}` } });
21707
22003
  fieldTemps.set(fieldName, t);
22004
+ const rfSlot = `__rf_${fieldName}`;
22005
+ const constVal = ctx.constTemps.get(rfSlot);
22006
+ if (constVal !== void 0) {
22007
+ ctx.constTemps.set(t, constVal);
22008
+ }
21708
22009
  }
21709
22010
  ctx.structVars.set(stmt.name, { typeName: stmt.type.name, fields: fieldTemps });
21710
22011
  } else {
@@ -21713,11 +22014,50 @@ var require_lower2 = __commonJS({
21713
22014
  ctx.emit({ kind: "copy", dst: t, src: valOp });
21714
22015
  scope.set(stmt.name, t);
21715
22016
  }
22017
+ } else if (stmt.type?.kind === "named" && stmt.type.name === "double") {
22018
+ const path3 = ctx.freshDoubleVar(stmt.name);
22019
+ const ns = ctx.getNamespace();
22020
+ if (stmt.init.kind === "double_lit") {
22021
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:data modify storage rs:d ${path3} set value ${stmt.init.value}d`, args: [] });
22022
+ } else {
22023
+ const initOp = lowerExpr(stmt.init, ctx, scope);
22024
+ const initTemp = ctx.freshTemp();
22025
+ ctx.emit({ kind: "copy", dst: initTemp, src: initOp });
22026
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:execute store result storage rs:d ${path3} double 0.0001 run scoreboard players get $${initTemp} __${ns}`, args: [] });
22027
+ }
22028
+ const t = ctx.freshTemp();
22029
+ ctx.emit({ kind: "const", dst: t, value: 0 });
22030
+ scope.set(stmt.name, t);
22031
+ } else if (stmt.init.kind === "array_lit") {
22032
+ const ns = `${ctx.getNamespace()}:arrays`;
22033
+ const pathPrefix = stmt.name;
22034
+ ctx.arrayVars.set(stmt.name, { ns, pathPrefix });
22035
+ const elems = stmt.init.elements;
22036
+ const allConst = elems.every((e) => e.kind === "int_lit");
22037
+ if (allConst) {
22038
+ const vals = elems.map((e) => e.value).join(", ");
22039
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:data modify storage ${ns} ${pathPrefix} set value [${vals}]`, args: [] });
22040
+ } else {
22041
+ const zeros = elems.map(() => "0").join(", ");
22042
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:data modify storage ${ns} ${pathPrefix} set value [${zeros}]`, args: [] });
22043
+ for (let i = 0; i < elems.length; i++) {
22044
+ const elemOp = lowerExpr(elems[i], ctx, scope);
22045
+ if (elemOp.kind !== "const" || elems[i].kind !== "int_lit") {
22046
+ ctx.emit({ kind: "nbt_write", ns, path: `${pathPrefix}[${i}]`, type: "int", scale: 1, src: elemOp });
22047
+ }
22048
+ }
22049
+ }
22050
+ const lenTemp = ctx.freshTemp();
22051
+ ctx.emit({ kind: "const", dst: lenTemp, value: elems.length });
22052
+ scope.set(stmt.name, lenTemp);
21716
22053
  } else {
21717
22054
  const valOp = lowerExpr(stmt.init, ctx, scope);
21718
22055
  const t = ctx.freshTemp();
21719
22056
  ctx.emit({ kind: "copy", dst: t, src: valOp });
21720
22057
  scope.set(stmt.name, t);
22058
+ if (stmt.type?.kind === "named" && (stmt.type.name === "fixed" || stmt.type.name === "float")) {
22059
+ ctx.floatTemps.add(t);
22060
+ }
21721
22061
  }
21722
22062
  break;
21723
22063
  }
@@ -21767,7 +22107,16 @@ var require_lower2 = __commonJS({
21767
22107
  break;
21768
22108
  }
21769
22109
  case "return": {
21770
- if (stmt.value?.kind === "struct_lit") {
22110
+ if (stmt.value?.kind === "some_lit") {
22111
+ const valOp = lowerExpr(stmt.value.value, ctx, scope);
22112
+ ctx.emit({ kind: "copy", dst: "__rf_has", src: { kind: "const", value: 1 } });
22113
+ ctx.emit({ kind: "copy", dst: "__rf_val", src: valOp });
22114
+ ctx.terminate({ kind: "return", value: null });
22115
+ } else if (stmt.value?.kind === "none_lit") {
22116
+ ctx.emit({ kind: "copy", dst: "__rf_has", src: { kind: "const", value: 0 } });
22117
+ ctx.emit({ kind: "copy", dst: "__rf_val", src: { kind: "const", value: 0 } });
22118
+ ctx.terminate({ kind: "return", value: null });
22119
+ } else if (stmt.value?.kind === "struct_lit") {
21771
22120
  for (const field of stmt.value.fields) {
21772
22121
  const val = lowerExpr(field.value, ctx, scope);
21773
22122
  ctx.emit({ kind: "copy", dst: `__rf_${field.name}`, src: val });
@@ -21779,6 +22128,18 @@ var require_lower2 = __commonJS({
21779
22128
  ctx.emit({ kind: "copy", dst: `__rf_${i}`, src: val });
21780
22129
  }
21781
22130
  ctx.terminate({ kind: "return", value: null });
22131
+ } else if (stmt.value?.kind === "ident") {
22132
+ const sv = ctx.structVars.get(stmt.value.name);
22133
+ if (sv && sv.typeName === "__option") {
22134
+ const hasT = sv.fields.get("has");
22135
+ const valT = sv.fields.get("val");
22136
+ ctx.emit({ kind: "copy", dst: "__rf_has", src: { kind: "temp", name: hasT } });
22137
+ ctx.emit({ kind: "copy", dst: "__rf_val", src: { kind: "temp", name: valT } });
22138
+ ctx.terminate({ kind: "return", value: null });
22139
+ } else {
22140
+ const val = lowerExpr(stmt.value, ctx, scope);
22141
+ ctx.terminate({ kind: "return", value: val });
22142
+ }
21782
22143
  } else {
21783
22144
  const val = stmt.value ? lowerExpr(stmt.value, ctx, scope) : null;
21784
22145
  ctx.terminate({ kind: "return", value: val });
@@ -21916,6 +22277,34 @@ var require_lower2 = __commonJS({
21916
22277
  if (isPlaceholderTerm(ctx.current().term)) {
21917
22278
  ctx.terminate({ kind: "jump", target: mergeBlock.id });
21918
22279
  }
22280
+ } else if (arm.pattern.kind === "range_lit") {
22281
+ const range = arm.pattern.range;
22282
+ const armBody = ctx.newBlock("match_arm");
22283
+ const nextArm = ctx.newBlock("match_next");
22284
+ const checks = [];
22285
+ if (range.min !== void 0)
22286
+ checks.push({ op: "ge", bound: range.min });
22287
+ if (range.max !== void 0)
22288
+ checks.push({ op: "le", bound: range.max });
22289
+ if (checks.length === 0) {
22290
+ ctx.terminate({ kind: "jump", target: armBody.id });
22291
+ } else {
22292
+ for (let ci = 0; ci < checks.length; ci++) {
22293
+ const { op, bound } = checks[ci];
22294
+ const cmpTemp = ctx.freshTemp();
22295
+ ctx.emit({ kind: "cmp", dst: cmpTemp, op, a: matchVal, b: { kind: "const", value: bound } });
22296
+ const passBlock = ci === checks.length - 1 ? armBody : ctx.newBlock("match_range_check");
22297
+ ctx.terminate({ kind: "branch", cond: { kind: "temp", name: cmpTemp }, then: passBlock.id, else: nextArm.id });
22298
+ if (ci < checks.length - 1)
22299
+ ctx.switchTo(passBlock);
22300
+ }
22301
+ }
22302
+ ctx.switchTo(armBody);
22303
+ lowerBlock(arm.body, ctx, new Map(scope));
22304
+ if (isPlaceholderTerm(ctx.current().term)) {
22305
+ ctx.terminate({ kind: "jump", target: mergeBlock.id });
22306
+ }
22307
+ ctx.switchTo(nextArm);
21919
22308
  } else {
21920
22309
  const patOp = lowerExpr(arm.pattern, ctx, scope);
21921
22310
  const cmpTemp = ctx.freshTemp();
@@ -21938,7 +22327,53 @@ var require_lower2 = __commonJS({
21938
22327
  break;
21939
22328
  }
21940
22329
  case "raw": {
21941
- ctx.emit({ kind: "call", dst: null, fn: `__raw:${stmt.cmd}`, args: [] });
22330
+ const ns = ctx.getNamespace();
22331
+ const rawCmd = stmt.cmd.replace(/__NS__/g, ns).replace(/__OBJ__/g, `__${ns}`);
22332
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:${rawCmd}`, args: [] });
22333
+ break;
22334
+ }
22335
+ case "if_let_some": {
22336
+ const sv = (() => {
22337
+ if (stmt.init.kind === "ident")
22338
+ return ctx.structVars.get(stmt.init.name);
22339
+ return void 0;
22340
+ })();
22341
+ let hasOp;
22342
+ let valTemp;
22343
+ if (sv && sv.typeName === "__option") {
22344
+ const hasT = sv.fields.get("has");
22345
+ const valT = sv.fields.get("val");
22346
+ hasOp = { kind: "temp", name: hasT };
22347
+ valTemp = valT;
22348
+ } else {
22349
+ lowerExpr(stmt.init, ctx, scope);
22350
+ const hasT = ctx.freshTemp();
22351
+ const valT = ctx.freshTemp();
22352
+ ctx.emit({ kind: "copy", dst: hasT, src: { kind: "temp", name: "__rf_has" } });
22353
+ ctx.emit({ kind: "copy", dst: valT, src: { kind: "temp", name: "__rf_val" } });
22354
+ hasOp = { kind: "temp", name: hasT };
22355
+ valTemp = valT;
22356
+ }
22357
+ const thenBlock = ctx.newBlock("ifl_then");
22358
+ const mergeBlock = ctx.newBlock("ifl_merge");
22359
+ const elseBlock = stmt.else_ ? ctx.newBlock("ifl_else") : mergeBlock;
22360
+ ctx.terminate({ kind: "branch", cond: hasOp, then: thenBlock.id, else: elseBlock.id });
22361
+ ctx.switchTo(thenBlock);
22362
+ const thenScope = new Map(scope);
22363
+ if (valTemp)
22364
+ thenScope.set(stmt.binding, valTemp);
22365
+ lowerBlock(stmt.then, ctx, thenScope);
22366
+ if (isPlaceholderTerm(ctx.current().term)) {
22367
+ ctx.terminate({ kind: "jump", target: mergeBlock.id });
22368
+ }
22369
+ if (stmt.else_) {
22370
+ ctx.switchTo(elseBlock);
22371
+ lowerBlock(stmt.else_, ctx, new Map(scope));
22372
+ if (isPlaceholderTerm(ctx.current().term)) {
22373
+ ctx.terminate({ kind: "jump", target: mergeBlock.id });
22374
+ }
22375
+ }
22376
+ ctx.switchTo(mergeBlock);
21942
22377
  break;
21943
22378
  }
21944
22379
  default: {
@@ -21952,12 +22387,19 @@ var require_lower2 = __commonJS({
21952
22387
  case "int_lit":
21953
22388
  return { kind: "const", value: expr.value };
21954
22389
  case "float_lit":
21955
- return { kind: "const", value: expr.value };
22390
+ return { kind: "const", value: Math.round(expr.value * 1e4) };
21956
22391
  case "byte_lit":
21957
22392
  case "short_lit":
21958
22393
  case "long_lit":
21959
- case "double_lit":
21960
22394
  return { kind: "const", value: expr.value };
22395
+ case "double_lit": {
22396
+ const path3 = ctx.freshDoubleVar(`dlit`);
22397
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:data modify storage rs:d ${path3} set value ${expr.value}d`, args: [] });
22398
+ const t = ctx.freshTemp();
22399
+ ctx.emit({ kind: "nbt_read", dst: t, ns: "rs:d", path: path3, scale: 1e4 });
22400
+ ctx.floatTemps.add(t);
22401
+ return { kind: "temp", name: t };
22402
+ }
21961
22403
  case "bool_lit": {
21962
22404
  return { kind: "const", value: expr.value ? 1 : 0 };
21963
22405
  }
@@ -21986,6 +22428,13 @@ var require_lower2 = __commonJS({
21986
22428
  return { kind: "temp", name: t };
21987
22429
  }
21988
22430
  case "ident": {
22431
+ if (ctx.doubleVars.has(expr.name)) {
22432
+ const path3 = ctx.doubleVars.get(expr.name);
22433
+ const t2 = ctx.freshTemp();
22434
+ ctx.emit({ kind: "nbt_read", dst: t2, ns: "rs:d", path: path3, scale: 1e4 });
22435
+ ctx.floatTemps.add(t2);
22436
+ return { kind: "temp", name: t2 };
22437
+ }
21989
22438
  const temp = scope.get(expr.name);
21990
22439
  if (temp)
21991
22440
  return { kind: "temp", name: temp };
@@ -22001,6 +22450,26 @@ var require_lower2 = __commonJS({
22001
22450
  if (expr.op === "||") {
22002
22451
  return lowerShortCircuitOr(expr, ctx, scope);
22003
22452
  }
22453
+ const doubleArithOps = {
22454
+ "+": "math_hp:double_add",
22455
+ "-": "math_hp:double_sub",
22456
+ "*": "math_hp:double_mul",
22457
+ "/": "math_hp:double_div"
22458
+ };
22459
+ if (expr.op in doubleArithOps && isDoubleExpr(expr.left, ctx) && isDoubleExpr(expr.right, ctx)) {
22460
+ const ns = ctx.getNamespace();
22461
+ const leftPath = lowerDoubleExprToPath(expr.left, ctx, scope);
22462
+ const rightPath = lowerDoubleExprToPath(expr.right, ctx, scope);
22463
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:data modify storage rs:d __dp0 set from storage rs:d ${leftPath}`, args: [] });
22464
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:data modify storage rs:d __dp1 set from storage rs:d ${rightPath}`, args: [] });
22465
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:function ${doubleArithOps[expr.op]}`, args: [] });
22466
+ const resultPath = ctx.freshDoubleVar("dres");
22467
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:data modify storage rs:d ${resultPath} set from storage rs:d __dp0`, args: [] });
22468
+ const t2 = ctx.freshTemp();
22469
+ ctx.emit({ kind: "nbt_read", dst: t2, ns: "rs:d", path: resultPath, scale: 1e4 });
22470
+ ctx.floatTemps.add(t2);
22471
+ return { kind: "temp", name: t2 };
22472
+ }
22004
22473
  const left = lowerExpr(expr.left, ctx, scope);
22005
22474
  const right = lowerExpr(expr.right, ctx, scope);
22006
22475
  const t = ctx.freshTemp();
@@ -22020,7 +22489,29 @@ var require_lower2 = __commonJS({
22020
22489
  ">=": "ge"
22021
22490
  };
22022
22491
  if (expr.op in arithmeticOps) {
22023
- ctx.emit({ kind: arithmeticOps[expr.op], dst: t, a: left, b: right });
22492
+ const isFloatLeft = left.kind === "temp" && ctx.floatTemps.has(left.name);
22493
+ const isFloatRight = right.kind === "temp" && ctx.floatTemps.has(right.name);
22494
+ if (expr.op === "*" && isFloatLeft && isFloatRight) {
22495
+ ctx.emit({ kind: "mul", dst: t, a: left, b: right });
22496
+ const scaleTemp = ctx.freshTemp();
22497
+ ctx.emit({ kind: "const", dst: scaleTemp, value: 1e4 });
22498
+ const corrected = ctx.freshTemp();
22499
+ ctx.emit({ kind: "div", dst: corrected, a: { kind: "temp", name: t }, b: { kind: "temp", name: scaleTemp } });
22500
+ ctx.floatTemps.add(corrected);
22501
+ return { kind: "temp", name: corrected };
22502
+ } else if (expr.op === "/" && isFloatLeft && isFloatRight) {
22503
+ const scaleTemp = ctx.freshTemp();
22504
+ ctx.emit({ kind: "const", dst: scaleTemp, value: 1e4 });
22505
+ const scaled = ctx.freshTemp();
22506
+ ctx.emit({ kind: "mul", dst: scaled, a: left, b: { kind: "temp", name: scaleTemp } });
22507
+ ctx.emit({ kind: "div", dst: t, a: { kind: "temp", name: scaled }, b: right });
22508
+ ctx.floatTemps.add(t);
22509
+ } else {
22510
+ ctx.emit({ kind: arithmeticOps[expr.op], dst: t, a: left, b: right });
22511
+ if (isFloatLeft || isFloatRight) {
22512
+ ctx.floatTemps.add(t);
22513
+ }
22514
+ }
22024
22515
  } else if (expr.op in cmpOps) {
22025
22516
  ctx.emit({ kind: "cmp", dst: t, op: cmpOps[expr.op], a: left, b: right });
22026
22517
  } else {
@@ -22086,13 +22577,140 @@ var require_lower2 = __commonJS({
22086
22577
  return { kind: "temp", name: t };
22087
22578
  }
22088
22579
  case "index": {
22580
+ if (expr.obj.kind === "ident") {
22581
+ const arrInfo = ctx.arrayVars.get(expr.obj.name);
22582
+ if (arrInfo) {
22583
+ const t2 = ctx.freshTemp();
22584
+ if (expr.index.kind === "int_lit") {
22585
+ ctx.emit({ kind: "nbt_read", dst: t2, ns: arrInfo.ns, path: `${arrInfo.pathPrefix}[${expr.index.value}]`, scale: 1 });
22586
+ } else {
22587
+ const idxOp = lowerExpr(expr.index, ctx, scope);
22588
+ ctx.emit({ kind: "nbt_read_dynamic", dst: t2, ns: arrInfo.ns, pathPrefix: arrInfo.pathPrefix, indexSrc: idxOp });
22589
+ }
22590
+ return { kind: "temp", name: t2 };
22591
+ }
22592
+ }
22089
22593
  const obj = lowerExpr(expr.obj, ctx, scope);
22090
- const idx = lowerExpr(expr.index, ctx, scope);
22594
+ lowerExpr(expr.index, ctx, scope);
22091
22595
  const t = ctx.freshTemp();
22092
22596
  ctx.emit({ kind: "copy", dst: t, src: obj });
22093
22597
  return { kind: "temp", name: t };
22094
22598
  }
22599
+ case "index_assign": {
22600
+ const valOp = lowerExpr(expr.value, ctx, scope);
22601
+ if (expr.obj.kind === "ident") {
22602
+ const arrInfo = ctx.arrayVars.get(expr.obj.name);
22603
+ if (arrInfo) {
22604
+ if (expr.index.kind === "int_lit") {
22605
+ ctx.emit({ kind: "nbt_write", ns: arrInfo.ns, path: `${arrInfo.pathPrefix}[${expr.index.value}]`, type: "int", scale: 1, src: valOp });
22606
+ } else {
22607
+ const idxOp = lowerExpr(expr.index, ctx, scope);
22608
+ ctx.emit({ kind: "nbt_write_dynamic", ns: arrInfo.ns, pathPrefix: arrInfo.pathPrefix, indexSrc: idxOp, valueSrc: valOp });
22609
+ }
22610
+ return valOp;
22611
+ }
22612
+ }
22613
+ return valOp;
22614
+ }
22095
22615
  case "call": {
22616
+ if (expr.fn === "scoreboard_get" || expr.fn === "score") {
22617
+ const player = hirExprToStringLiteral(expr.args[0]);
22618
+ const obj = hirExprToStringLiteral(expr.args[1]);
22619
+ const t2 = ctx.freshTemp();
22620
+ ctx.emit({ kind: "score_read", dst: t2, player, obj });
22621
+ return { kind: "temp", name: t2 };
22622
+ }
22623
+ if (expr.fn === "scoreboard_set") {
22624
+ const player = hirExprToStringLiteral(expr.args[0]);
22625
+ const obj = hirExprToStringLiteral(expr.args[1]);
22626
+ const src = lowerExpr(expr.args[2], ctx, scope);
22627
+ ctx.emit({ kind: "score_write", player, obj, src });
22628
+ const t2 = ctx.freshTemp();
22629
+ ctx.emit({ kind: "const", dst: t2, value: 0 });
22630
+ return { kind: "temp", name: t2 };
22631
+ }
22632
+ if (expr.fn === "list_push") {
22633
+ if (expr.args[0].kind === "ident") {
22634
+ const arrInfo = ctx.arrayVars.get(expr.args[0].name);
22635
+ if (arrInfo) {
22636
+ const valOp = lowerExpr(expr.args[1], ctx, scope);
22637
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:data modify storage ${arrInfo.ns} ${arrInfo.pathPrefix} append value 0`, args: [] });
22638
+ ctx.emit({ kind: "nbt_write", ns: arrInfo.ns, path: `${arrInfo.pathPrefix}[-1]`, type: "int", scale: 1, src: valOp });
22639
+ const t2 = ctx.freshTemp();
22640
+ ctx.emit({ kind: "const", dst: t2, value: 0 });
22641
+ return { kind: "temp", name: t2 };
22642
+ }
22643
+ }
22644
+ }
22645
+ if (expr.fn === "list_pop") {
22646
+ if (expr.args[0].kind === "ident") {
22647
+ const arrInfo = ctx.arrayVars.get(expr.args[0].name);
22648
+ if (arrInfo) {
22649
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:data remove storage ${arrInfo.ns} ${arrInfo.pathPrefix}[-1]`, args: [] });
22650
+ const t2 = ctx.freshTemp();
22651
+ ctx.emit({ kind: "const", dst: t2, value: 0 });
22652
+ return { kind: "temp", name: t2 };
22653
+ }
22654
+ }
22655
+ }
22656
+ if (expr.fn === "list_len") {
22657
+ if (expr.args[0].kind === "ident") {
22658
+ const arrInfo = ctx.arrayVars.get(expr.args[0].name);
22659
+ if (arrInfo) {
22660
+ const t2 = ctx.freshTemp();
22661
+ ctx.emit({ kind: "nbt_read", dst: t2, ns: arrInfo.ns, path: `${arrInfo.pathPrefix}`, scale: 1 });
22662
+ return { kind: "temp", name: t2 };
22663
+ }
22664
+ }
22665
+ }
22666
+ if ((expr.fn === "setTimeout" || expr.fn === "setInterval") && expr.args.length === 2) {
22667
+ const ticksArg = expr.args[0];
22668
+ const callbackArg = expr.args[1];
22669
+ const ns = ctx.getNamespace();
22670
+ const id = ctx.timerCounter.count++;
22671
+ const callbackName = `__timeout_callback_${id}`;
22672
+ let ticksLiteral = null;
22673
+ if (ticksArg.kind === "int_lit") {
22674
+ ticksLiteral = ticksArg.value;
22675
+ }
22676
+ if (callbackArg.kind === "lambda") {
22677
+ const cbCtx = new FnContext(ns, callbackName, ctx.structDefs, ctx.implMethods, ctx.macroInfo, ctx.fnParamInfo, ctx.enumDefs, ctx.timerCounter);
22678
+ cbCtx.sourceFile = ctx.sourceFile;
22679
+ const cbBody = Array.isArray(callbackArg.body) ? callbackArg.body : [{ kind: "expr", expr: callbackArg.body }];
22680
+ const bodyStmts = [...cbBody];
22681
+ if (expr.fn === "setInterval" && ticksLiteral !== null) {
22682
+ bodyStmts.push({
22683
+ kind: "raw",
22684
+ cmd: `schedule function ${ns}:${callbackName} ${ticksLiteral}t`
22685
+ });
22686
+ }
22687
+ lowerBlock(bodyStmts, cbCtx, /* @__PURE__ */ new Map());
22688
+ const cbCur = cbCtx.current();
22689
+ if (isPlaceholderTerm(cbCur.term)) {
22690
+ cbCtx.terminate({ kind: "return", value: null });
22691
+ }
22692
+ const cbReachable = computeReachable(cbCtx.blocks, "entry");
22693
+ const cbLiveBlocks = cbCtx.blocks.filter((b) => cbReachable.has(b.id));
22694
+ computePreds(cbLiveBlocks);
22695
+ const cbFn = {
22696
+ name: callbackName,
22697
+ params: [],
22698
+ blocks: cbLiveBlocks,
22699
+ entry: "entry",
22700
+ isMacro: false
22701
+ };
22702
+ ctx.helperFunctions.push(cbFn, ...cbCtx.helperFunctions);
22703
+ }
22704
+ if (ticksLiteral !== null) {
22705
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:schedule function ${ns}:${callbackName} ${ticksLiteral}t`, args: [] });
22706
+ } else {
22707
+ const ticksOp = lowerExpr(ticksArg, ctx, scope);
22708
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:schedule function ${ns}:${callbackName} 1t`, args: [ticksOp] });
22709
+ }
22710
+ const t2 = ctx.freshTemp();
22711
+ ctx.emit({ kind: "const", dst: t2, value: 0 });
22712
+ return { kind: "temp", name: t2 };
22713
+ }
22096
22714
  if (macro_1.BUILTIN_SET.has(expr.fn)) {
22097
22715
  const cmd = formatBuiltinCall(expr.fn, expr.args, ctx.currentMacroParams);
22098
22716
  ctx.emit({ kind: "call", dst: null, fn: `__raw:${cmd}`, args: [] });
@@ -22103,6 +22721,13 @@ var require_lower2 = __commonJS({
22103
22721
  if (expr.args.length > 0 && expr.args[0].kind === "ident") {
22104
22722
  const sv = ctx.structVars.get(expr.args[0].name);
22105
22723
  if (sv) {
22724
+ if (sv.typeName === "Timer") {
22725
+ const idTemp = sv.fields.get("_id");
22726
+ const timerId = idTemp !== void 0 ? ctx.constTemps.get(idTemp) : void 0;
22727
+ if (timerId !== void 0) {
22728
+ return lowerTimerMethod(expr.fn, timerId, sv, ctx, scope, expr.args.slice(1));
22729
+ }
22730
+ }
22106
22731
  const methodInfo = ctx.implMethods.get(sv.typeName)?.get(expr.fn);
22107
22732
  if (methodInfo?.hasSelf) {
22108
22733
  const fields = ctx.structDefs.get(sv.typeName) ?? [];
@@ -22128,11 +22753,12 @@ var require_lower2 = __commonJS({
22128
22753
  if (targetMacro.macroParams.has(paramName)) {
22129
22754
  const paramTypeName = targetMacro.paramTypes.get(paramName) ?? "int";
22130
22755
  const isFloat = paramTypeName === "float";
22756
+ const isFixed = paramTypeName === "fixed";
22131
22757
  macroArgs.push({
22132
22758
  name: paramName,
22133
22759
  value: args2[i],
22134
- type: isFloat ? "double" : "int",
22135
- scale: isFloat ? 0.01 : 1
22760
+ type: isFloat || isFixed ? "double" : "int",
22761
+ scale: isFloat ? 0.01 : isFixed ? 1e-4 : 1
22136
22762
  });
22137
22763
  }
22138
22764
  }
@@ -22140,21 +22766,97 @@ var require_lower2 = __commonJS({
22140
22766
  ctx.emit({ kind: "call_macro", dst: t2, fn: expr.fn, args: macroArgs });
22141
22767
  return { kind: "temp", name: t2 };
22142
22768
  }
22143
- const args = expr.args.map((a) => lowerExpr(a, ctx, scope));
22144
- const t = ctx.freshTemp();
22145
- ctx.emit({ kind: "call", dst: t, fn: expr.fn, args });
22146
- return { kind: "temp", name: t };
22147
- }
22148
- case "invoke": {
22149
- if (expr.callee.kind === "member" && expr.callee.obj.kind === "ident") {
22150
- const sv = ctx.structVars.get(expr.callee.obj.name);
22151
- if (sv) {
22152
- const methodInfo = ctx.implMethods.get(sv.typeName)?.get(expr.callee.field);
22153
- if (methodInfo?.hasSelf) {
22154
- const fields = ctx.structDefs.get(sv.typeName) ?? [];
22155
- const selfArgs = fields.map((f) => {
22156
- const temp = sv.fields.get(f);
22157
- return temp ? { kind: "temp", name: temp } : { kind: "const", value: 0 };
22769
+ {
22770
+ const targetHirFn = ctx.hirFunctions.get(expr.fn);
22771
+ if (targetHirFn && ctx.specializedFnsRegistry) {
22772
+ const arrayArgBindings = /* @__PURE__ */ new Map();
22773
+ for (let i = 0; i < expr.args.length; i++) {
22774
+ const arg = expr.args[i];
22775
+ if (arg.kind === "ident" && ctx.arrayVars.has(arg.name)) {
22776
+ const paramName = targetHirFn.params[i]?.name;
22777
+ if (paramName) {
22778
+ arrayArgBindings.set(paramName, ctx.arrayVars.get(arg.name));
22779
+ }
22780
+ }
22781
+ }
22782
+ if (arrayArgBindings.size > 0) {
22783
+ const bindingKey = [...arrayArgBindings.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([p, { ns, pathPrefix }]) => `${p}__${ns.replace(/[^a-zA-Z0-9]/g, "_")}__${pathPrefix.replace(/[^a-zA-Z0-9]/g, "_")}`).join("__");
22784
+ const specializedName = `${expr.fn}__arr_${bindingKey}`;
22785
+ if (!ctx.specializedFnsRegistry.has(specializedName)) {
22786
+ ctx.specializedFnsRegistry.set(specializedName, []);
22787
+ const { fn: specFn, helpers: specHelpers } = lowerFunction(targetHirFn, ctx.getNamespace(), ctx.structDefs, ctx.implMethods, ctx.macroInfo, ctx.fnParamInfo, ctx.enumDefs, ctx.sourceFile, ctx.timerCounter, arrayArgBindings, ctx.hirFunctions, ctx.specializedFnsRegistry, specializedName);
22788
+ ctx.specializedFnsRegistry.set(specializedName, [specFn, ...specHelpers]);
22789
+ }
22790
+ const nonArrayArgs = [];
22791
+ for (let i = 0; i < expr.args.length; i++) {
22792
+ const param = targetHirFn.params[i];
22793
+ if (!param || param.type.kind !== "array" || !arrayArgBindings.has(param.name)) {
22794
+ nonArrayArgs.push(lowerExpr(expr.args[i], ctx, scope));
22795
+ }
22796
+ }
22797
+ const t2 = ctx.freshTemp();
22798
+ ctx.emit({ kind: "call", dst: t2, fn: specializedName, args: nonArrayArgs });
22799
+ return { kind: "temp", name: t2 };
22800
+ }
22801
+ }
22802
+ }
22803
+ {
22804
+ const targetParams = ctx.fnParamInfo.get(expr.fn);
22805
+ if (targetParams) {
22806
+ const hasDoubleParam = targetParams.some((p) => p.type.kind === "named" && p.type.name === "double");
22807
+ if (hasDoubleParam) {
22808
+ const ns = ctx.getNamespace();
22809
+ const nonDoubleArgs = [];
22810
+ let doubleSlot = 0;
22811
+ for (let i = 0; i < targetParams.length && i < expr.args.length; i++) {
22812
+ const p = targetParams[i];
22813
+ if (p.type.kind === "named" && p.type.name === "double") {
22814
+ const arg = expr.args[i];
22815
+ if (arg.kind === "ident" && ctx.doubleVars.has(arg.name)) {
22816
+ const srcPath = ctx.doubleVars.get(arg.name);
22817
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:data modify storage rs:d __dp${doubleSlot} set from storage rs:d ${srcPath}`, args: [] });
22818
+ } else {
22819
+ const argOp = lowerExpr(arg, ctx, scope);
22820
+ const tmp = ctx.freshTemp();
22821
+ ctx.emit({ kind: "copy", dst: tmp, src: argOp });
22822
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:execute store result storage rs:d __dp${doubleSlot} double 0.0001 run scoreboard players get $${tmp} __${ns}`, args: [] });
22823
+ }
22824
+ doubleSlot++;
22825
+ } else {
22826
+ nonDoubleArgs.push(lowerExpr(expr.args[i], ctx, scope));
22827
+ }
22828
+ }
22829
+ for (let i = targetParams.length; i < expr.args.length; i++) {
22830
+ nonDoubleArgs.push(lowerExpr(expr.args[i], ctx, scope));
22831
+ }
22832
+ const t2 = ctx.freshTemp();
22833
+ ctx.emit({ kind: "call", dst: t2, fn: expr.fn, args: nonDoubleArgs });
22834
+ return { kind: "temp", name: t2 };
22835
+ }
22836
+ }
22837
+ }
22838
+ const args = expr.args.map((a) => lowerExpr(a, ctx, scope));
22839
+ const t = ctx.freshTemp();
22840
+ ctx.emit({ kind: "call", dst: t, fn: expr.fn, args });
22841
+ return { kind: "temp", name: t };
22842
+ }
22843
+ case "invoke": {
22844
+ if (expr.callee.kind === "member" && expr.callee.obj.kind === "ident") {
22845
+ const sv = ctx.structVars.get(expr.callee.obj.name);
22846
+ if (sv) {
22847
+ if (sv.typeName === "Timer") {
22848
+ const idTemp = sv.fields.get("_id");
22849
+ const timerId = idTemp !== void 0 ? ctx.constTemps.get(idTemp) : void 0;
22850
+ if (timerId !== void 0) {
22851
+ return lowerTimerMethod(expr.callee.field, timerId, sv, ctx, scope, expr.args);
22852
+ }
22853
+ }
22854
+ const methodInfo = ctx.implMethods.get(sv.typeName)?.get(expr.callee.field);
22855
+ if (methodInfo?.hasSelf) {
22856
+ const fields = ctx.structDefs.get(sv.typeName) ?? [];
22857
+ const selfArgs = fields.map((f) => {
22858
+ const temp = sv.fields.get(f);
22859
+ return temp ? { kind: "temp", name: temp } : { kind: "const", value: 0 };
22158
22860
  });
22159
22861
  const explicitArgs = expr.args.map((a) => lowerExpr(a, ctx, scope));
22160
22862
  const allArgs = [...selfArgs, ...explicitArgs];
@@ -22171,6 +22873,20 @@ var require_lower2 = __commonJS({
22171
22873
  return { kind: "temp", name: t };
22172
22874
  }
22173
22875
  case "static_call": {
22876
+ if (expr.type === "Timer" && expr.method === "new" && expr.args.length === 1) {
22877
+ const id = ctx.timerCounter.timerId++;
22878
+ const ns = ctx.getNamespace();
22879
+ const playerName = `__timer_${id}`;
22880
+ ctx.emit({ kind: "score_write", player: `${playerName}_ticks`, obj: ns, src: { kind: "const", value: 0 } });
22881
+ ctx.emit({ kind: "score_write", player: `${playerName}_active`, obj: ns, src: { kind: "const", value: 0 } });
22882
+ const durationOp = lowerExpr(expr.args[0], ctx, scope);
22883
+ ctx.emit({ kind: "const", dst: "__rf__id", value: id });
22884
+ ctx.constTemps.set("__rf__id", id);
22885
+ ctx.emit({ kind: "copy", dst: "__rf__duration", src: durationOp });
22886
+ const t2 = ctx.freshTemp();
22887
+ ctx.emit({ kind: "const", dst: t2, value: 0 });
22888
+ return { kind: "temp", name: t2 };
22889
+ }
22174
22890
  const args = expr.args.map((a) => lowerExpr(a, ctx, scope));
22175
22891
  const t = ctx.freshTemp();
22176
22892
  ctx.emit({ kind: "call", dst: t, fn: `${expr.type}::${expr.method}`, args });
@@ -22185,12 +22901,88 @@ var require_lower2 = __commonJS({
22185
22901
  ctx.emit({ kind: "const", dst: t, value: 0 });
22186
22902
  return { kind: "temp", name: t };
22187
22903
  }
22904
+ case "some_lit": {
22905
+ const valOp = lowerExpr(expr.value, ctx, scope);
22906
+ ctx.emit({ kind: "copy", dst: "__rf_has", src: { kind: "const", value: 1 } });
22907
+ ctx.emit({ kind: "copy", dst: "__rf_val", src: valOp });
22908
+ const t = ctx.freshTemp();
22909
+ ctx.emit({ kind: "const", dst: t, value: 1 });
22910
+ return { kind: "temp", name: t };
22911
+ }
22912
+ case "none_lit": {
22913
+ ctx.emit({ kind: "copy", dst: "__rf_has", src: { kind: "const", value: 0 } });
22914
+ ctx.emit({ kind: "copy", dst: "__rf_val", src: { kind: "const", value: 0 } });
22915
+ const t = ctx.freshTemp();
22916
+ ctx.emit({ kind: "const", dst: t, value: 0 });
22917
+ return { kind: "temp", name: t };
22918
+ }
22919
+ case "type_cast": {
22920
+ const ns = ctx.getNamespace();
22921
+ const targetName = expr.targetType.kind === "named" ? expr.targetType.name : null;
22922
+ if (targetName === "double") {
22923
+ const innerOp2 = lowerExpr(expr.expr, ctx, scope);
22924
+ const innerTemp = ctx.freshTemp();
22925
+ ctx.emit({ kind: "copy", dst: innerTemp, src: innerOp2 });
22926
+ const path3 = ctx.freshDoubleVar(`cast`);
22927
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:execute store result storage rs:d ${path3} double 0.0001 run scoreboard players get $${innerTemp} __${ns}`, args: [] });
22928
+ const t2 = ctx.freshTemp();
22929
+ ctx.emit({ kind: "nbt_read", dst: t2, ns: "rs:d", path: path3, scale: 1e4 });
22930
+ ctx.floatTemps.add(t2);
22931
+ return { kind: "temp", name: t2 };
22932
+ }
22933
+ if (targetName === "fixed" || targetName === "float" || targetName === "int") {
22934
+ if (expr.expr.kind === "ident" && ctx.doubleVars.has(expr.expr.name)) {
22935
+ const path3 = ctx.doubleVars.get(expr.expr.name);
22936
+ const t3 = ctx.freshTemp();
22937
+ ctx.emit({ kind: "nbt_read", dst: t3, ns: "rs:d", path: path3, scale: 1e4 });
22938
+ if (targetName === "fixed" || targetName === "float") {
22939
+ ctx.floatTemps.add(t3);
22940
+ }
22941
+ return { kind: "temp", name: t3 };
22942
+ }
22943
+ const innerOp2 = lowerExpr(expr.expr, ctx, scope);
22944
+ const t2 = ctx.freshTemp();
22945
+ ctx.emit({ kind: "copy", dst: t2, src: innerOp2 });
22946
+ if (targetName === "fixed" || targetName === "float") {
22947
+ ctx.floatTemps.add(t2);
22948
+ }
22949
+ return { kind: "temp", name: t2 };
22950
+ }
22951
+ const innerOp = lowerExpr(expr.expr, ctx, scope);
22952
+ const t = ctx.freshTemp();
22953
+ ctx.emit({ kind: "copy", dst: t, src: innerOp });
22954
+ return { kind: "temp", name: t };
22955
+ }
22188
22956
  default: {
22189
22957
  const _exhaustive = expr;
22190
22958
  throw new Error(`Unknown HIR expression kind: ${_exhaustive.kind}`);
22191
22959
  }
22192
22960
  }
22193
22961
  }
22962
+ function isDoubleExpr(expr, ctx) {
22963
+ if (expr.kind === "ident" && ctx.doubleVars.has(expr.name))
22964
+ return true;
22965
+ if (expr.kind === "double_lit")
22966
+ return true;
22967
+ return false;
22968
+ }
22969
+ function lowerDoubleExprToPath(expr, ctx, scope) {
22970
+ if (expr.kind === "ident" && ctx.doubleVars.has(expr.name)) {
22971
+ return ctx.doubleVars.get(expr.name);
22972
+ }
22973
+ if (expr.kind === "double_lit") {
22974
+ const path4 = ctx.freshDoubleVar("dlit");
22975
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:data modify storage rs:d ${path4} set value ${expr.value}d`, args: [] });
22976
+ return path4;
22977
+ }
22978
+ const op = lowerExpr(expr, ctx, scope);
22979
+ const tmp = ctx.freshTemp();
22980
+ ctx.emit({ kind: "copy", dst: tmp, src: op });
22981
+ const ns = ctx.getNamespace();
22982
+ const path3 = ctx.freshDoubleVar("dtmp");
22983
+ ctx.emit({ kind: "call", dst: null, fn: `__raw:execute store result storage rs:d ${path3} double 0.0001 run scoreboard players get $${tmp} __${ns}`, args: [] });
22984
+ return path3;
22985
+ }
22194
22986
  function lowerShortCircuitAnd(expr, ctx, scope) {
22195
22987
  const left = lowerExpr(expr.left, ctx, scope);
22196
22988
  const result = ctx.freshTemp();
@@ -22225,6 +23017,80 @@ var require_lower2 = __commonJS({
22225
23017
  ctx.switchTo(merge);
22226
23018
  return { kind: "temp", name: result };
22227
23019
  }
23020
+ function lowerTimerMethod(method, timerId, sv, ctx, scope, extraArgs) {
23021
+ const ns = ctx.getNamespace();
23022
+ const player = `__timer_${timerId}`;
23023
+ const t = ctx.freshTemp();
23024
+ if (method === "start") {
23025
+ ctx.emit({ kind: "score_write", player: `${player}_active`, obj: ns, src: { kind: "const", value: 1 } });
23026
+ ctx.emit({ kind: "const", dst: t, value: 0 });
23027
+ } else if (method === "pause") {
23028
+ ctx.emit({ kind: "score_write", player: `${player}_active`, obj: ns, src: { kind: "const", value: 0 } });
23029
+ ctx.emit({ kind: "const", dst: t, value: 0 });
23030
+ } else if (method === "reset") {
23031
+ ctx.emit({ kind: "score_write", player: `${player}_ticks`, obj: ns, src: { kind: "const", value: 0 } });
23032
+ ctx.emit({ kind: "const", dst: t, value: 0 });
23033
+ } else if (method === "tick") {
23034
+ const durationTemp = sv.fields.get("_duration");
23035
+ const activeTemp = ctx.freshTemp();
23036
+ const ticksTemp = ctx.freshTemp();
23037
+ ctx.emit({ kind: "score_read", dst: activeTemp, player: `${player}_active`, obj: ns });
23038
+ ctx.emit({ kind: "score_read", dst: ticksTemp, player: `${player}_ticks`, obj: ns });
23039
+ const innerThen = ctx.newBlock("timer_tick_inner");
23040
+ const innerMerge = ctx.newBlock("timer_tick_after_lt");
23041
+ const outerMerge = ctx.newBlock("timer_tick_done");
23042
+ const activeCheck = ctx.freshTemp();
23043
+ ctx.emit({ kind: "cmp", op: "eq", dst: activeCheck, a: { kind: "temp", name: activeTemp }, b: { kind: "const", value: 1 } });
23044
+ ctx.terminate({ kind: "branch", cond: { kind: "temp", name: activeCheck }, then: innerThen.id, else: outerMerge.id });
23045
+ ctx.switchTo(innerThen);
23046
+ const lessCheck = ctx.freshTemp();
23047
+ if (durationTemp) {
23048
+ ctx.emit({ kind: "cmp", op: "lt", dst: lessCheck, a: { kind: "temp", name: ticksTemp }, b: { kind: "temp", name: durationTemp } });
23049
+ } else {
23050
+ ctx.emit({ kind: "const", dst: lessCheck, value: 0 });
23051
+ }
23052
+ const doIncBlock = ctx.newBlock("timer_tick_inc");
23053
+ ctx.terminate({ kind: "branch", cond: { kind: "temp", name: lessCheck }, then: doIncBlock.id, else: innerMerge.id });
23054
+ ctx.switchTo(doIncBlock);
23055
+ const newTicks = ctx.freshTemp();
23056
+ ctx.emit({ kind: "add", dst: newTicks, a: { kind: "temp", name: ticksTemp }, b: { kind: "const", value: 1 } });
23057
+ ctx.emit({ kind: "score_write", player: `${player}_ticks`, obj: ns, src: { kind: "temp", name: newTicks } });
23058
+ ctx.terminate({ kind: "jump", target: innerMerge.id });
23059
+ ctx.switchTo(innerMerge);
23060
+ ctx.terminate({ kind: "jump", target: outerMerge.id });
23061
+ ctx.switchTo(outerMerge);
23062
+ ctx.emit({ kind: "const", dst: t, value: 0 });
23063
+ } else if (method === "done") {
23064
+ const durationTemp = sv.fields.get("_duration");
23065
+ const ticksTemp = ctx.freshTemp();
23066
+ ctx.emit({ kind: "score_read", dst: ticksTemp, player: `${player}_ticks`, obj: ns });
23067
+ if (durationTemp) {
23068
+ ctx.emit({ kind: "cmp", op: "ge", dst: t, a: { kind: "temp", name: ticksTemp }, b: { kind: "temp", name: durationTemp } });
23069
+ } else {
23070
+ ctx.emit({ kind: "const", dst: t, value: 0 });
23071
+ }
23072
+ } else if (method === "elapsed") {
23073
+ ctx.emit({ kind: "score_read", dst: t, player: `${player}_ticks`, obj: ns });
23074
+ } else if (method === "remaining") {
23075
+ const durationTemp = sv.fields.get("_duration");
23076
+ const ticksTemp = ctx.freshTemp();
23077
+ ctx.emit({ kind: "score_read", dst: ticksTemp, player: `${player}_ticks`, obj: ns });
23078
+ if (durationTemp) {
23079
+ ctx.emit({ kind: "sub", dst: t, a: { kind: "temp", name: durationTemp }, b: { kind: "temp", name: ticksTemp } });
23080
+ } else {
23081
+ ctx.emit({ kind: "const", dst: t, value: 0 });
23082
+ }
23083
+ } else {
23084
+ const fields = ["_id", "_duration"];
23085
+ const selfArgs = fields.map((f) => {
23086
+ const temp = sv.fields.get(f);
23087
+ return temp ? { kind: "temp", name: temp } : { kind: "const", value: 0 };
23088
+ });
23089
+ const explicitArgs = extraArgs.map((a) => lowerExpr(a, ctx, scope));
23090
+ ctx.emit({ kind: "call", dst: t, fn: `Timer::${method}`, args: [...selfArgs, ...explicitArgs] });
23091
+ }
23092
+ return { kind: "temp", name: t };
23093
+ }
22228
23094
  function lowerExecuteSubcmd(sub) {
22229
23095
  switch (sub.kind) {
22230
23096
  case "as":
@@ -22312,13 +23178,34 @@ var require_lower2 = __commonJS({
22312
23178
  break;
22313
23179
  }
22314
23180
  case "setblock": {
22315
- const [x, y, z, block] = strs;
22316
- cmd = `setblock ${x} ${y} ${z} ${block}`;
23181
+ const [posOrX, blockOrY] = args;
23182
+ if (posOrX?.kind === "blockpos") {
23183
+ const px = coordStr(posOrX.x);
23184
+ const py = coordStr(posOrX.y);
23185
+ const pz = coordStr(posOrX.z);
23186
+ const blk = exprToCommandArg(blockOrY, macroParams).str;
23187
+ cmd = `setblock ${px} ${py} ${pz} ${blk}`;
23188
+ } else {
23189
+ const [x, y, z, block] = strs;
23190
+ cmd = `setblock ${x} ${y} ${z} ${block}`;
23191
+ }
22317
23192
  break;
22318
23193
  }
22319
23194
  case "fill": {
22320
- const [x1, y1, z1, x2, y2, z2, block] = strs;
22321
- cmd = `fill ${x1} ${y1} ${z1} ${x2} ${y2} ${z2} ${block}`;
23195
+ const [p1, p2, blkArg] = args;
23196
+ if (p1?.kind === "blockpos" && p2?.kind === "blockpos") {
23197
+ const x1 = coordStr(p1.x);
23198
+ const y1 = coordStr(p1.y);
23199
+ const z1 = coordStr(p1.z);
23200
+ const x2 = coordStr(p2.x);
23201
+ const y2 = coordStr(p2.y);
23202
+ const z2 = coordStr(p2.z);
23203
+ const blk = exprToCommandArg(blkArg, macroParams).str;
23204
+ cmd = `fill ${x1} ${y1} ${z1} ${x2} ${y2} ${z2} ${blk}`;
23205
+ } else {
23206
+ const [x1, y1, z1, x2, y2, z2, block] = strs;
23207
+ cmd = `fill ${x1} ${y1} ${z1} ${x2} ${y2} ${z2} ${block}`;
23208
+ }
22322
23209
  break;
22323
23210
  }
22324
23211
  case "say":
@@ -22401,6 +23288,16 @@ var require_lower2 = __commonJS({
22401
23288
  }
22402
23289
  return hasMacro ? `${MACRO_SENTINEL}${cmd}` : cmd;
22403
23290
  }
23291
+ function coordStr(c) {
23292
+ switch (c.kind) {
23293
+ case "absolute":
23294
+ return String(c.value);
23295
+ case "relative":
23296
+ return c.offset === 0 ? "~" : `~${c.offset}`;
23297
+ case "local":
23298
+ return c.offset === 0 ? "^" : `^${c.offset}`;
23299
+ }
23300
+ }
22404
23301
  function exprToCommandArg(expr, macroParams) {
22405
23302
  switch (expr.kind) {
22406
23303
  case "int_lit":
@@ -22455,6 +23352,20 @@ var require_lower2 = __commonJS({
22455
23352
  return { str: "~", isMacro: false };
22456
23353
  }
22457
23354
  }
23355
+ function hirExprToStringLiteral(expr) {
23356
+ switch (expr.kind) {
23357
+ case "str_lit":
23358
+ return expr.value;
23359
+ case "mc_name":
23360
+ return expr.value;
23361
+ case "selector":
23362
+ return expr.raw;
23363
+ case "int_lit":
23364
+ return String(expr.value);
23365
+ default:
23366
+ return "";
23367
+ }
23368
+ }
22458
23369
  }
22459
23370
  });
22460
23371
 
@@ -22464,6 +23375,9 @@ var require_constant_fold = __commonJS({
22464
23375
  "use strict";
22465
23376
  Object.defineProperty(exports2, "__esModule", { value: true });
22466
23377
  exports2.constantFold = constantFold;
23378
+ function int32(n) {
23379
+ return n | 0;
23380
+ }
22467
23381
  function constantFold(fn) {
22468
23382
  return {
22469
23383
  ...fn,
@@ -22485,27 +23399,27 @@ var require_constant_fold = __commonJS({
22485
23399
  switch (instr.kind) {
22486
23400
  case "add":
22487
23401
  if (isConst(instr.a) && isConst(instr.b))
22488
- return { kind: "const", dst: instr.dst, value: instr.a.value + instr.b.value };
23402
+ return { kind: "const", dst: instr.dst, value: int32(instr.a.value + instr.b.value) };
22489
23403
  break;
22490
23404
  case "sub":
22491
23405
  if (isConst(instr.a) && isConst(instr.b))
22492
- return { kind: "const", dst: instr.dst, value: instr.a.value - instr.b.value };
23406
+ return { kind: "const", dst: instr.dst, value: int32(instr.a.value - instr.b.value) };
22493
23407
  break;
22494
23408
  case "mul":
22495
23409
  if (isConst(instr.a) && isConst(instr.b))
22496
- return { kind: "const", dst: instr.dst, value: instr.a.value * instr.b.value };
23410
+ return { kind: "const", dst: instr.dst, value: int32(instr.a.value * instr.b.value) };
22497
23411
  break;
22498
23412
  case "div":
22499
23413
  if (isConst(instr.a) && isConst(instr.b) && instr.b.value !== 0)
22500
- return { kind: "const", dst: instr.dst, value: Math.trunc(instr.a.value / instr.b.value) };
23414
+ return { kind: "const", dst: instr.dst, value: int32(Math.trunc(instr.a.value / instr.b.value)) };
22501
23415
  break;
22502
23416
  case "mod":
22503
23417
  if (isConst(instr.a) && isConst(instr.b) && instr.b.value !== 0)
22504
- return { kind: "const", dst: instr.dst, value: instr.a.value % instr.b.value };
23418
+ return { kind: "const", dst: instr.dst, value: int32(instr.a.value % instr.b.value) };
22505
23419
  break;
22506
23420
  case "neg":
22507
23421
  if (isConst(instr.src))
22508
- return { kind: "const", dst: instr.dst, value: -instr.src.value };
23422
+ return { kind: "const", dst: instr.dst, value: int32(-instr.src.value) };
22509
23423
  break;
22510
23424
  case "not":
22511
23425
  if (isConst(instr.src))
@@ -22610,6 +23524,10 @@ var require_copy_prop = __commonJS({
22610
23524
  return { ...instr, a: resolve(instr.a, copies), b: resolve(instr.b, copies) };
22611
23525
  case "nbt_write":
22612
23526
  return { ...instr, src: resolve(instr.src, copies) };
23527
+ case "nbt_write_dynamic":
23528
+ return { ...instr, indexSrc: resolve(instr.indexSrc, copies), valueSrc: resolve(instr.valueSrc, copies) };
23529
+ case "nbt_read_dynamic":
23530
+ return { ...instr, indexSrc: resolve(instr.indexSrc, copies) };
22613
23531
  case "call":
22614
23532
  return { ...instr, args: instr.args.map((a) => resolve(a, copies)) };
22615
23533
  case "call_macro":
@@ -22618,6 +23536,8 @@ var require_copy_prop = __commonJS({
22618
23536
  return { ...instr, cond: resolve(instr.cond, copies) };
22619
23537
  case "return":
22620
23538
  return { ...instr, value: instr.value ? resolve(instr.value, copies) : null };
23539
+ case "score_write":
23540
+ return { ...instr, src: resolve(instr.src, copies) };
22621
23541
  default:
22622
23542
  return instr;
22623
23543
  }
@@ -22637,10 +23557,13 @@ var require_copy_prop = __commonJS({
22637
23557
  case "or":
22638
23558
  case "not":
22639
23559
  case "nbt_read":
23560
+ case "nbt_read_dynamic":
22640
23561
  return instr.dst;
22641
23562
  case "call":
22642
23563
  case "call_macro":
22643
23564
  return instr.dst;
23565
+ case "score_read":
23566
+ return instr.dst;
22644
23567
  default:
22645
23568
  return null;
22646
23569
  }
@@ -22715,10 +23638,10 @@ var require_dce = __commonJS({
22715
23638
  return blocks.map((b) => ({ ...b, preds: predMap.get(b.id) ?? [] }));
22716
23639
  }
22717
23640
  function hasSideEffects(instr) {
22718
- if (instr.kind === "call" || instr.kind === "call_macro" || instr.kind === "call_context" || instr.kind === "nbt_write")
23641
+ if (instr.kind === "call" || instr.kind === "call_macro" || instr.kind === "call_context" || instr.kind === "nbt_write" || instr.kind === "nbt_write_dynamic" || instr.kind === "score_write")
22719
23642
  return true;
22720
23643
  const dst = getDst(instr);
22721
- if (dst && dst.startsWith("__rf_"))
23644
+ if (dst && (dst.startsWith("__rf_") || dst.startsWith("__opt_")))
22722
23645
  return true;
22723
23646
  return false;
22724
23647
  }
@@ -22747,10 +23670,13 @@ var require_dce = __commonJS({
22747
23670
  case "or":
22748
23671
  case "not":
22749
23672
  case "nbt_read":
23673
+ case "nbt_read_dynamic":
22750
23674
  return instr.dst;
22751
23675
  case "call":
22752
23676
  case "call_macro":
22753
23677
  return instr.dst;
23678
+ case "score_read":
23679
+ return instr.dst;
22754
23680
  default:
22755
23681
  return null;
22756
23682
  }
@@ -22781,6 +23707,13 @@ var require_dce = __commonJS({
22781
23707
  case "nbt_write":
22782
23708
  addOp(instr.src);
22783
23709
  break;
23710
+ case "nbt_write_dynamic":
23711
+ addOp(instr.indexSrc);
23712
+ addOp(instr.valueSrc);
23713
+ break;
23714
+ case "nbt_read_dynamic":
23715
+ addOp(instr.indexSrc);
23716
+ break;
22784
23717
  case "call":
22785
23718
  instr.args.forEach(addOp);
22786
23719
  break;
@@ -22794,6 +23727,9 @@ var require_dce = __commonJS({
22794
23727
  if (instr.value)
22795
23728
  addOp(instr.value);
22796
23729
  break;
23730
+ case "score_write":
23731
+ addOp(instr.src);
23732
+ break;
22797
23733
  }
22798
23734
  return temps;
22799
23735
  }
@@ -23103,6 +24039,8 @@ var require_unroll = __commonJS({
23103
24039
  return { ...instr, a: substituteOp(instr.a, sub), b: substituteOp(instr.b, sub) };
23104
24040
  case "nbt_write":
23105
24041
  return { ...instr, src: substituteOp(instr.src, sub) };
24042
+ case "nbt_write_dynamic":
24043
+ return { ...instr, indexSrc: substituteOp(instr.indexSrc, sub), valueSrc: substituteOp(instr.valueSrc, sub) };
23106
24044
  case "call":
23107
24045
  return { ...instr, args: instr.args.map((a) => substituteOp(a, sub)) };
23108
24046
  case "call_macro":
@@ -23130,6 +24068,7 @@ var require_unroll = __commonJS({
23130
24068
  case "or":
23131
24069
  case "not":
23132
24070
  case "nbt_read":
24071
+ case "nbt_read_dynamic":
23133
24072
  return instr.dst;
23134
24073
  case "call":
23135
24074
  case "call_macro":
@@ -23526,6 +24465,8 @@ var require_lower3 = __commonJS({
23526
24465
  this.blockFnNames = /* @__PURE__ */ new Map();
23527
24466
  this.currentMIRFn = null;
23528
24467
  this.blockMap = /* @__PURE__ */ new Map();
24468
+ this.dynIdxHelpers = /* @__PURE__ */ new Map();
24469
+ this.dynWrtHelpers = /* @__PURE__ */ new Map();
23529
24470
  this.namespace = namespace;
23530
24471
  this.objective = objective;
23531
24472
  }
@@ -23544,6 +24485,62 @@ var require_lower3 = __commonJS({
23544
24485
  addFunction(fn) {
23545
24486
  this.functions.push(fn);
23546
24487
  }
24488
+ /**
24489
+ * Get or create a macro helper function for dynamic array index reads.
24490
+ * The helper function is: $return run data get storage <ns> <pathPrefix>[$(arr_idx)] 1
24491
+ * Returns the qualified MC function name (namespace:fnName).
24492
+ */
24493
+ getDynIdxHelper(ns, pathPrefix) {
24494
+ const key = `${ns}\0${pathPrefix}`;
24495
+ const existing = this.dynIdxHelpers.get(key);
24496
+ if (existing)
24497
+ return existing;
24498
+ const sanitize = (s) => s.replace(/[^a-z0-9_]/gi, "_").toLowerCase();
24499
+ const nsStr = sanitize(ns);
24500
+ const prefixStr = sanitize(pathPrefix);
24501
+ const helperName = `__dyn_idx_${nsStr}_${prefixStr}`;
24502
+ const qualifiedName = `${this.namespace}:${helperName}`;
24503
+ const macroLine = {
24504
+ kind: "macro_line",
24505
+ template: `return run data get storage ${ns} ${pathPrefix}[$(arr_idx)] 1`
24506
+ };
24507
+ this.addFunction({
24508
+ name: helperName,
24509
+ instructions: [macroLine],
24510
+ isMacro: true,
24511
+ macroParams: ["arr_idx"]
24512
+ });
24513
+ this.dynIdxHelpers.set(key, qualifiedName);
24514
+ return qualifiedName;
24515
+ }
24516
+ /**
24517
+ * Get or create a macro helper function for dynamic array index writes.
24518
+ * The helper function: $data modify storage <ns> <pathPrefix>[$(arr_idx)] set value $(arr_val)
24519
+ * Returns the qualified MC function name.
24520
+ */
24521
+ getDynWrtHelper(ns, pathPrefix) {
24522
+ const key = `${ns}\0${pathPrefix}`;
24523
+ const existing = this.dynWrtHelpers.get(key);
24524
+ if (existing)
24525
+ return existing;
24526
+ const sanitize = (s) => s.replace(/[^a-z0-9_]/gi, "_").toLowerCase();
24527
+ const nsStr = sanitize(ns);
24528
+ const prefixStr = sanitize(pathPrefix);
24529
+ const helperName = `__dyn_wrt_${nsStr}_${prefixStr}`;
24530
+ const qualifiedName = `${this.namespace}:${helperName}`;
24531
+ const macroLine = {
24532
+ kind: "macro_line",
24533
+ template: `data modify storage ${ns} ${pathPrefix}[$(arr_idx)] set value $(arr_val)`
24534
+ };
24535
+ this.addFunction({
24536
+ name: helperName,
24537
+ instructions: [macroLine],
24538
+ isMacro: true,
24539
+ macroParams: ["arr_idx", "arr_val"]
24540
+ });
24541
+ this.dynWrtHelpers.set(key, qualifiedName);
24542
+ return qualifiedName;
24543
+ }
23547
24544
  /** Attach sourceLoc to newly added instructions (from the given start index onward) */
23548
24545
  tagSourceLoc(instrs, fromIndex, sourceLoc) {
23549
24546
  if (!sourceLoc)
@@ -23725,6 +24722,27 @@ var require_lower3 = __commonJS({
23725
24722
  });
23726
24723
  break;
23727
24724
  }
24725
+ case "nbt_read_dynamic": {
24726
+ const dst = ctx.slot(instr.dst);
24727
+ const idxSlot = operandToSlot(instr.indexSrc, ctx, instrs);
24728
+ instrs.push({
24729
+ kind: "store_score_to_nbt",
24730
+ ns: "rs:macro_args",
24731
+ path: "arr_idx",
24732
+ type: "int",
24733
+ scale: 1,
24734
+ src: idxSlot
24735
+ });
24736
+ const helperFn = ctx.getDynIdxHelper(instr.ns, instr.pathPrefix);
24737
+ instrs.push({ kind: "call_macro", fn: helperFn, storage: "rs:macro_args" });
24738
+ instrs.pop();
24739
+ instrs.push({
24740
+ kind: "store_cmd_to_score",
24741
+ dst,
24742
+ cmd: { kind: "call_macro", fn: helperFn, storage: "rs:macro_args" }
24743
+ });
24744
+ break;
24745
+ }
23728
24746
  case "nbt_write": {
23729
24747
  const srcSlot = operandToSlot(instr.src, ctx, instrs);
23730
24748
  instrs.push({
@@ -23737,6 +24755,51 @@ var require_lower3 = __commonJS({
23737
24755
  });
23738
24756
  break;
23739
24757
  }
24758
+ case "nbt_write_dynamic": {
24759
+ const idxSlot = operandToSlot(instr.indexSrc, ctx, instrs);
24760
+ const valSlot = operandToSlot(instr.valueSrc, ctx, instrs);
24761
+ instrs.push({
24762
+ kind: "store_score_to_nbt",
24763
+ ns: "rs:macro_args",
24764
+ path: "arr_idx",
24765
+ type: "int",
24766
+ scale: 1,
24767
+ src: idxSlot
24768
+ });
24769
+ instrs.push({
24770
+ kind: "store_score_to_nbt",
24771
+ ns: "rs:macro_args",
24772
+ path: "arr_val",
24773
+ type: "int",
24774
+ scale: 1,
24775
+ src: valSlot
24776
+ });
24777
+ const helperFn = ctx.getDynWrtHelper(instr.ns, instr.pathPrefix);
24778
+ instrs.push({ kind: "call_macro", fn: helperFn, storage: "rs:macro_args" });
24779
+ break;
24780
+ }
24781
+ case "score_read": {
24782
+ const dst = ctx.slot(instr.dst);
24783
+ instrs.push({
24784
+ kind: "store_cmd_to_score",
24785
+ dst,
24786
+ cmd: { kind: "raw", cmd: `scoreboard players get ${instr.player} ${instr.obj}` }
24787
+ });
24788
+ break;
24789
+ }
24790
+ case "score_write": {
24791
+ if (instr.src.kind === "const") {
24792
+ instrs.push({ kind: "raw", cmd: `scoreboard players set ${instr.player} ${instr.obj} ${instr.src.value}` });
24793
+ } else {
24794
+ const srcSlot = operandToSlot(instr.src, ctx, instrs);
24795
+ instrs.push({
24796
+ kind: "store_cmd_to_score",
24797
+ dst: { player: instr.player, obj: instr.obj },
24798
+ cmd: { kind: "raw", cmd: `scoreboard players get ${srcSlot.player} ${srcSlot.obj}` }
24799
+ });
24800
+ }
24801
+ break;
24802
+ }
23740
24803
  case "call": {
23741
24804
  for (let i = 0; i < instr.args.length; i++) {
23742
24805
  const paramSlot = { player: `$p${i}`, obj: ctx.objective };
@@ -23913,7 +24976,7 @@ var require_dead_slot = __commonJS({
23913
24976
  }
23914
24977
  function extractSlotsFromRaw(cmd) {
23915
24978
  const slots = [];
23916
- const re = /(\$[\w.]+)\s+(\S+)/g;
24979
+ const re = /(\$[\w.:]+)\s+(\S+)/g;
23917
24980
  let m;
23918
24981
  while ((m = re.exec(cmd)) !== null) {
23919
24982
  slots.push({ player: m[1], obj: m[2] });
@@ -23968,7 +25031,11 @@ var require_dead_slot = __commonJS({
23968
25031
  }
23969
25032
  function isProtectedSlot(s) {
23970
25033
  const p = s.player;
23971
- return p === "$ret" || p.startsWith("$ret_") || /^\$p\d+$/.test(p);
25034
+ if (p === "$ret" || p.startsWith("$ret_") || /^\$p\d+$/.test(p))
25035
+ return true;
25036
+ if (p.includes("__opt_"))
25037
+ return true;
25038
+ return false;
23972
25039
  }
23973
25040
  function deadSlotElim(fn) {
23974
25041
  const readSet = /* @__PURE__ */ new Set();
@@ -24030,7 +25097,7 @@ var require_const_imm = __commonJS({
24030
25097
  }
24031
25098
  function extractSlotsFromRaw(cmd) {
24032
25099
  const slots = [];
24033
- const re = /(\$[\w.]+)\s+(\S+)/g;
25100
+ const re = /(\$[\w.:]+)\s+(\S+)/g;
24034
25101
  let m;
24035
25102
  while ((m = re.exec(cmd)) !== null) {
24036
25103
  slots.push({ player: m[1], obj: m[2] });
@@ -24142,6 +25209,7 @@ var require_peephole = __commonJS({
24142
25209
  "use strict";
24143
25210
  Object.defineProperty(exports2, "__esModule", { value: true });
24144
25211
  exports2.execStorePeephole = execStorePeephole;
25212
+ var SET_ZERO_SET_ONE_RE = /^execute (.+) run scoreboard players set (\S+) (\S+) 1$/;
24145
25213
  function execStorePeephole(fn) {
24146
25214
  const instrs = fn.instructions;
24147
25215
  if (instrs.length < 2)
@@ -24162,6 +25230,19 @@ var require_peephole = __commonJS({
24162
25230
  i += 2;
24163
25231
  continue;
24164
25232
  }
25233
+ if (next && curr.kind === "score_set" && curr.value === 0 && next.kind === "raw") {
25234
+ const m = SET_ZERO_SET_ONE_RE.exec(next.cmd);
25235
+ if (m && m[2] === curr.dst.player && m[3] === curr.dst.obj) {
25236
+ const cond = m[1];
25237
+ result.push({
25238
+ kind: "raw",
25239
+ cmd: `execute store success score ${curr.dst.player} ${curr.dst.obj} ${cond}`
25240
+ });
25241
+ changed = true;
25242
+ i += 2;
25243
+ continue;
25244
+ }
25245
+ }
24165
25246
  result.push(curr);
24166
25247
  i++;
24167
25248
  }
@@ -24256,6 +25337,47 @@ var require_sourcemap = __commonJS({
24256
25337
  }
24257
25338
  });
24258
25339
 
25340
+ // ../../dist/src/types/mc-version.js
25341
+ var require_mc_version = __commonJS({
25342
+ "../../dist/src/types/mc-version.js"(exports2) {
25343
+ "use strict";
25344
+ Object.defineProperty(exports2, "__esModule", { value: true });
25345
+ exports2.DEFAULT_MC_VERSION = exports2.McVersion = void 0;
25346
+ exports2.parseMcVersion = parseMcVersion;
25347
+ exports2.compareMcVersion = compareMcVersion;
25348
+ var McVersion;
25349
+ (function(McVersion2) {
25350
+ McVersion2[McVersion2["v1_19"] = 19e3] = "v1_19";
25351
+ McVersion2[McVersion2["v1_20"] = 2e4] = "v1_20";
25352
+ McVersion2[McVersion2["v1_20_2"] = 20002] = "v1_20_2";
25353
+ McVersion2[McVersion2["v1_20_4"] = 20004] = "v1_20_4";
25354
+ McVersion2[McVersion2["v1_21"] = 21e3] = "v1_21";
25355
+ McVersion2[McVersion2["v1_21_4"] = 21004] = "v1_21_4";
25356
+ })(McVersion || (exports2.McVersion = McVersion = {}));
25357
+ function parseMcVersion(s) {
25358
+ const parts = s.trim().split(".");
25359
+ if (parts.length < 2 || parts.length > 3) {
25360
+ throw new Error(`Invalid MC version: "${s}" \u2014 expected format "1.20" or "1.20.2"`);
25361
+ }
25362
+ const [majorStr, minorStr, patchStr = "0"] = parts;
25363
+ const major = parseInt(majorStr, 10);
25364
+ const minor = parseInt(minorStr, 10);
25365
+ const patch = parseInt(patchStr, 10);
25366
+ if (isNaN(major) || isNaN(minor) || isNaN(patch)) {
25367
+ throw new Error(`Invalid MC version: "${s}" \u2014 non-numeric component`);
25368
+ }
25369
+ if (major !== 1) {
25370
+ throw new Error(`Invalid MC version: "${s}" \u2014 only Minecraft 1.x is supported`);
25371
+ }
25372
+ return minor * 1e3 + patch;
25373
+ }
25374
+ function compareMcVersion(a, b) {
25375
+ return a - b;
25376
+ }
25377
+ exports2.DEFAULT_MC_VERSION = McVersion.v1_21;
25378
+ }
25379
+ });
25380
+
24259
25381
  // ../../dist/src/emit/index.js
24260
25382
  var require_emit = __commonJS({
24261
25383
  "../../dist/src/emit/index.js"(exports2) {
@@ -24263,12 +25385,15 @@ var require_emit = __commonJS({
24263
25385
  Object.defineProperty(exports2, "__esModule", { value: true });
24264
25386
  exports2.emit = emit;
24265
25387
  var sourcemap_1 = require_sourcemap();
25388
+ var mc_version_1 = require_mc_version();
24266
25389
  function emit(module3, options) {
24267
25390
  const { namespace } = options;
24268
25391
  const tickFns = options.tickFunctions ?? [];
24269
25392
  const loadFns = options.loadFunctions ?? [];
25393
+ const scheduleFns = options.scheduleFunctions ?? [];
24270
25394
  const objective = module3.objective;
24271
25395
  const genSourceMap = options.generateSourceMap ?? false;
25396
+ const mcVersion = options.mcVersion ?? mc_version_1.DEFAULT_MC_VERSION;
24272
25397
  const files = [];
24273
25398
  files.push({
24274
25399
  path: "pack.mcmeta",
@@ -24285,17 +25410,24 @@ var require_emit = __commonJS({
24285
25410
  const fnPath = fnNameToPath(fn.name, namespace);
24286
25411
  if (genSourceMap) {
24287
25412
  const builder = new sourcemap_1.SourceMapBuilder(fnPath);
24288
- const lines = emitFunctionWithSourceMap(fn, namespace, objective, builder);
25413
+ const lines = emitFunctionWithSourceMap(fn, namespace, objective, builder, mcVersion);
24289
25414
  files.push({ path: fnPath, content: lines.join("\n") + "\n" });
24290
25415
  const map = builder.build();
24291
25416
  if (map) {
24292
25417
  files.push({ path: (0, sourcemap_1.sourceMapPath)(fnPath), content: (0, sourcemap_1.serializeSourceMap)(map) });
24293
25418
  }
24294
25419
  } else {
24295
- const lines = emitFunction(fn, namespace, objective);
25420
+ const lines = emitFunction(fn, namespace, objective, mcVersion);
24296
25421
  files.push({ path: fnPath, content: lines.join("\n") + "\n" });
24297
25422
  }
24298
25423
  }
25424
+ for (const { name, ticks } of scheduleFns) {
25425
+ files.push({
25426
+ path: `data/${namespace}/function/_schedule_${name}.mcfunction`,
25427
+ content: `schedule function ${namespace}:${name} ${ticks}t
25428
+ `
25429
+ });
25430
+ }
24299
25431
  if (loadFns.length > 0 || true) {
24300
25432
  const loadValues = [`${namespace}:load`, ...loadFns.map((fn) => `${namespace}:${fn}`)];
24301
25433
  files.push({
@@ -24312,17 +25444,17 @@ var require_emit = __commonJS({
24312
25444
  }
24313
25445
  return files;
24314
25446
  }
24315
- function emitFunction(fn, namespace, objective) {
25447
+ function emitFunction(fn, namespace, objective, mcVersion) {
24316
25448
  const lines = [];
24317
25449
  for (const instr of fn.instructions) {
24318
- lines.push(emitInstr(instr, namespace, objective));
25450
+ lines.push(emitInstr(instr, namespace, objective, mcVersion));
24319
25451
  }
24320
25452
  return lines;
24321
25453
  }
24322
- function emitFunctionWithSourceMap(fn, namespace, objective, builder) {
25454
+ function emitFunctionWithSourceMap(fn, namespace, objective, builder, mcVersion) {
24323
25455
  const lines = [];
24324
25456
  for (const instr of fn.instructions) {
24325
- lines.push(emitInstr(instr, namespace, objective));
25457
+ lines.push(emitInstr(instr, namespace, objective, mcVersion));
24326
25458
  builder.addLine(instr.sourceLoc);
24327
25459
  }
24328
25460
  return lines;
@@ -24331,7 +25463,7 @@ var require_emit = __commonJS({
24331
25463
  const mcName = name.replace(/::/g, "/").toLowerCase();
24332
25464
  return `data/${namespace}/function/${mcName}.mcfunction`;
24333
25465
  }
24334
- function emitInstr(instr, ns, obj) {
25466
+ function emitInstr(instr, ns, obj, mcVersion) {
24335
25467
  switch (instr.kind) {
24336
25468
  case "score_set":
24337
25469
  return `scoreboard players set ${slot(instr.dst)} ${instr.value}`;
@@ -24354,11 +25486,11 @@ var require_emit = __commonJS({
24354
25486
  case "score_swap":
24355
25487
  return `scoreboard players operation ${slot(instr.a)} >< ${slot(instr.b)}`;
24356
25488
  case "store_cmd_to_score":
24357
- return `execute store result score ${slot(instr.dst)} run ${emitInstr(instr.cmd, ns, obj)}`;
25489
+ return `execute store result score ${slot(instr.dst)} run ${emitInstr(instr.cmd, ns, obj, mcVersion)}`;
24358
25490
  case "store_score_to_nbt":
24359
25491
  return `execute store result storage ${instr.ns} ${instr.path} ${instr.type} ${instr.scale} run scoreboard players get ${slot(instr.src)}`;
24360
25492
  case "store_nbt_to_score":
24361
- return `execute store result score ${slot(instr.dst)} run data get storage ${instr.ns} ${instr.path} ${instr.scale}`;
25493
+ return `execute store result score ${slot(instr.dst)} run data get storage ${instr.ns} ${instr.path} ${Number.isInteger(instr.scale) ? instr.scale.toFixed(1) : instr.scale}`;
24362
25494
  case "nbt_set_literal":
24363
25495
  return `data modify storage ${instr.ns} ${instr.path} set value ${instr.value}`;
24364
25496
  case "nbt_copy":
@@ -24366,7 +25498,10 @@ var require_emit = __commonJS({
24366
25498
  case "call":
24367
25499
  return `function ${instr.fn}`;
24368
25500
  case "call_macro":
24369
- return `function ${instr.fn} with storage ${instr.storage}`;
25501
+ if (mcVersion >= mc_version_1.McVersion.v1_20_2) {
25502
+ return `function ${instr.fn} with storage ${instr.storage}`;
25503
+ }
25504
+ return `function ${instr.fn}`;
24370
25505
  case "call_if_matches":
24371
25506
  return `execute if score ${slot(instr.slot)} matches ${instr.range} run function ${instr.fn}`;
24372
25507
  case "call_unless_matches":
@@ -24377,12 +25512,15 @@ var require_emit = __commonJS({
24377
25512
  return `execute unless score ${slot(instr.a)} ${cmpToMC(instr.op)} ${slot(instr.b)} run function ${instr.fn}`;
24378
25513
  case "call_context": {
24379
25514
  const subcmds = instr.subcommands.map(emitSubcmd).join(" ");
24380
- return `execute ${subcmds} run function ${instr.fn}`;
25515
+ return subcmds ? `execute ${subcmds} run function ${instr.fn}` : `function ${instr.fn}`;
24381
25516
  }
24382
25517
  case "return_value":
24383
25518
  return `scoreboard players operation $ret ${instr.slot.obj} = ${slot(instr.slot)}`;
24384
25519
  case "macro_line":
24385
- return `$${instr.template}`;
25520
+ if (mcVersion >= mc_version_1.McVersion.v1_20_2) {
25521
+ return `$${instr.template}`;
25522
+ }
25523
+ return macroLineCompat(instr.template);
24386
25524
  case "raw":
24387
25525
  return instr.cmd;
24388
25526
  }
@@ -24407,6 +25545,9 @@ var require_emit = __commonJS({
24407
25545
  return ">=";
24408
25546
  }
24409
25547
  }
25548
+ function macroLineCompat(template) {
25549
+ return template.replace(/\$\((\w+)\)/g, (_m, p) => `{storage:rs:macro_args,path:${p}}`);
25550
+ }
24410
25551
  function emitSubcmd(sub) {
24411
25552
  switch (sub.kind) {
24412
25553
  case "as":
@@ -24444,16 +25585,22 @@ var require_coroutine = __commonJS({
24444
25585
  exports2.coroutineTransform = coroutineTransform;
24445
25586
  function coroutineTransform(mod, infos) {
24446
25587
  if (infos.length === 0)
24447
- return { module: mod, generatedTickFunctions: [] };
25588
+ return { module: mod, generatedTickFunctions: [], warnings: [] };
24448
25589
  const infoMap = new Map(infos.map((i) => [i.fnName, i]));
24449
25590
  const newFunctions = [];
24450
25591
  const tickFns = [];
25592
+ const warnings = [];
24451
25593
  for (const fn of mod.functions) {
24452
25594
  const info = infoMap.get(fn.name);
24453
25595
  if (!info) {
24454
25596
  newFunctions.push(fn);
24455
25597
  continue;
24456
25598
  }
25599
+ if (fnContainsMacroCalls(fn)) {
25600
+ warnings.push(`@coroutine cannot be applied to functions containing macro calls (skipped: ${fn.name})`);
25601
+ newFunctions.push(fn);
25602
+ continue;
25603
+ }
24457
25604
  const transformed = transformCoroutine(fn, info, mod.objective);
24458
25605
  newFunctions.push(transformed.initFn);
24459
25606
  newFunctions.push(...transformed.continuations);
@@ -24462,9 +25609,24 @@ var require_coroutine = __commonJS({
24462
25609
  }
24463
25610
  return {
24464
25611
  module: { ...mod, functions: newFunctions },
24465
- generatedTickFunctions: tickFns
25612
+ generatedTickFunctions: tickFns,
25613
+ warnings
24466
25614
  };
24467
25615
  }
25616
+ function fnContainsMacroCalls(fn) {
25617
+ for (const block of fn.blocks) {
25618
+ for (const instr of [...block.instrs, block.term]) {
25619
+ if (instr.kind === "call_macro")
25620
+ return true;
25621
+ if (instr.kind === "call" && instr.fn.startsWith("__raw:")) {
25622
+ const cmd = instr.fn.slice(6);
25623
+ if (cmd.startsWith("") || cmd.includes("${"))
25624
+ return true;
25625
+ }
25626
+ }
25627
+ }
25628
+ return false;
25629
+ }
24468
25630
  function transformCoroutine(fn, info, objective) {
24469
25631
  const prefix = `_coro_${fn.name}`;
24470
25632
  const pcTemp = `${prefix}_pc`;
@@ -24983,8 +26145,12 @@ var require_coroutine = __commonJS({
24983
26145
  return { ...instr, dst: rTemp(instr.dst), src: rOp(instr.src) };
24984
26146
  case "nbt_read":
24985
26147
  return { ...instr, dst: rTemp(instr.dst) };
26148
+ case "nbt_read_dynamic":
26149
+ return { ...instr, dst: rTemp(instr.dst), indexSrc: rOp(instr.indexSrc) };
24986
26150
  case "nbt_write":
24987
26151
  return { ...instr, src: rOp(instr.src) };
26152
+ case "nbt_write_dynamic":
26153
+ return { ...instr, indexSrc: rOp(instr.indexSrc), valueSrc: rOp(instr.valueSrc) };
24988
26154
  case "call":
24989
26155
  return { ...instr, dst: instr.dst ? rTemp(instr.dst) : null, args: instr.args.map(rOp) };
24990
26156
  case "call_macro":
@@ -25026,6 +26192,7 @@ var require_coroutine = __commonJS({
25026
26192
  case "or":
25027
26193
  case "not":
25028
26194
  case "nbt_read":
26195
+ case "nbt_read_dynamic":
25029
26196
  return instr.dst;
25030
26197
  case "call":
25031
26198
  case "call_macro":
@@ -25060,6 +26227,13 @@ var require_coroutine = __commonJS({
25060
26227
  case "nbt_write":
25061
26228
  addOp(instr.src);
25062
26229
  break;
26230
+ case "nbt_write_dynamic":
26231
+ addOp(instr.indexSrc);
26232
+ addOp(instr.valueSrc);
26233
+ break;
26234
+ case "nbt_read_dynamic":
26235
+ addOp(instr.indexSrc);
26236
+ break;
25063
26237
  case "call":
25064
26238
  instr.args.forEach(addOp);
25065
26239
  break;
@@ -25289,67 +26463,1367 @@ var require_budget = __commonJS({
25289
26463
  }
25290
26464
  });
25291
26465
 
25292
- // ../../dist/src/emit/compile.js
25293
- var require_compile2 = __commonJS({
25294
- "../../dist/src/emit/compile.js"(exports2) {
26466
+ // ../../dist/src/events/types.js
26467
+ var require_types = __commonJS({
26468
+ "../../dist/src/events/types.js"(exports2) {
25295
26469
  "use strict";
25296
26470
  Object.defineProperty(exports2, "__esModule", { value: true });
25297
- exports2.compile = compile;
25298
- var lexer_1 = require_lexer();
25299
- var parser_1 = require_parser();
25300
- var compile_1 = require_compile();
26471
+ exports2.EVENT_TYPES = void 0;
26472
+ exports2.isEventTypeName = isEventTypeName;
26473
+ exports2.getEventParamSpecs = getEventParamSpecs;
26474
+ exports2.EVENT_TYPES = {
26475
+ PlayerDeath: {
26476
+ tag: "rs.just_died",
26477
+ params: ["player: Player"],
26478
+ detection: "scoreboard"
26479
+ },
26480
+ PlayerJoin: {
26481
+ tag: "rs.just_joined",
26482
+ params: ["player: Player"],
26483
+ detection: "tag"
26484
+ },
26485
+ BlockBreak: {
26486
+ tag: "rs.just_broke_block",
26487
+ params: ["player: Player", "block: string"],
26488
+ detection: "advancement"
26489
+ },
26490
+ EntityKill: {
26491
+ tag: "rs.just_killed",
26492
+ params: ["player: Player"],
26493
+ detection: "scoreboard"
26494
+ },
26495
+ ItemUse: {
26496
+ tag: "rs.just_used_item",
26497
+ params: ["player: Player"],
26498
+ detection: "scoreboard"
26499
+ }
26500
+ };
26501
+ function isEventTypeName(value) {
26502
+ return value in exports2.EVENT_TYPES;
26503
+ }
26504
+ function getEventParamSpecs(eventType) {
26505
+ return exports2.EVENT_TYPES[eventType].params.map(parseEventParam);
26506
+ }
26507
+ function parseEventParam(spec) {
26508
+ const match = spec.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*([A-Za-z_][A-Za-z0-9_]*)$/);
26509
+ if (!match) {
26510
+ throw new Error(`Invalid event parameter spec: ${spec}`);
26511
+ }
26512
+ const [, name, typeName] = match;
26513
+ return {
26514
+ name,
26515
+ type: toTypeNode(typeName)
26516
+ };
26517
+ }
26518
+ function toTypeNode(typeName) {
26519
+ if (typeName === "Player") {
26520
+ return { kind: "entity", entityType: "Player" };
26521
+ }
26522
+ if (typeName === "string" || typeName === "int" || typeName === "bool" || typeName === "float" || typeName === "fixed" || typeName === "void" || typeName === "BlockPos" || typeName === "byte" || typeName === "short" || typeName === "long" || typeName === "double") {
26523
+ return { kind: "named", name: typeName };
26524
+ }
26525
+ return { kind: "struct", name: typeName };
26526
+ }
26527
+ }
26528
+ });
26529
+
26530
+ // ../../dist/src/typechecker/index.js
26531
+ var require_typechecker = __commonJS({
26532
+ "../../dist/src/typechecker/index.js"(exports2) {
26533
+ "use strict";
26534
+ Object.defineProperty(exports2, "__esModule", { value: true });
26535
+ exports2.TypeChecker = void 0;
25301
26536
  var diagnostics_1 = require_diagnostics();
25302
- var lower_1 = require_lower();
25303
- var monomorphize_1 = require_monomorphize();
25304
- var lower_2 = require_lower2();
25305
- var pipeline_1 = require_pipeline();
25306
- var lower_3 = require_lower3();
25307
- var pipeline_2 = require_pipeline2();
25308
- var index_1 = require_emit();
25309
- var coroutine_1 = require_coroutine();
25310
- var budget_1 = require_budget();
25311
- function compile(source, options = {}) {
25312
- const { namespace = "redscript", filePath, generateSourceMap = false } = options;
25313
- const warnings = [];
25314
- const preprocessed = (0, compile_1.preprocessSourceWithMetadata)(source, { filePath });
25315
- const processedSource = preprocessed.source;
25316
- const lexer = new lexer_1.Lexer(processedSource);
25317
- const tokens = lexer.tokenize();
25318
- const parser = new parser_1.Parser(tokens, processedSource, filePath);
25319
- const ast = parser.parse(namespace);
25320
- for (const li of preprocessed.libraryImports ?? []) {
25321
- const libPreprocessed = (0, compile_1.preprocessSourceWithMetadata)(li.source, { filePath: li.filePath });
25322
- const libTokens = new lexer_1.Lexer(libPreprocessed.source, li.filePath).tokenize();
25323
- const libAst = new parser_1.Parser(libTokens, libPreprocessed.source, li.filePath).parse(namespace);
25324
- for (const fn of libAst.declarations)
25325
- fn.isLibraryFn = true;
25326
- ast.declarations.push(...libAst.declarations);
25327
- ast.structs.push(...libAst.structs);
25328
- ast.implBlocks.push(...libAst.implBlocks);
25329
- ast.enums.push(...libAst.enums);
25330
- ast.consts.push(...libAst.consts);
25331
- ast.globals.push(...libAst.globals);
26537
+ var types_1 = require_types();
26538
+ var ENTITY_HIERARCHY = {
26539
+ "entity": null,
26540
+ "Player": "entity",
26541
+ "Mob": "entity",
26542
+ "HostileMob": "Mob",
26543
+ "PassiveMob": "Mob",
26544
+ "Zombie": "HostileMob",
26545
+ "Skeleton": "HostileMob",
26546
+ "Creeper": "HostileMob",
26547
+ "Spider": "HostileMob",
26548
+ "Enderman": "HostileMob",
26549
+ "Blaze": "HostileMob",
26550
+ "Witch": "HostileMob",
26551
+ "Slime": "HostileMob",
26552
+ "ZombieVillager": "HostileMob",
26553
+ "Husk": "HostileMob",
26554
+ "Drowned": "HostileMob",
26555
+ "Stray": "HostileMob",
26556
+ "WitherSkeleton": "HostileMob",
26557
+ "CaveSpider": "HostileMob",
26558
+ "Pig": "PassiveMob",
26559
+ "Cow": "PassiveMob",
26560
+ "Sheep": "PassiveMob",
26561
+ "Chicken": "PassiveMob",
26562
+ "Villager": "PassiveMob",
26563
+ "WanderingTrader": "PassiveMob",
26564
+ "ArmorStand": "entity",
26565
+ "Item": "entity",
26566
+ "Arrow": "entity"
26567
+ };
26568
+ var MC_TYPE_TO_ENTITY = {
26569
+ "zombie": "Zombie",
26570
+ "minecraft:zombie": "Zombie",
26571
+ "skeleton": "Skeleton",
26572
+ "minecraft:skeleton": "Skeleton",
26573
+ "creeper": "Creeper",
26574
+ "minecraft:creeper": "Creeper",
26575
+ "spider": "Spider",
26576
+ "minecraft:spider": "Spider",
26577
+ "enderman": "Enderman",
26578
+ "minecraft:enderman": "Enderman",
26579
+ "blaze": "Blaze",
26580
+ "minecraft:blaze": "Blaze",
26581
+ "witch": "Witch",
26582
+ "minecraft:witch": "Witch",
26583
+ "slime": "Slime",
26584
+ "minecraft:slime": "Slime",
26585
+ "zombie_villager": "ZombieVillager",
26586
+ "minecraft:zombie_villager": "ZombieVillager",
26587
+ "husk": "Husk",
26588
+ "minecraft:husk": "Husk",
26589
+ "drowned": "Drowned",
26590
+ "minecraft:drowned": "Drowned",
26591
+ "stray": "Stray",
26592
+ "minecraft:stray": "Stray",
26593
+ "wither_skeleton": "WitherSkeleton",
26594
+ "minecraft:wither_skeleton": "WitherSkeleton",
26595
+ "cave_spider": "CaveSpider",
26596
+ "minecraft:cave_spider": "CaveSpider",
26597
+ "pig": "Pig",
26598
+ "minecraft:pig": "Pig",
26599
+ "cow": "Cow",
26600
+ "minecraft:cow": "Cow",
26601
+ "sheep": "Sheep",
26602
+ "minecraft:sheep": "Sheep",
26603
+ "chicken": "Chicken",
26604
+ "minecraft:chicken": "Chicken",
26605
+ "villager": "Villager",
26606
+ "minecraft:villager": "Villager",
26607
+ "wandering_trader": "WanderingTrader",
26608
+ "minecraft:wandering_trader": "WanderingTrader",
26609
+ "armor_stand": "ArmorStand",
26610
+ "minecraft:armor_stand": "ArmorStand",
26611
+ "item": "Item",
26612
+ "minecraft:item": "Item",
26613
+ "arrow": "Arrow",
26614
+ "minecraft:arrow": "Arrow"
26615
+ };
26616
+ var VOID_TYPE = { kind: "named", name: "void" };
26617
+ var INT_TYPE = { kind: "named", name: "int" };
26618
+ var STRING_TYPE = { kind: "named", name: "string" };
26619
+ var FORMAT_STRING_TYPE = { kind: "named", name: "format_string" };
26620
+ var BUILTIN_SIGNATURES = {
26621
+ setTimeout: {
26622
+ params: [INT_TYPE, { kind: "function_type", params: [], return: VOID_TYPE }],
26623
+ return: VOID_TYPE
26624
+ },
26625
+ setInterval: {
26626
+ params: [INT_TYPE, { kind: "function_type", params: [], return: VOID_TYPE }],
26627
+ return: INT_TYPE
26628
+ },
26629
+ clearInterval: {
26630
+ params: [INT_TYPE],
26631
+ return: VOID_TYPE
25332
26632
  }
25333
- if (options.librarySources) {
25334
- for (const libSrc of options.librarySources) {
25335
- const libTokens = new lexer_1.Lexer(libSrc).tokenize();
25336
- const libAst = new parser_1.Parser(libTokens, libSrc).parse(namespace);
25337
- for (const fn of libAst.declarations)
25338
- fn.isLibraryFn = true;
25339
- ast.declarations.push(...libAst.declarations);
25340
- ast.structs.push(...libAst.structs);
25341
- ast.implBlocks.push(...libAst.implBlocks);
25342
- ast.enums.push(...libAst.enums);
25343
- ast.consts.push(...libAst.consts);
25344
- ast.globals.push(...libAst.globals);
25345
- }
26633
+ };
26634
+ var TypeChecker = class {
26635
+ constructor(source, filePath) {
26636
+ this.lintWarnings = [];
26637
+ this.functions = /* @__PURE__ */ new Map();
26638
+ this.implMethods = /* @__PURE__ */ new Map();
26639
+ this.structs = /* @__PURE__ */ new Map();
26640
+ this.enums = /* @__PURE__ */ new Map();
26641
+ this.consts = /* @__PURE__ */ new Map();
26642
+ this.globals = /* @__PURE__ */ new Map();
26643
+ this.currentFn = null;
26644
+ this.currentReturnType = null;
26645
+ this.scope = /* @__PURE__ */ new Map();
26646
+ this.selfTypeStack = ["entity"];
26647
+ this.loopDepth = 0;
26648
+ this.condDepth = 0;
26649
+ this.richTextBuiltins = /* @__PURE__ */ new Map([
26650
+ ["say", { messageIndex: 0 }],
26651
+ ["announce", { messageIndex: 0 }],
26652
+ ["tell", { messageIndex: 1 }],
26653
+ ["tellraw", { messageIndex: 1 }],
26654
+ ["title", { messageIndex: 1 }],
26655
+ ["actionbar", { messageIndex: 1 }],
26656
+ ["subtitle", { messageIndex: 1 }]
26657
+ ]);
26658
+ this.collector = new diagnostics_1.DiagnosticCollector(source, filePath);
26659
+ this.filePath = filePath;
25346
26660
  }
25347
- try {
25348
- const hirRaw = (0, lower_1.lowerToHIR)(ast);
26661
+ getNodeLocation(node) {
26662
+ const span = node?.span;
26663
+ return {
26664
+ line: span?.line ?? 1,
26665
+ col: span?.col ?? 1
26666
+ };
26667
+ }
26668
+ report(message, node) {
26669
+ const { line, col } = this.getNodeLocation(node);
26670
+ this.collector.error("TypeError", message, line, col);
26671
+ }
26672
+ warnLint(message, node) {
26673
+ const { line, col } = this.getNodeLocation(node);
26674
+ const filePart = this.filePath ? `${this.filePath}:` : "";
26675
+ this.lintWarnings.push(`${filePart}line ${line}, col ${col}: ${message}`);
26676
+ }
26677
+ /** Returns lint warnings (non-blocking). */
26678
+ getWarnings() {
26679
+ return this.lintWarnings;
26680
+ }
26681
+ /**
26682
+ * Type check a program. Returns collected errors.
26683
+ */
26684
+ check(program) {
26685
+ for (const fn of program.declarations) {
26686
+ this.functions.set(fn.name, fn);
26687
+ }
26688
+ for (const global of program.globals ?? []) {
26689
+ this.globals.set(global.name, this.normalizeType(global.type));
26690
+ }
26691
+ for (const implBlock of program.implBlocks ?? []) {
26692
+ let methods = this.implMethods.get(implBlock.typeName);
26693
+ if (!methods) {
26694
+ methods = /* @__PURE__ */ new Map();
26695
+ this.implMethods.set(implBlock.typeName, methods);
26696
+ }
26697
+ for (const method of implBlock.methods) {
26698
+ const selfIndex = method.params.findIndex((param) => param.name === "self");
26699
+ if (selfIndex > 0) {
26700
+ this.report(`Method '${method.name}' must declare 'self' as the first parameter`, method.params[selfIndex]);
26701
+ }
26702
+ if (selfIndex === 0) {
26703
+ const selfType = this.normalizeType(method.params[0].type);
26704
+ if (selfType.kind !== "struct" || selfType.name !== implBlock.typeName) {
26705
+ this.report(`Method '${method.name}' has invalid 'self' type`, method.params[0]);
26706
+ }
26707
+ }
26708
+ methods.set(method.name, method);
26709
+ }
26710
+ }
26711
+ for (const struct of program.structs ?? []) {
26712
+ const fields = /* @__PURE__ */ new Map();
26713
+ for (const field of struct.fields) {
26714
+ fields.set(field.name, field.type);
26715
+ }
26716
+ this.structs.set(struct.name, fields);
26717
+ }
26718
+ for (const enumDecl of program.enums ?? []) {
26719
+ const variants = /* @__PURE__ */ new Map();
26720
+ for (const variant of enumDecl.variants) {
26721
+ variants.set(variant.name, variant.value ?? 0);
26722
+ }
26723
+ this.enums.set(enumDecl.name, variants);
26724
+ }
26725
+ for (const constDecl of program.consts ?? []) {
26726
+ const constType = this.normalizeType(constDecl.type);
26727
+ const actualType = this.inferType(constDecl.value);
26728
+ if (!this.typesMatch(constType, actualType)) {
26729
+ this.report(`Type mismatch: expected ${this.typeToString(constType)}, got ${this.typeToString(actualType)}`, constDecl.value);
26730
+ }
26731
+ this.consts.set(constDecl.name, constType);
26732
+ }
26733
+ for (const fn of program.declarations) {
26734
+ this.checkFunction(fn);
26735
+ }
26736
+ for (const implBlock of program.implBlocks ?? []) {
26737
+ for (const method of implBlock.methods) {
26738
+ this.checkFunction(method);
26739
+ }
26740
+ }
26741
+ return this.collector.getErrors();
26742
+ }
26743
+ checkFunction(fn) {
26744
+ if (fn.typeParams && fn.typeParams.length > 0)
26745
+ return;
26746
+ this.currentFn = fn;
26747
+ this.currentReturnType = this.normalizeType(fn.returnType);
26748
+ this.scope = /* @__PURE__ */ new Map();
26749
+ let seenDefault = false;
26750
+ this.checkFunctionDecorators(fn);
26751
+ for (const [name, type] of this.consts.entries()) {
26752
+ this.scope.set(name, { type, mutable: false });
26753
+ }
26754
+ for (const [name, type] of this.globals.entries()) {
26755
+ this.scope.set(name, { type, mutable: true });
26756
+ }
26757
+ for (const param of fn.params) {
26758
+ this.scope.set(param.name, { type: this.normalizeType(param.type), mutable: true });
26759
+ if (param.default) {
26760
+ seenDefault = true;
26761
+ this.checkExpr(param.default);
26762
+ const defaultType = this.inferType(param.default);
26763
+ const paramType = this.normalizeType(param.type);
26764
+ if (!this.typesMatch(paramType, defaultType)) {
26765
+ this.report(`Default value for '${param.name}' must be ${this.typeToString(paramType)}, got ${this.typeToString(defaultType)}`, param.default);
26766
+ }
26767
+ } else if (seenDefault) {
26768
+ this.report(`Parameter '${param.name}' cannot follow a default parameter`, param);
26769
+ }
26770
+ }
26771
+ this.checkBlock(fn.body);
26772
+ this.currentFn = null;
26773
+ this.currentReturnType = null;
26774
+ }
26775
+ checkFunctionDecorators(fn) {
26776
+ const eventDecorators = fn.decorators.filter((decorator) => decorator.name === "on");
26777
+ if (eventDecorators.length === 0) {
26778
+ return;
26779
+ }
26780
+ if (eventDecorators.length > 1) {
26781
+ this.report(`Function '${fn.name}' cannot have multiple @on decorators`, fn);
26782
+ return;
26783
+ }
26784
+ const eventType = eventDecorators[0].args?.eventType;
26785
+ if (!eventType) {
26786
+ this.report(`Function '${fn.name}' is missing an event type in @on(...)`, fn);
26787
+ return;
26788
+ }
26789
+ if (!(0, types_1.isEventTypeName)(eventType)) {
26790
+ this.report(`Unknown event type '${eventType}'`, fn);
26791
+ return;
26792
+ }
26793
+ const expectedParams = (0, types_1.getEventParamSpecs)(eventType);
26794
+ if (fn.params.length !== expectedParams.length) {
26795
+ this.report(`Event handler '${fn.name}' for ${eventType} must declare ${expectedParams.length} parameter(s), got ${fn.params.length}`, fn);
26796
+ return;
26797
+ }
26798
+ for (let i = 0; i < expectedParams.length; i++) {
26799
+ const actual = this.normalizeType(fn.params[i].type);
26800
+ const expected = this.normalizeType(expectedParams[i].type);
26801
+ if (!this.typesMatch(expected, actual)) {
26802
+ this.report(`Event handler '${fn.name}' parameter ${i + 1} must be ${this.typeToString(expected)}, got ${this.typeToString(actual)}`, fn.params[i]);
26803
+ }
26804
+ }
26805
+ }
26806
+ checkBlock(stmts) {
26807
+ for (const stmt of stmts) {
26808
+ this.checkStmt(stmt);
26809
+ }
26810
+ }
26811
+ checkStmt(stmt) {
26812
+ switch (stmt.kind) {
26813
+ case "let":
26814
+ this.checkLetStmt(stmt);
26815
+ break;
26816
+ case "let_destruct":
26817
+ this.checkLetDestructStmt(stmt);
26818
+ break;
26819
+ case "return":
26820
+ this.checkReturnStmt(stmt);
26821
+ break;
26822
+ case "if":
26823
+ this.checkExpr(stmt.cond);
26824
+ this.condDepth++;
26825
+ this.checkIfBranches(stmt);
26826
+ this.condDepth--;
26827
+ break;
26828
+ case "while":
26829
+ this.checkExpr(stmt.cond);
26830
+ this.loopDepth++;
26831
+ this.checkBlock(stmt.body);
26832
+ this.loopDepth--;
26833
+ break;
26834
+ case "for":
26835
+ if (stmt.init)
26836
+ this.checkStmt(stmt.init);
26837
+ this.checkExpr(stmt.cond);
26838
+ this.checkExpr(stmt.step);
26839
+ this.loopDepth++;
26840
+ this.checkBlock(stmt.body);
26841
+ this.loopDepth--;
26842
+ break;
26843
+ case "foreach":
26844
+ this.checkExpr(stmt.iterable);
26845
+ if (stmt.iterable.kind === "selector") {
26846
+ const entityType = this.inferEntityTypeFromSelector(stmt.iterable.sel);
26847
+ this.scope.set(stmt.binding, {
26848
+ type: { kind: "entity", entityType },
26849
+ mutable: false
26850
+ // Entity bindings are not reassignable
26851
+ });
26852
+ this.pushSelfType(entityType);
26853
+ this.loopDepth++;
26854
+ this.checkBlock(stmt.body);
26855
+ this.loopDepth--;
26856
+ this.popSelfType();
26857
+ } else {
26858
+ const iterableType = this.inferType(stmt.iterable);
26859
+ if (iterableType.kind === "array") {
26860
+ this.scope.set(stmt.binding, { type: iterableType.elem, mutable: true });
26861
+ } else {
26862
+ this.scope.set(stmt.binding, { type: { kind: "named", name: "void" }, mutable: true });
26863
+ }
26864
+ this.loopDepth++;
26865
+ this.checkBlock(stmt.body);
26866
+ this.loopDepth--;
26867
+ }
26868
+ break;
26869
+ case "match":
26870
+ this.checkExpr(stmt.expr);
26871
+ for (const arm of stmt.arms) {
26872
+ if (arm.pattern) {
26873
+ this.checkExpr(arm.pattern);
26874
+ const subjectType = this.inferType(stmt.expr);
26875
+ const patternType = this.inferType(arm.pattern);
26876
+ const isUnknown = (t) => t.kind === "named" && t.name === "void";
26877
+ if (!isUnknown(subjectType) && !isUnknown(patternType) && !this.typesMatch(subjectType, patternType)) {
26878
+ this.report("Match arm pattern type must match subject type", arm.pattern);
26879
+ }
26880
+ }
26881
+ this.checkBlock(arm.body);
26882
+ }
26883
+ break;
26884
+ case "as_block": {
26885
+ const entityType = this.inferEntityTypeFromSelector(stmt.selector);
26886
+ this.pushSelfType(entityType);
26887
+ this.checkBlock(stmt.body);
26888
+ this.popSelfType();
26889
+ break;
26890
+ }
26891
+ case "at_block":
26892
+ this.checkBlock(stmt.body);
26893
+ break;
26894
+ case "as_at": {
26895
+ const entityType = this.inferEntityTypeFromSelector(stmt.as_sel);
26896
+ this.pushSelfType(entityType);
26897
+ this.checkBlock(stmt.body);
26898
+ this.popSelfType();
26899
+ break;
26900
+ }
26901
+ case "execute":
26902
+ for (const sub of stmt.subcommands) {
26903
+ if (sub.kind === "as" && sub.selector) {
26904
+ const entityType = this.inferEntityTypeFromSelector(sub.selector);
26905
+ this.pushSelfType(entityType);
26906
+ }
26907
+ }
26908
+ this.checkBlock(stmt.body);
26909
+ for (const sub of stmt.subcommands) {
26910
+ if (sub.kind === "as") {
26911
+ this.popSelfType();
26912
+ }
26913
+ }
26914
+ break;
26915
+ case "expr":
26916
+ this.checkExpr(stmt.expr);
26917
+ break;
26918
+ case "raw":
26919
+ break;
26920
+ }
26921
+ }
26922
+ checkLetDestructStmt(stmt) {
26923
+ this.checkExpr(stmt.init);
26924
+ const initType = this.inferType(stmt.init);
26925
+ if (stmt.type) {
26926
+ const normalized = this.normalizeType(stmt.type);
26927
+ if (normalized.kind !== "tuple") {
26928
+ this.report(`Destructuring type annotation must be a tuple type`, stmt);
26929
+ return;
26930
+ }
26931
+ if (normalized.elements.length !== stmt.names.length) {
26932
+ this.report(`Destructuring pattern has ${stmt.names.length} bindings but type has ${normalized.elements.length} elements`, stmt);
26933
+ }
26934
+ for (let i = 0; i < stmt.names.length; i++) {
26935
+ const elemType = normalized.elements[i] ?? { kind: "named", name: "int" };
26936
+ this.scope.set(stmt.names[i], { type: elemType, mutable: true });
26937
+ }
26938
+ } else if (initType.kind === "tuple") {
26939
+ if (initType.elements.length !== stmt.names.length) {
26940
+ this.report(`Destructuring pattern has ${stmt.names.length} bindings but tuple has ${initType.elements.length} elements`, stmt);
26941
+ }
26942
+ for (let i = 0; i < stmt.names.length; i++) {
26943
+ const elemType = initType.elements[i] ?? { kind: "named", name: "int" };
26944
+ this.scope.set(stmt.names[i], { type: elemType, mutable: true });
26945
+ }
26946
+ } else {
26947
+ for (const name of stmt.names) {
26948
+ this.scope.set(name, { type: INT_TYPE, mutable: true });
26949
+ }
26950
+ }
26951
+ }
26952
+ checkLetStmt(stmt) {
26953
+ const expectedType = stmt.type ? this.normalizeType(stmt.type) : void 0;
26954
+ this.checkExpr(stmt.init, expectedType);
26955
+ const type = expectedType ?? this.inferType(stmt.init);
26956
+ this.scope.set(stmt.name, { type, mutable: true });
26957
+ const actualType = this.inferType(stmt.init, expectedType);
26958
+ if (expectedType && stmt.init.kind !== "struct_lit" && stmt.init.kind !== "array_lit" && !(actualType.kind === "named" && actualType.name === "void")) {
26959
+ if (this.isNumericMismatch(expectedType, actualType)) {
26960
+ this.report(`Type mismatch: cannot implicitly convert ${this.typeToString(actualType)} to ${this.typeToString(expectedType)} (use an explicit cast: 'as ${this.typeToString(expectedType)}')`, stmt);
26961
+ } else if (!this.typesMatch(expectedType, actualType)) {
26962
+ this.report(`Type mismatch: expected ${this.typeToString(expectedType)}, got ${this.typeToString(actualType)}`, stmt);
26963
+ }
26964
+ }
26965
+ }
26966
+ checkReturnStmt(stmt) {
26967
+ if (!this.currentReturnType)
26968
+ return;
26969
+ const expectedType = this.currentReturnType;
26970
+ if (stmt.value) {
26971
+ const actualType = this.inferType(stmt.value, expectedType);
26972
+ this.checkExpr(stmt.value, expectedType);
26973
+ const returnIsFloat = expectedType.kind === "named" && expectedType.name === "float";
26974
+ if (returnIsFloat && stmt.value.kind === "binary") {
26975
+ const arithmeticOps = ["+", "-", "*", "/", "%"];
26976
+ if (arithmeticOps.includes(stmt.value.op)) {
26977
+ this.warnLint(`[FloatArithmetic] 'float' is a system boundary type (MC NBT float); use 'fixed' for arithmetic instead.`, stmt.value);
26978
+ }
26979
+ }
26980
+ if (this.isNumericMismatch(expectedType, actualType)) {
26981
+ this.report(`Return type mismatch: cannot implicitly convert ${this.typeToString(actualType)} to ${this.typeToString(expectedType)} (use an explicit cast: 'as ${this.typeToString(expectedType)}')`, stmt);
26982
+ } else if (!this.typesMatch(expectedType, actualType)) {
26983
+ this.report(`Return type mismatch: expected ${this.typeToString(expectedType)}, got ${this.typeToString(actualType)}`, stmt);
26984
+ }
26985
+ } else {
26986
+ if (expectedType.kind !== "named" || expectedType.name !== "void") {
26987
+ this.report(`Missing return value: expected ${this.typeToString(expectedType)}`, stmt);
26988
+ }
26989
+ }
26990
+ }
26991
+ checkExpr(expr, expectedType) {
26992
+ switch (expr.kind) {
26993
+ case "ident":
26994
+ if (!this.scope.has(expr.name)) {
26995
+ this.report(`Variable '${expr.name}' used before declaration`, expr);
26996
+ }
26997
+ break;
26998
+ case "call":
26999
+ this.checkCallExpr(expr);
27000
+ break;
27001
+ case "invoke":
27002
+ this.checkInvokeExpr(expr);
27003
+ break;
27004
+ case "member":
27005
+ this.checkMemberExpr(expr);
27006
+ break;
27007
+ case "static_call":
27008
+ this.checkStaticCallExpr(expr);
27009
+ break;
27010
+ case "binary": {
27011
+ this.checkExpr(expr.left);
27012
+ this.checkExpr(expr.right);
27013
+ const arithmeticOps = ["+", "-", "*", "/", "%"];
27014
+ if (arithmeticOps.includes(expr.op)) {
27015
+ const leftType = this.inferType(expr.left);
27016
+ const rightType = this.inferType(expr.right);
27017
+ const leftIsFloat = leftType.kind === "named" && leftType.name === "float";
27018
+ const rightIsFloat = rightType.kind === "named" && rightType.name === "float";
27019
+ if (leftIsFloat || rightIsFloat) {
27020
+ this.warnLint(`[FloatArithmetic] 'float' is a system boundary type (MC NBT); use 'fixed' for arithmetic. Float arithmetic results are undefined.`, expr);
27021
+ }
27022
+ }
27023
+ break;
27024
+ }
27025
+ case "is_check": {
27026
+ this.checkExpr(expr.expr);
27027
+ const checkedType = this.inferType(expr.expr);
27028
+ if (checkedType.kind !== "entity") {
27029
+ this.report(`'is' checks require an entity expression, got ${this.typeToString(checkedType)}`, expr.expr);
27030
+ }
27031
+ break;
27032
+ }
27033
+ case "unary":
27034
+ this.checkExpr(expr.operand);
27035
+ break;
27036
+ case "assign":
27037
+ if (!this.scope.has(expr.target)) {
27038
+ this.report(`Variable '${expr.target}' used before declaration`, expr);
27039
+ } else if (!this.scope.get(expr.target)?.mutable) {
27040
+ this.report(`Cannot assign to const '${expr.target}'`, expr);
27041
+ }
27042
+ this.checkExpr(expr.value, this.scope.get(expr.target)?.type);
27043
+ break;
27044
+ case "member_assign":
27045
+ this.checkExpr(expr.obj);
27046
+ this.checkExpr(expr.value);
27047
+ break;
27048
+ case "index_assign":
27049
+ this.checkExpr(expr.obj);
27050
+ this.checkExpr(expr.index);
27051
+ this.checkExpr(expr.value);
27052
+ break;
27053
+ case "index":
27054
+ this.checkExpr(expr.obj);
27055
+ this.checkExpr(expr.index);
27056
+ const indexType = this.inferType(expr.index);
27057
+ if (indexType.kind !== "named" || indexType.name !== "int") {
27058
+ this.report("Array index must be int", expr.index);
27059
+ }
27060
+ break;
27061
+ case "struct_lit":
27062
+ for (const field of expr.fields) {
27063
+ this.checkExpr(field.value);
27064
+ }
27065
+ break;
27066
+ case "str_interp":
27067
+ for (const part of expr.parts) {
27068
+ if (typeof part !== "string") {
27069
+ this.checkExpr(part);
27070
+ }
27071
+ }
27072
+ break;
27073
+ case "f_string":
27074
+ for (const part of expr.parts) {
27075
+ if (part.kind !== "expr") {
27076
+ continue;
27077
+ }
27078
+ this.checkExpr(part.expr);
27079
+ const partType = this.inferType(part.expr);
27080
+ const isUnknown = partType.kind === "named" && partType.name === "void";
27081
+ if (!isUnknown && !(partType.kind === "named" && (partType.name === "int" || partType.name === "string" || partType.name === "format_string"))) {
27082
+ this.report(`f-string placeholder must be int or string, got ${this.typeToString(partType)}`, part.expr);
27083
+ }
27084
+ }
27085
+ break;
27086
+ case "array_lit":
27087
+ for (const elem of expr.elements) {
27088
+ this.checkExpr(elem);
27089
+ }
27090
+ break;
27091
+ case "tuple_lit":
27092
+ if (expr.elements.length < 2 || expr.elements.length > 8) {
27093
+ this.report(`Tuple must have 2-8 elements, got ${expr.elements.length}`, expr);
27094
+ }
27095
+ for (const elem of expr.elements) {
27096
+ this.checkExpr(elem);
27097
+ }
27098
+ break;
27099
+ case "lambda":
27100
+ this.checkLambdaExpr(expr, expectedType);
27101
+ break;
27102
+ case "path_expr":
27103
+ if (!this.enums.has(expr.enumName)) {
27104
+ this.report(`Unknown enum '${expr.enumName}'`, expr);
27105
+ } else {
27106
+ const variants = this.enums.get(expr.enumName);
27107
+ if (!variants.has(expr.variant)) {
27108
+ this.report(`Enum '${expr.enumName}' has no variant '${expr.variant}'`, expr);
27109
+ }
27110
+ }
27111
+ break;
27112
+ case "blockpos":
27113
+ break;
27114
+ // Literals don't need checking
27115
+ case "int_lit":
27116
+ case "float_lit":
27117
+ case "bool_lit":
27118
+ case "str_lit":
27119
+ case "mc_name":
27120
+ case "range_lit":
27121
+ case "selector":
27122
+ case "byte_lit":
27123
+ case "short_lit":
27124
+ case "long_lit":
27125
+ case "double_lit":
27126
+ break;
27127
+ case "type_cast":
27128
+ this.checkExpr(expr.expr);
27129
+ break;
27130
+ }
27131
+ }
27132
+ checkCallExpr(expr) {
27133
+ if (expr.fn === "tp" || expr.fn === "tp_to") {
27134
+ this.checkTpCall(expr);
27135
+ }
27136
+ const richTextBuiltin = this.richTextBuiltins.get(expr.fn);
27137
+ if (richTextBuiltin) {
27138
+ this.checkRichTextBuiltinCall(expr, richTextBuiltin.messageIndex);
27139
+ return;
27140
+ }
27141
+ const builtin = BUILTIN_SIGNATURES[expr.fn];
27142
+ if (builtin) {
27143
+ if (expr.fn === "setTimeout" || expr.fn === "setInterval") {
27144
+ if (this.loopDepth > 0) {
27145
+ this.report(`${expr.fn}() cannot be called inside a loop. Declare timers at the top level.`, expr);
27146
+ } else if (this.condDepth > 0) {
27147
+ this.report(`${expr.fn}() cannot be called inside an if/else body. Declare timers at the top level.`, expr);
27148
+ }
27149
+ }
27150
+ this.checkFunctionCallArgs(expr.args, builtin.params, expr.fn, expr);
27151
+ return;
27152
+ }
27153
+ const fn = this.functions.get(expr.fn);
27154
+ if (fn) {
27155
+ if (fn.typeParams && fn.typeParams.length > 0) {
27156
+ const requiredParams2 = fn.params.filter((param) => !param.default).length;
27157
+ if (expr.args.length < requiredParams2 || expr.args.length > fn.params.length) {
27158
+ this.report(`Function '${expr.fn}' expects ${requiredParams2}-${fn.params.length} arguments, got ${expr.args.length}`, expr);
27159
+ }
27160
+ for (const arg of expr.args)
27161
+ this.checkExpr(arg);
27162
+ return;
27163
+ }
27164
+ const requiredParams = fn.params.filter((param) => !param.default).length;
27165
+ if (expr.args.length < requiredParams || expr.args.length > fn.params.length) {
27166
+ const expectedRange = requiredParams === fn.params.length ? `${fn.params.length}` : `${requiredParams}-${fn.params.length}`;
27167
+ this.report(`Function '${expr.fn}' expects ${expectedRange} arguments, got ${expr.args.length}`, expr);
27168
+ }
27169
+ for (let i = 0; i < expr.args.length; i++) {
27170
+ const paramType = fn.params[i] ? this.normalizeType(fn.params[i].type) : void 0;
27171
+ if (paramType) {
27172
+ this.checkExpr(expr.args[i], paramType);
27173
+ }
27174
+ const argType = this.inferType(expr.args[i], paramType);
27175
+ if (paramType && !this.typesMatch(paramType, argType)) {
27176
+ this.report(`Argument ${i + 1} of '${expr.fn}' expects ${this.typeToString(paramType)}, got ${this.typeToString(argType)}`, expr.args[i]);
27177
+ }
27178
+ }
27179
+ return;
27180
+ }
27181
+ const varType = this.scope.get(expr.fn)?.type;
27182
+ if (varType?.kind === "function_type") {
27183
+ this.checkFunctionCallArgs(expr.args, varType.params, expr.fn, expr);
27184
+ return;
27185
+ }
27186
+ const implMethod = this.resolveInstanceMethod(expr);
27187
+ if (implMethod) {
27188
+ this.checkFunctionCallArgs(expr.args, implMethod.params.map((param) => this.normalizeType(param.type)), implMethod.name, expr);
27189
+ return;
27190
+ }
27191
+ for (const arg of expr.args) {
27192
+ this.checkExpr(arg);
27193
+ }
27194
+ }
27195
+ checkRichTextBuiltinCall(expr, messageIndex) {
27196
+ for (let i = 0; i < expr.args.length; i++) {
27197
+ this.checkExpr(expr.args[i], i === messageIndex ? void 0 : STRING_TYPE);
27198
+ }
27199
+ const message = expr.args[messageIndex];
27200
+ if (!message) {
27201
+ return;
27202
+ }
27203
+ const messageType = this.inferType(message);
27204
+ if (messageType.kind !== "named" || messageType.name !== "string" && messageType.name !== "format_string") {
27205
+ this.report(`Argument ${messageIndex + 1} of '${expr.fn}' expects string or format_string, got ${this.typeToString(messageType)}`, message);
27206
+ }
27207
+ }
27208
+ checkInvokeExpr(expr) {
27209
+ this.checkExpr(expr.callee);
27210
+ const calleeType = this.inferType(expr.callee);
27211
+ if (calleeType.kind !== "function_type") {
27212
+ this.report("Attempted to call a non-function value", expr.callee);
27213
+ for (const arg of expr.args) {
27214
+ this.checkExpr(arg);
27215
+ }
27216
+ return;
27217
+ }
27218
+ this.checkFunctionCallArgs(expr.args, calleeType.params, "lambda", expr);
27219
+ }
27220
+ checkFunctionCallArgs(args, params, calleeName, node) {
27221
+ if (args.length !== params.length) {
27222
+ this.report(`Function '${calleeName}' expects ${params.length} arguments, got ${args.length}`, node);
27223
+ }
27224
+ for (let i = 0; i < args.length; i++) {
27225
+ const paramType = params[i];
27226
+ if (!paramType) {
27227
+ this.checkExpr(args[i]);
27228
+ continue;
27229
+ }
27230
+ this.checkExpr(args[i], paramType);
27231
+ const argType = this.inferType(args[i], paramType);
27232
+ if (!this.typesMatch(paramType, argType)) {
27233
+ this.report(`Argument ${i + 1} of '${calleeName}' expects ${this.typeToString(paramType)}, got ${this.typeToString(argType)}`, args[i]);
27234
+ }
27235
+ }
27236
+ }
27237
+ checkTpCall(expr) {
27238
+ const dest = expr.args[1];
27239
+ if (!dest) {
27240
+ return;
27241
+ }
27242
+ const destType = this.inferType(dest);
27243
+ if (destType.kind === "named" && destType.name === "BlockPos") {
27244
+ return;
27245
+ }
27246
+ if (dest.kind === "selector" && !dest.isSingle) {
27247
+ this.report("tp destination must be a single-entity selector (@s, @p, @r, or limit=1)", dest);
27248
+ }
27249
+ }
27250
+ checkMemberExpr(expr) {
27251
+ if (!(expr.obj.kind === "ident" && this.enums.has(expr.obj.name))) {
27252
+ this.checkExpr(expr.obj);
27253
+ }
27254
+ if (expr.obj.kind === "ident") {
27255
+ if (this.enums.has(expr.obj.name)) {
27256
+ const enumVariants = this.enums.get(expr.obj.name);
27257
+ if (!enumVariants.has(expr.field)) {
27258
+ this.report(`Enum '${expr.obj.name}' has no variant '${expr.field}'`, expr);
27259
+ }
27260
+ return;
27261
+ }
27262
+ const varSymbol = this.scope.get(expr.obj.name);
27263
+ const varType = varSymbol?.type;
27264
+ if (varType) {
27265
+ if (varType.kind === "struct") {
27266
+ const structFields = this.structs.get(varType.name);
27267
+ if (structFields && !structFields.has(expr.field)) {
27268
+ this.report(`Struct '${varType.name}' has no field '${expr.field}'`, expr);
27269
+ }
27270
+ } else if (varType.kind === "array") {
27271
+ if (expr.field !== "len" && expr.field !== "push" && expr.field !== "pop") {
27272
+ this.report(`Array has no field '${expr.field}'`, expr);
27273
+ }
27274
+ } else if (varType.kind === "named") {
27275
+ if (varType.name !== "void") {
27276
+ if (["int", "bool", "float", "fixed", "string", "byte", "short", "long", "double"].includes(varType.name)) {
27277
+ this.report(`Cannot access member '${expr.field}' on ${this.typeToString(varType)}`, expr);
27278
+ }
27279
+ }
27280
+ }
27281
+ }
27282
+ }
27283
+ }
27284
+ checkStaticCallExpr(expr) {
27285
+ if (expr.type === "Timer" && expr.method === "new") {
27286
+ if (this.loopDepth > 0) {
27287
+ this.report(`Timer::new() cannot be called inside a loop. Declare timers at the top level.`, expr);
27288
+ } else if (this.condDepth > 0) {
27289
+ this.report(`Timer::new() cannot be called inside an if/else body. Declare timers at the top level.`, expr);
27290
+ }
27291
+ }
27292
+ const method = this.implMethods.get(expr.type)?.get(expr.method);
27293
+ if (!method) {
27294
+ this.report(`Type '${expr.type}' has no static method '${expr.method}'`, expr);
27295
+ for (const arg of expr.args) {
27296
+ this.checkExpr(arg);
27297
+ }
27298
+ return;
27299
+ }
27300
+ if (method.params[0]?.name === "self") {
27301
+ this.report(`Method '${expr.type}::${expr.method}' is an instance method`, expr);
27302
+ return;
27303
+ }
27304
+ this.checkFunctionCallArgs(expr.args, method.params.map((param) => this.normalizeType(param.type)), `${expr.type}::${expr.method}`, expr);
27305
+ }
27306
+ checkLambdaExpr(expr, expectedType) {
27307
+ const normalizedExpected = expectedType ? this.normalizeType(expectedType) : void 0;
27308
+ const expectedFnType = normalizedExpected?.kind === "function_type" ? normalizedExpected : void 0;
27309
+ const lambdaType = this.inferLambdaType(expr, expectedFnType);
27310
+ if (expectedFnType && !this.typesMatch(expectedFnType, lambdaType)) {
27311
+ this.report(`Type mismatch: expected ${this.typeToString(expectedFnType)}, got ${this.typeToString(lambdaType)}`, expr);
27312
+ return;
27313
+ }
27314
+ const outerScope = this.scope;
27315
+ const outerReturnType = this.currentReturnType;
27316
+ const lambdaScope = new Map(this.scope);
27317
+ const paramTypes = expectedFnType?.params ?? lambdaType.params;
27318
+ for (let i = 0; i < expr.params.length; i++) {
27319
+ lambdaScope.set(expr.params[i].name, {
27320
+ type: paramTypes[i] ?? { kind: "named", name: "void" },
27321
+ mutable: true
27322
+ });
27323
+ }
27324
+ this.scope = lambdaScope;
27325
+ this.currentReturnType = expr.returnType ? this.normalizeType(expr.returnType) : expectedFnType?.return ?? lambdaType.return;
27326
+ if (Array.isArray(expr.body)) {
27327
+ this.checkBlock(expr.body);
27328
+ } else {
27329
+ this.checkExpr(expr.body, this.currentReturnType);
27330
+ const actualType = this.inferType(expr.body, this.currentReturnType);
27331
+ if (!this.typesMatch(this.currentReturnType, actualType)) {
27332
+ this.report(`Return type mismatch: expected ${this.typeToString(this.currentReturnType)}, got ${this.typeToString(actualType)}`, expr.body);
27333
+ }
27334
+ }
27335
+ this.scope = outerScope;
27336
+ this.currentReturnType = outerReturnType;
27337
+ }
27338
+ checkIfBranches(stmt) {
27339
+ const narrowed = this.getThenBranchNarrowing(stmt.cond);
27340
+ if (narrowed) {
27341
+ const thenScope = new Map(this.scope);
27342
+ thenScope.set(narrowed.name, { type: narrowed.type, mutable: narrowed.mutable });
27343
+ const outerScope = this.scope;
27344
+ this.scope = thenScope;
27345
+ this.checkBlock(stmt.then);
27346
+ this.scope = outerScope;
27347
+ } else {
27348
+ this.checkBlock(stmt.then);
27349
+ }
27350
+ if (stmt.else_) {
27351
+ this.checkBlock(stmt.else_);
27352
+ }
27353
+ }
27354
+ getThenBranchNarrowing(cond) {
27355
+ if (cond.kind !== "is_check" || cond.expr.kind !== "ident") {
27356
+ return null;
27357
+ }
27358
+ const symbol = this.scope.get(cond.expr.name);
27359
+ if (!symbol || symbol.type.kind !== "entity") {
27360
+ return null;
27361
+ }
27362
+ return {
27363
+ name: cond.expr.name,
27364
+ type: { kind: "entity", entityType: cond.entityType },
27365
+ mutable: symbol.mutable
27366
+ };
27367
+ }
27368
+ inferType(expr, expectedType) {
27369
+ switch (expr.kind) {
27370
+ case "int_lit":
27371
+ return { kind: "named", name: "int" };
27372
+ case "float_lit":
27373
+ return { kind: "named", name: "fixed" };
27374
+ case "byte_lit":
27375
+ return { kind: "named", name: "byte" };
27376
+ case "short_lit":
27377
+ return { kind: "named", name: "short" };
27378
+ case "long_lit":
27379
+ return { kind: "named", name: "long" };
27380
+ case "double_lit":
27381
+ return { kind: "named", name: "double" };
27382
+ case "bool_lit":
27383
+ return { kind: "named", name: "bool" };
27384
+ case "str_lit":
27385
+ case "mc_name":
27386
+ return { kind: "named", name: "string" };
27387
+ case "str_interp":
27388
+ for (const part of expr.parts) {
27389
+ if (typeof part !== "string") {
27390
+ this.checkExpr(part);
27391
+ }
27392
+ }
27393
+ return { kind: "named", name: "string" };
27394
+ case "f_string":
27395
+ for (const part of expr.parts) {
27396
+ if (part.kind === "expr") {
27397
+ this.checkExpr(part.expr);
27398
+ }
27399
+ }
27400
+ return FORMAT_STRING_TYPE;
27401
+ case "blockpos":
27402
+ return { kind: "named", name: "BlockPos" };
27403
+ case "ident":
27404
+ return this.scope.get(expr.name)?.type ?? { kind: "named", name: "void" };
27405
+ case "call": {
27406
+ const builtin = BUILTIN_SIGNATURES[expr.fn];
27407
+ if (builtin) {
27408
+ return builtin.return;
27409
+ }
27410
+ if (expr.fn === "__array_push") {
27411
+ return VOID_TYPE;
27412
+ }
27413
+ if (expr.fn === "__array_pop") {
27414
+ const target = expr.args[0];
27415
+ if (target && target.kind === "ident") {
27416
+ const targetType = this.scope.get(target.name)?.type;
27417
+ if (targetType?.kind === "array")
27418
+ return targetType.elem;
27419
+ }
27420
+ return INT_TYPE;
27421
+ }
27422
+ if (expr.fn === "bossbar_get_value") {
27423
+ return INT_TYPE;
27424
+ }
27425
+ if (expr.fn === "random_sequence") {
27426
+ return VOID_TYPE;
27427
+ }
27428
+ const varType = this.scope.get(expr.fn)?.type;
27429
+ if (varType?.kind === "function_type") {
27430
+ return varType.return;
27431
+ }
27432
+ const implMethod = this.resolveInstanceMethod(expr);
27433
+ if (implMethod) {
27434
+ return this.normalizeType(implMethod.returnType);
27435
+ }
27436
+ const fn = this.functions.get(expr.fn);
27437
+ if (fn) {
27438
+ if (fn.typeParams && fn.typeParams.length > 0) {
27439
+ return expectedType ?? INT_TYPE;
27440
+ }
27441
+ return this.normalizeType(fn.returnType);
27442
+ }
27443
+ return INT_TYPE;
27444
+ }
27445
+ case "static_call": {
27446
+ const method = this.implMethods.get(expr.type)?.get(expr.method);
27447
+ return method ? this.normalizeType(method.returnType) : { kind: "named", name: "void" };
27448
+ }
27449
+ case "invoke": {
27450
+ const calleeType = this.inferType(expr.callee);
27451
+ if (calleeType.kind === "function_type") {
27452
+ return calleeType.return;
27453
+ }
27454
+ return { kind: "named", name: "void" };
27455
+ }
27456
+ case "path_expr":
27457
+ if (this.enums.has(expr.enumName)) {
27458
+ return { kind: "enum", name: expr.enumName };
27459
+ }
27460
+ return { kind: "named", name: "void" };
27461
+ case "member":
27462
+ if (expr.obj.kind === "ident" && this.enums.has(expr.obj.name)) {
27463
+ return { kind: "enum", name: expr.obj.name };
27464
+ }
27465
+ if (expr.obj.kind === "ident") {
27466
+ const objTypeNode = this.scope.get(expr.obj.name)?.type;
27467
+ if (objTypeNode?.kind === "array" && expr.field === "len") {
27468
+ return { kind: "named", name: "int" };
27469
+ }
27470
+ }
27471
+ return { kind: "named", name: "void" };
27472
+ case "index": {
27473
+ const objType = this.inferType(expr.obj);
27474
+ if (objType.kind === "array")
27475
+ return objType.elem;
27476
+ return { kind: "named", name: "void" };
27477
+ }
27478
+ case "binary":
27479
+ if (["==", "!=", "<", "<=", ">", ">=", "&&", "||"].includes(expr.op)) {
27480
+ return { kind: "named", name: "bool" };
27481
+ }
27482
+ return this.inferType(expr.left);
27483
+ case "is_check":
27484
+ return { kind: "named", name: "bool" };
27485
+ case "unary":
27486
+ if (expr.op === "!")
27487
+ return { kind: "named", name: "bool" };
27488
+ return this.inferType(expr.operand);
27489
+ case "selector": {
27490
+ const entityType = this.inferEntityTypeFromSelector(expr.sel);
27491
+ return { kind: "selector", entityType: entityType ?? void 0 };
27492
+ }
27493
+ case "array_lit":
27494
+ if (expr.elements.length > 0) {
27495
+ return { kind: "array", elem: this.inferType(expr.elements[0]) };
27496
+ }
27497
+ return { kind: "array", elem: { kind: "named", name: "int" } };
27498
+ case "struct_lit":
27499
+ if (expectedType) {
27500
+ const normalized = this.normalizeType(expectedType);
27501
+ if (normalized.kind === "struct") {
27502
+ return normalized;
27503
+ }
27504
+ }
27505
+ return { kind: "named", name: "void" };
27506
+ case "tuple_lit":
27507
+ return {
27508
+ kind: "tuple",
27509
+ elements: expr.elements.map((e) => this.inferType(e))
27510
+ };
27511
+ case "some_lit": {
27512
+ const innerType = this.inferType(expr.value, expectedType?.kind === "option" ? expectedType.inner : void 0);
27513
+ return { kind: "option", inner: innerType };
27514
+ }
27515
+ case "none_lit": {
27516
+ if (expectedType?.kind === "option")
27517
+ return expectedType;
27518
+ return { kind: "option", inner: { kind: "named", name: "void" } };
27519
+ }
27520
+ case "type_cast":
27521
+ return this.normalizeType(expr.targetType);
27522
+ case "lambda":
27523
+ return this.inferLambdaType(expr, expectedType && this.normalizeType(expectedType).kind === "function_type" ? this.normalizeType(expectedType) : void 0);
27524
+ default:
27525
+ return { kind: "named", name: "void" };
27526
+ }
27527
+ }
27528
+ inferLambdaType(expr, expectedType) {
27529
+ const params = expr.params.map((param, index) => {
27530
+ if (param.type) {
27531
+ return this.normalizeType(param.type);
27532
+ }
27533
+ const inferred = expectedType?.params[index];
27534
+ if (inferred) {
27535
+ return inferred;
27536
+ }
27537
+ this.report(`Lambda parameter '${param.name}' requires a type annotation`, expr);
27538
+ return { kind: "named", name: "void" };
27539
+ });
27540
+ let returnType = expr.returnType ? this.normalizeType(expr.returnType) : expectedType?.return;
27541
+ if (!returnType) {
27542
+ returnType = Array.isArray(expr.body) ? { kind: "named", name: "void" } : this.inferType(expr.body);
27543
+ }
27544
+ return { kind: "function_type", params, return: returnType };
27545
+ }
27546
+ // ---------------------------------------------------------------------------
27547
+ // Entity Type Helpers
27548
+ // ---------------------------------------------------------------------------
27549
+ /** Infer entity type from a selector */
27550
+ inferEntityTypeFromSelector(selector) {
27551
+ if (selector.kind === "@a" || selector.kind === "@p" || selector.kind === "@r") {
27552
+ return "Player";
27553
+ }
27554
+ if (selector.filters?.type) {
27555
+ const mcType = selector.filters.type.toLowerCase();
27556
+ return MC_TYPE_TO_ENTITY[mcType] ?? "entity";
27557
+ }
27558
+ if (selector.kind === "@s") {
27559
+ return this.selfTypeStack[this.selfTypeStack.length - 1];
27560
+ }
27561
+ return "entity";
27562
+ }
27563
+ resolveInstanceMethod(expr) {
27564
+ const receiver = expr.args[0];
27565
+ if (!receiver) {
27566
+ return null;
27567
+ }
27568
+ const receiverType = this.inferType(receiver);
27569
+ if (receiverType.kind !== "struct") {
27570
+ return null;
27571
+ }
27572
+ const method = this.implMethods.get(receiverType.name)?.get(expr.fn);
27573
+ if (!method || method.params[0]?.name !== "self") {
27574
+ return null;
27575
+ }
27576
+ return method;
27577
+ }
27578
+ /** Check if childType is a subtype of parentType */
27579
+ isEntitySubtype(childType, parentType) {
27580
+ if (childType === parentType)
27581
+ return true;
27582
+ let current = childType;
27583
+ while (current !== null) {
27584
+ if (current === parentType)
27585
+ return true;
27586
+ current = ENTITY_HIERARCHY[current];
27587
+ }
27588
+ return false;
27589
+ }
27590
+ /** Push a new self type context */
27591
+ pushSelfType(entityType) {
27592
+ this.selfTypeStack.push(entityType);
27593
+ }
27594
+ /** Pop self type context */
27595
+ popSelfType() {
27596
+ if (this.selfTypeStack.length > 1) {
27597
+ this.selfTypeStack.pop();
27598
+ }
27599
+ }
27600
+ /** Get current @s type */
27601
+ getCurrentSelfType() {
27602
+ return this.selfTypeStack[this.selfTypeStack.length - 1];
27603
+ }
27604
+ /** Returns true if expected/actual are a numeric type mismatch (int vs float/fixed/double).
27605
+ * These pairs are NOT implicitly compatible — require explicit `as` cast.
27606
+ * Only int↔byte/short/long remain implicitly compatible (MC NBT narrowing). */
27607
+ isNumericMismatch(expected, actual) {
27608
+ if (expected.kind !== "named" || actual.kind !== "named")
27609
+ return false;
27610
+ const numericPairs = [
27611
+ ["int", "float"],
27612
+ ["float", "int"],
27613
+ ["int", "fixed"],
27614
+ ["fixed", "int"],
27615
+ ["int", "double"],
27616
+ ["double", "int"],
27617
+ ["float", "double"],
27618
+ ["double", "float"],
27619
+ ["fixed", "double"],
27620
+ ["double", "fixed"]
27621
+ // float and fixed are compatible (float is deprecated alias for fixed)
27622
+ ];
27623
+ return numericPairs.some(([e, a]) => expected.name === e && actual.name === a);
27624
+ }
27625
+ typesMatch(expected, actual) {
27626
+ if (expected.kind === "named" && expected.name === "int" && actual.kind === "enum") {
27627
+ return true;
27628
+ }
27629
+ if (expected.kind === "enum" && actual.kind === "named" && actual.name === "int") {
27630
+ return true;
27631
+ }
27632
+ if (expected.kind === "selector" && actual.kind === "entity") {
27633
+ return true;
27634
+ }
27635
+ if (expected.kind === "entity" && actual.kind === "selector") {
27636
+ return true;
27637
+ }
27638
+ if (expected.kind === "entity" && actual.kind === "entity") {
27639
+ return this.isEntitySubtype(actual.entityType, expected.entityType);
27640
+ }
27641
+ if (expected.kind === "selector" && actual.kind === "selector") {
27642
+ return true;
27643
+ }
27644
+ if (expected.kind !== actual.kind)
27645
+ return false;
27646
+ if (expected.kind === "named" && actual.kind === "named") {
27647
+ if (actual.name === "void")
27648
+ return true;
27649
+ if (expected.name === actual.name)
27650
+ return true;
27651
+ const floatFixed = (expected.name === "float" || expected.name === "fixed") && (actual.name === "float" || actual.name === "fixed");
27652
+ if (floatFixed)
27653
+ return true;
27654
+ const nbtNarrowing = [
27655
+ ["int", "byte"],
27656
+ ["byte", "int"],
27657
+ ["int", "short"],
27658
+ ["short", "int"],
27659
+ ["int", "long"],
27660
+ ["long", "int"]
27661
+ ];
27662
+ if (nbtNarrowing.some(([e, a]) => expected.name === e && actual.name === a))
27663
+ return true;
27664
+ return false;
27665
+ }
27666
+ if (expected.kind === "array" && actual.kind === "array") {
27667
+ return this.typesMatch(expected.elem, actual.elem);
27668
+ }
27669
+ if (expected.kind === "struct" && actual.kind === "struct") {
27670
+ return expected.name === actual.name;
27671
+ }
27672
+ if (expected.kind === "enum" && actual.kind === "enum") {
27673
+ return expected.name === actual.name;
27674
+ }
27675
+ if (expected.kind === "function_type" && actual.kind === "function_type") {
27676
+ return expected.params.length === actual.params.length && expected.params.every((param, index) => this.typesMatch(param, actual.params[index])) && this.typesMatch(expected.return, actual.return);
27677
+ }
27678
+ if (expected.kind === "tuple" && actual.kind === "tuple") {
27679
+ return expected.elements.length === actual.elements.length && expected.elements.every((elem, i) => this.typesMatch(elem, actual.elements[i]));
27680
+ }
27681
+ if (expected.kind === "option" && actual.kind === "option") {
27682
+ return this.typesMatch(expected.inner, actual.inner);
27683
+ }
27684
+ if (expected.kind === "option" && actual.kind === "named" && actual.name === "void") {
27685
+ return true;
27686
+ }
27687
+ return false;
27688
+ }
27689
+ typeToString(type) {
27690
+ switch (type.kind) {
27691
+ case "named":
27692
+ return type.name;
27693
+ case "array":
27694
+ return `${this.typeToString(type.elem)}[]`;
27695
+ case "struct":
27696
+ return type.name;
27697
+ case "enum":
27698
+ return type.name;
27699
+ case "function_type":
27700
+ return `(${type.params.map((param) => this.typeToString(param)).join(", ")}) -> ${this.typeToString(type.return)}`;
27701
+ case "entity":
27702
+ return type.entityType;
27703
+ case "selector":
27704
+ return "selector";
27705
+ case "tuple":
27706
+ return `(${type.elements.map((e) => this.typeToString(e)).join(", ")})`;
27707
+ case "option":
27708
+ return `Option<${this.typeToString(type.inner)}>`;
27709
+ default:
27710
+ return "unknown";
27711
+ }
27712
+ }
27713
+ normalizeType(type) {
27714
+ if (type.kind === "array") {
27715
+ return { kind: "array", elem: this.normalizeType(type.elem) };
27716
+ }
27717
+ if (type.kind === "option") {
27718
+ return { kind: "option", inner: this.normalizeType(type.inner) };
27719
+ }
27720
+ if (type.kind === "tuple") {
27721
+ return { kind: "tuple", elements: type.elements.map((e) => this.normalizeType(e)) };
27722
+ }
27723
+ if (type.kind === "function_type") {
27724
+ return {
27725
+ kind: "function_type",
27726
+ params: type.params.map((param) => this.normalizeType(param)),
27727
+ return: this.normalizeType(type.return)
27728
+ };
27729
+ }
27730
+ if ((type.kind === "struct" || type.kind === "enum") && this.enums.has(type.name)) {
27731
+ return { kind: "enum", name: type.name };
27732
+ }
27733
+ if (type.kind === "struct" && type.name in ENTITY_HIERARCHY) {
27734
+ return { kind: "entity", entityType: type.name };
27735
+ }
27736
+ if (type.kind === "named" && type.name in ENTITY_HIERARCHY) {
27737
+ return { kind: "entity", entityType: type.name };
27738
+ }
27739
+ return type;
27740
+ }
27741
+ };
27742
+ exports2.TypeChecker = TypeChecker;
27743
+ }
27744
+ });
27745
+
27746
+ // ../../dist/src/emit/compile.js
27747
+ var require_compile2 = __commonJS({
27748
+ "../../dist/src/emit/compile.js"(exports2) {
27749
+ "use strict";
27750
+ Object.defineProperty(exports2, "__esModule", { value: true });
27751
+ exports2.compile = compile;
27752
+ var lexer_1 = require_lexer();
27753
+ var parser_1 = require_parser();
27754
+ var compile_1 = require_compile();
27755
+ var diagnostics_1 = require_diagnostics();
27756
+ var lower_1 = require_lower();
27757
+ var monomorphize_1 = require_monomorphize();
27758
+ var lower_2 = require_lower2();
27759
+ var pipeline_1 = require_pipeline();
27760
+ var lower_3 = require_lower3();
27761
+ var pipeline_2 = require_pipeline2();
27762
+ var index_1 = require_emit();
27763
+ var coroutine_1 = require_coroutine();
27764
+ var budget_1 = require_budget();
27765
+ var mc_version_1 = require_mc_version();
27766
+ var typechecker_1 = require_typechecker();
27767
+ function compile(source, options = {}) {
27768
+ const { namespace = "redscript", filePath, generateSourceMap = false, mcVersion = mc_version_1.DEFAULT_MC_VERSION, lenient = false, includeDirs } = options;
27769
+ const warnings = [];
27770
+ const preprocessed = (0, compile_1.preprocessSourceWithMetadata)(source, { filePath, includeDirs });
27771
+ const processedSource = preprocessed.source;
27772
+ const lexer = new lexer_1.Lexer(processedSource);
27773
+ const tokens = lexer.tokenize();
27774
+ const parser = new parser_1.Parser(tokens, processedSource, filePath);
27775
+ const ast = parser.parse(namespace);
27776
+ warnings.push(...parser.warnings);
27777
+ for (const li of preprocessed.libraryImports ?? []) {
27778
+ const libPreprocessed = (0, compile_1.preprocessSourceWithMetadata)(li.source, { filePath: li.filePath });
27779
+ const libTokens = new lexer_1.Lexer(libPreprocessed.source, li.filePath).tokenize();
27780
+ const libParser = new parser_1.Parser(libTokens, libPreprocessed.source, li.filePath);
27781
+ const libAst = libParser.parse(namespace);
27782
+ warnings.push(...libParser.warnings);
27783
+ for (const fn of libAst.declarations)
27784
+ fn.isLibraryFn = true;
27785
+ ast.declarations.push(...libAst.declarations);
27786
+ ast.structs.push(...libAst.structs);
27787
+ ast.implBlocks.push(...libAst.implBlocks);
27788
+ ast.enums.push(...libAst.enums);
27789
+ ast.consts.push(...libAst.consts);
27790
+ ast.globals.push(...libAst.globals);
27791
+ }
27792
+ if (options.librarySources) {
27793
+ for (const libSrc of options.librarySources) {
27794
+ const libTokens = new lexer_1.Lexer(libSrc).tokenize();
27795
+ const libAst = new parser_1.Parser(libTokens, libSrc).parse(namespace);
27796
+ for (const fn of libAst.declarations)
27797
+ fn.isLibraryFn = true;
27798
+ ast.declarations.push(...libAst.declarations);
27799
+ ast.structs.push(...libAst.structs);
27800
+ ast.implBlocks.push(...libAst.implBlocks);
27801
+ ast.enums.push(...libAst.enums);
27802
+ ast.consts.push(...libAst.consts);
27803
+ ast.globals.push(...libAst.globals);
27804
+ }
27805
+ }
27806
+ {
27807
+ const checker = new typechecker_1.TypeChecker(processedSource, filePath);
27808
+ const typeErrors = checker.check(ast);
27809
+ warnings.push(...checker.getWarnings());
27810
+ if (typeErrors.length > 0) {
27811
+ if (lenient) {
27812
+ for (const e of typeErrors) {
27813
+ warnings.push(`[TypeError] line ${e.location.line}, col ${e.location.col}: ${e.message}`);
27814
+ }
27815
+ } else {
27816
+ throw typeErrors[0];
27817
+ }
27818
+ }
27819
+ }
27820
+ try {
27821
+ const hirRaw = (0, lower_1.lowerToHIR)(ast);
25349
27822
  const hir = (0, monomorphize_1.monomorphize)(hirRaw);
25350
27823
  const tickFunctions = [];
25351
27824
  const loadFunctions = [];
25352
27825
  const coroutineInfos = [];
27826
+ const scheduleFunctions = [];
25353
27827
  for (const fn of hir.functions) {
25354
27828
  for (const dec of fn.decorators) {
25355
27829
  if (dec.name === "tick")
@@ -25363,6 +27837,9 @@ var require_compile2 = __commonJS({
25363
27837
  onDone: dec.args?.onDone
25364
27838
  });
25365
27839
  }
27840
+ if (dec.name === "schedule") {
27841
+ scheduleFunctions.push({ name: fn.name, ticks: dec.args?.ticks ?? 1 });
27842
+ }
25366
27843
  }
25367
27844
  }
25368
27845
  const mir = (0, lower_2.lowerToMIR)(hir, filePath);
@@ -25370,6 +27847,7 @@ var require_compile2 = __commonJS({
25370
27847
  const coroResult = (0, coroutine_1.coroutineTransform)(mirOpt, coroutineInfos);
25371
27848
  const mirFinal = coroResult.module;
25372
27849
  tickFunctions.push(...coroResult.generatedTickFunctions);
27850
+ warnings.push(...coroResult.warnings);
25373
27851
  const lir = (0, lower_3.lowerToLIR)(mirFinal);
25374
27852
  const lirOpt = (0, pipeline_2.lirOptimizeModule)(lir);
25375
27853
  const coroutineNames = new Set(coroutineInfos.map((c) => c.fnName));
@@ -25380,7 +27858,16 @@ var require_compile2 = __commonJS({
25380
27858
  }
25381
27859
  warnings.push(diag.message);
25382
27860
  }
25383
- const files = (0, index_1.emit)(lirOpt, { namespace, tickFunctions, loadFunctions, generateSourceMap });
27861
+ const INT32_MAX = 2147483647;
27862
+ const INT32_MIN = -2147483648;
27863
+ for (const fn of lirOpt.functions) {
27864
+ for (const instr of fn.instructions) {
27865
+ if (instr.kind === "score_set" && (instr.value > INT32_MAX || instr.value < INT32_MIN)) {
27866
+ warnings.push(`[ConstantOverflow] function '${fn.name}': scoreboard immediate ${instr.value} is outside MC int32 range [${INT32_MIN}, ${INT32_MAX}]. This indicates a constant-folding overflow bug \u2014 please report this.`);
27867
+ }
27868
+ }
27869
+ }
27870
+ const files = (0, index_1.emit)(lirOpt, { namespace, tickFunctions, loadFunctions, scheduleFunctions, generateSourceMap, mcVersion });
25384
27871
  return { files, warnings, success: true };
25385
27872
  } catch (err) {
25386
27873
  if (err instanceof diagnostics_1.DiagnosticError)
@@ -25392,6 +27879,419 @@ var require_compile2 = __commonJS({
25392
27879
  }
25393
27880
  });
25394
27881
 
27882
+ // ../../dist/src/emit/modules.js
27883
+ var require_modules = __commonJS({
27884
+ "../../dist/src/emit/modules.js"(exports2) {
27885
+ "use strict";
27886
+ Object.defineProperty(exports2, "__esModule", { value: true });
27887
+ exports2.compileModules = compileModules;
27888
+ var lexer_1 = require_lexer();
27889
+ var parser_1 = require_parser();
27890
+ var diagnostics_1 = require_diagnostics();
27891
+ var lower_1 = require_lower();
27892
+ var monomorphize_1 = require_monomorphize();
27893
+ var lower_2 = require_lower2();
27894
+ var pipeline_1 = require_pipeline();
27895
+ var lower_3 = require_lower3();
27896
+ var pipeline_2 = require_pipeline2();
27897
+ var index_1 = require_emit();
27898
+ var coroutine_1 = require_coroutine();
27899
+ function compileModules(modules, options = {}) {
27900
+ const namespace = options.namespace ?? "redscript";
27901
+ const warnings = [];
27902
+ if (modules.length === 0) {
27903
+ throw new diagnostics_1.DiagnosticError("LoweringError", "No modules provided", { line: 1, col: 1 });
27904
+ }
27905
+ const parsedModules = /* @__PURE__ */ new Map();
27906
+ for (const mod of modules) {
27907
+ const lexer = new lexer_1.Lexer(mod.source, mod.filePath);
27908
+ const tokens = lexer.tokenize();
27909
+ const parser = new parser_1.Parser(tokens, mod.source, mod.filePath);
27910
+ const ast = parser.parse(namespace);
27911
+ const declaredName = ast.moduleName;
27912
+ if (declaredName && declaredName !== mod.name) {
27913
+ throw new diagnostics_1.DiagnosticError("LoweringError", `Module declares name '${declaredName}' but was registered as '${mod.name}'`, { file: mod.filePath, line: 1, col: 1 });
27914
+ }
27915
+ parsedModules.set(mod.name, ast);
27916
+ }
27917
+ const exportTable = /* @__PURE__ */ new Map();
27918
+ for (const [modName, ast] of parsedModules) {
27919
+ const exports3 = /* @__PURE__ */ new Set();
27920
+ for (const fn of ast.declarations) {
27921
+ if (fn.isExported)
27922
+ exports3.add(fn.name);
27923
+ }
27924
+ exportTable.set(modName, exports3);
27925
+ }
27926
+ detectCircularImports(parsedModules);
27927
+ const importMap = /* @__PURE__ */ new Map();
27928
+ for (const [modName, ast] of parsedModules) {
27929
+ const resolved = /* @__PURE__ */ new Map();
27930
+ for (const imp of ast.imports) {
27931
+ const sourceExports = exportTable.get(imp.moduleName);
27932
+ if (!sourceExports) {
27933
+ throw new diagnostics_1.DiagnosticError("LoweringError", `Module '${imp.moduleName}' not found (imported in '${modName}')`, { file: ast.namespace, line: 1, col: 1 });
27934
+ }
27935
+ if (imp.symbol === "*") {
27936
+ for (const sym of sourceExports) {
27937
+ resolved.set(sym, `${imp.moduleName}/${sym}`);
27938
+ }
27939
+ } else {
27940
+ if (!sourceExports.has(imp.symbol)) {
27941
+ throw new diagnostics_1.DiagnosticError("LoweringError", `Module '${imp.moduleName}' does not export '${imp.symbol}'`, { line: 1, col: 1 });
27942
+ }
27943
+ resolved.set(imp.symbol, `${imp.moduleName}/${imp.symbol}`);
27944
+ }
27945
+ }
27946
+ importMap.set(modName, resolved);
27947
+ }
27948
+ const usedExports = /* @__PURE__ */ new Map();
27949
+ for (const modName of parsedModules.keys()) {
27950
+ usedExports.set(modName, /* @__PURE__ */ new Set());
27951
+ }
27952
+ for (const ast of parsedModules.values()) {
27953
+ for (const imp of ast.imports) {
27954
+ const used = usedExports.get(imp.moduleName);
27955
+ if (!used)
27956
+ continue;
27957
+ if (imp.symbol === "*") {
27958
+ const exports3 = exportTable.get(imp.moduleName);
27959
+ if (exports3)
27960
+ for (const s of exports3)
27961
+ used.add(s);
27962
+ } else {
27963
+ used.add(imp.symbol);
27964
+ }
27965
+ }
27966
+ }
27967
+ const allFiles = [];
27968
+ const libraryFilePaths = /* @__PURE__ */ new Set();
27969
+ let packMetaEmitted = false;
27970
+ for (const mod of modules) {
27971
+ const ast = parsedModules.get(mod.name);
27972
+ const symbolMap = importMap.get(mod.name) ?? /* @__PURE__ */ new Map();
27973
+ const isNamed = !!ast.moduleName;
27974
+ if (symbolMap.size > 0) {
27975
+ rewriteCallsInProgram(ast, symbolMap);
27976
+ }
27977
+ const unusedExportedFns = /* @__PURE__ */ new Set();
27978
+ if (isNamed) {
27979
+ const used = usedExports.get(mod.name) ?? /* @__PURE__ */ new Set();
27980
+ for (const fn of ast.declarations) {
27981
+ fn.name = `${mod.name}/${fn.name}`;
27982
+ const baseName = fn.name.split("/").pop();
27983
+ if (fn.isExported && !used.has(baseName)) {
27984
+ unusedExportedFns.add(fn.name);
27985
+ }
27986
+ }
27987
+ }
27988
+ const objective = isNamed ? `__${namespace}_${mod.name}` : `__${namespace}`;
27989
+ const modFiles = compileSingleModule(ast, namespace, objective, isNamed ? mod.name : void 0, mod.filePath);
27990
+ warnings.push(...modFiles.warnings);
27991
+ if (modules.length > 1) {
27992
+ for (const fnName of unusedExportedFns) {
27993
+ libraryFilePaths.add(`data/${namespace}/function/${fnName}.mcfunction`);
27994
+ }
27995
+ }
27996
+ for (const file of modFiles.files) {
27997
+ if (file.path === "pack.mcmeta") {
27998
+ if (!packMetaEmitted) {
27999
+ allFiles.push(file);
28000
+ packMetaEmitted = true;
28001
+ }
28002
+ continue;
28003
+ }
28004
+ if (file.path === "data/minecraft/tags/function/load.json") {
28005
+ mergeTagFile(allFiles, file);
28006
+ continue;
28007
+ }
28008
+ if (file.path === "data/minecraft/tags/function/tick.json") {
28009
+ mergeTagFile(allFiles, file);
28010
+ continue;
28011
+ }
28012
+ allFiles.push(file);
28013
+ }
28014
+ }
28015
+ const finalFiles = crossModuleDCE(allFiles, libraryFilePaths, namespace);
28016
+ return { files: finalFiles, warnings };
28017
+ }
28018
+ function crossModuleDCE(files, libraryPaths, namespace) {
28019
+ if (libraryPaths.size === 0)
28020
+ return files;
28021
+ const fnPathToFilePath = /* @__PURE__ */ new Map();
28022
+ for (const file of files) {
28023
+ const m = file.path.match(/^data\/([^/]+)\/function\/(.+)\.mcfunction$/);
28024
+ if (m) {
28025
+ fnPathToFilePath.set(`${m[1]}:${m[2]}`, file.path);
28026
+ }
28027
+ }
28028
+ const callGraph = /* @__PURE__ */ new Map();
28029
+ const callPattern = /\bfunction\s+([\w\-]+:[\w\-./]+)/g;
28030
+ for (const file of files) {
28031
+ if (!file.path.endsWith(".mcfunction"))
28032
+ continue;
28033
+ const called = /* @__PURE__ */ new Set();
28034
+ let match;
28035
+ callPattern.lastIndex = 0;
28036
+ while ((match = callPattern.exec(file.content)) !== null) {
28037
+ called.add(match[1]);
28038
+ }
28039
+ callGraph.set(file.path, called);
28040
+ }
28041
+ const reachableFiles = /* @__PURE__ */ new Set();
28042
+ const queue = [];
28043
+ for (const file of files) {
28044
+ if (!file.path.endsWith(".mcfunction"))
28045
+ continue;
28046
+ if (!libraryPaths.has(file.path)) {
28047
+ queue.push(file.path);
28048
+ reachableFiles.add(file.path);
28049
+ }
28050
+ }
28051
+ while (queue.length > 0) {
28052
+ const current = queue.shift();
28053
+ const called = callGraph.get(current) ?? /* @__PURE__ */ new Set();
28054
+ for (const fnPath of called) {
28055
+ const filePath = fnPathToFilePath.get(fnPath);
28056
+ if (filePath && !reachableFiles.has(filePath)) {
28057
+ reachableFiles.add(filePath);
28058
+ queue.push(filePath);
28059
+ }
28060
+ }
28061
+ }
28062
+ return files.filter((file) => {
28063
+ if (!libraryPaths.has(file.path))
28064
+ return true;
28065
+ return reachableFiles.has(file.path);
28066
+ });
28067
+ }
28068
+ function compileSingleModule(ast, namespace, objective, moduleName, filePath) {
28069
+ const warnings = [];
28070
+ try {
28071
+ const hirRaw = (0, lower_1.lowerToHIR)(ast);
28072
+ const hir = (0, monomorphize_1.monomorphize)(hirRaw);
28073
+ const tickFunctions = [];
28074
+ const loadFunctions = [];
28075
+ const coroutineInfos = [];
28076
+ const scheduleFunctions = [];
28077
+ for (const fn of hir.functions) {
28078
+ for (const dec of fn.decorators) {
28079
+ if (dec.name === "tick")
28080
+ tickFunctions.push(fn.name);
28081
+ if (dec.name === "load")
28082
+ loadFunctions.push(fn.name);
28083
+ if (dec.name === "coroutine") {
28084
+ coroutineInfos.push({ fnName: fn.name, batch: dec.args?.batch ?? 10, onDone: dec.args?.onDone });
28085
+ }
28086
+ if (dec.name === "schedule") {
28087
+ scheduleFunctions.push({ name: fn.name, ticks: dec.args?.ticks ?? 1 });
28088
+ }
28089
+ }
28090
+ }
28091
+ const mir = (0, lower_2.lowerToMIR)(hir, filePath);
28092
+ mir.objective = objective;
28093
+ const mirOpt = (0, pipeline_1.optimizeModule)(mir);
28094
+ const coroResult = (0, coroutine_1.coroutineTransform)(mirOpt, coroutineInfos);
28095
+ const mirFinal = coroResult.module;
28096
+ tickFunctions.push(...coroResult.generatedTickFunctions);
28097
+ const lir = (0, lower_3.lowerToLIR)(mirFinal);
28098
+ lir.objective = objective;
28099
+ const lirOpt = (0, pipeline_2.lirOptimizeModule)(lir);
28100
+ const files = (0, index_1.emit)(lirOpt, { namespace, tickFunctions, loadFunctions, scheduleFunctions });
28101
+ if (moduleName) {
28102
+ const loadPath = `data/${namespace}/function/load.mcfunction`;
28103
+ const newLoadPath = `data/${namespace}/function/${moduleName}/_load.mcfunction`;
28104
+ const loadTagPath = "data/minecraft/tags/function/load.json";
28105
+ for (const file of files) {
28106
+ if (file.path === loadPath) {
28107
+ file.path = newLoadPath;
28108
+ } else if (file.path === loadTagPath) {
28109
+ const tag = JSON.parse(file.content);
28110
+ tag.values = tag.values.map((v) => v === `${namespace}:load` ? `${namespace}:${moduleName}/_load` : v);
28111
+ file.content = JSON.stringify(tag, null, 2) + "\n";
28112
+ }
28113
+ }
28114
+ }
28115
+ return { files, warnings };
28116
+ } catch (err) {
28117
+ if (err instanceof diagnostics_1.DiagnosticError)
28118
+ throw err;
28119
+ throw err;
28120
+ }
28121
+ }
28122
+ function mergeTagFile(files, newFile) {
28123
+ const existing = files.find((f) => f.path === newFile.path);
28124
+ if (!existing) {
28125
+ files.push(newFile);
28126
+ return;
28127
+ }
28128
+ const existingJson = JSON.parse(existing.content);
28129
+ const newJson = JSON.parse(newFile.content);
28130
+ existingJson.values.push(...newJson.values);
28131
+ existing.content = JSON.stringify(existingJson, null, 2) + "\n";
28132
+ }
28133
+ function detectCircularImports(parsedModules) {
28134
+ const visited = /* @__PURE__ */ new Set();
28135
+ const inStack = /* @__PURE__ */ new Set();
28136
+ function dfs(modName, stack) {
28137
+ if (inStack.has(modName)) {
28138
+ const cycle = [...stack.slice(stack.indexOf(modName)), modName];
28139
+ throw new diagnostics_1.DiagnosticError("LoweringError", `Circular import detected: ${cycle.join(" \u2192 ")}`, { line: 1, col: 1 });
28140
+ }
28141
+ if (visited.has(modName))
28142
+ return;
28143
+ visited.add(modName);
28144
+ inStack.add(modName);
28145
+ const ast = parsedModules.get(modName);
28146
+ if (ast) {
28147
+ for (const imp of ast.imports) {
28148
+ dfs(imp.moduleName, [...stack, modName]);
28149
+ }
28150
+ }
28151
+ inStack.delete(modName);
28152
+ }
28153
+ for (const modName of parsedModules.keys()) {
28154
+ dfs(modName, []);
28155
+ }
28156
+ }
28157
+ function rewriteCallsInProgram(program, symbolMap) {
28158
+ for (const fn of program.declarations) {
28159
+ rewriteBlock(fn.body, symbolMap);
28160
+ }
28161
+ for (const ib of program.implBlocks) {
28162
+ for (const m of ib.methods) {
28163
+ rewriteBlock(m.body, symbolMap);
28164
+ }
28165
+ }
28166
+ }
28167
+ function rewriteBlock(block, symbolMap) {
28168
+ for (const stmt of block) {
28169
+ rewriteStmt(stmt, symbolMap);
28170
+ }
28171
+ }
28172
+ function rewriteStmt(stmt, symbolMap) {
28173
+ switch (stmt.kind) {
28174
+ case "let":
28175
+ case "expr":
28176
+ rewriteExpr(stmt.kind === "let" ? stmt.init : stmt.expr, symbolMap);
28177
+ break;
28178
+ case "return":
28179
+ if (stmt.value)
28180
+ rewriteExpr(stmt.value, symbolMap);
28181
+ break;
28182
+ case "if":
28183
+ rewriteExpr(stmt.cond, symbolMap);
28184
+ rewriteBlock(stmt.then, symbolMap);
28185
+ if (stmt.else_)
28186
+ rewriteBlock(stmt.else_, symbolMap);
28187
+ break;
28188
+ case "while":
28189
+ rewriteExpr(stmt.cond, symbolMap);
28190
+ rewriteBlock(stmt.body, symbolMap);
28191
+ break;
28192
+ case "for":
28193
+ if (stmt.init)
28194
+ rewriteStmt(stmt.init, symbolMap);
28195
+ rewriteExpr(stmt.cond, symbolMap);
28196
+ rewriteExpr(stmt.step, symbolMap);
28197
+ rewriteBlock(stmt.body, symbolMap);
28198
+ break;
28199
+ case "for_range":
28200
+ rewriteExpr(stmt.start, symbolMap);
28201
+ rewriteExpr(stmt.end, symbolMap);
28202
+ rewriteBlock(stmt.body, symbolMap);
28203
+ break;
28204
+ case "foreach":
28205
+ rewriteExpr(stmt.iterable, symbolMap);
28206
+ rewriteBlock(stmt.body, symbolMap);
28207
+ break;
28208
+ case "match":
28209
+ rewriteExpr(stmt.expr, symbolMap);
28210
+ for (const arm of stmt.arms) {
28211
+ if (arm.pattern)
28212
+ rewriteExpr(arm.pattern, symbolMap);
28213
+ rewriteBlock(arm.body, symbolMap);
28214
+ }
28215
+ break;
28216
+ case "as_block":
28217
+ case "at_block":
28218
+ rewriteBlock(stmt.body, symbolMap);
28219
+ break;
28220
+ case "as_at":
28221
+ rewriteBlock(stmt.body, symbolMap);
28222
+ break;
28223
+ case "execute":
28224
+ rewriteBlock(stmt.body, symbolMap);
28225
+ break;
28226
+ case "let_destruct":
28227
+ rewriteExpr(stmt.init, symbolMap);
28228
+ break;
28229
+ }
28230
+ }
28231
+ function rewriteExpr(expr, symbolMap) {
28232
+ switch (expr.kind) {
28233
+ case "call": {
28234
+ const remapped = symbolMap.get(expr.fn);
28235
+ if (remapped) {
28236
+ ;
28237
+ expr.fn = remapped;
28238
+ }
28239
+ for (const arg of expr.args)
28240
+ rewriteExpr(arg, symbolMap);
28241
+ break;
28242
+ }
28243
+ case "assign":
28244
+ rewriteExpr(expr.value, symbolMap);
28245
+ break;
28246
+ case "binary":
28247
+ rewriteExpr(expr.left, symbolMap);
28248
+ rewriteExpr(expr.right, symbolMap);
28249
+ break;
28250
+ case "unary":
28251
+ rewriteExpr(expr.operand, symbolMap);
28252
+ break;
28253
+ case "member":
28254
+ rewriteExpr(expr.obj, symbolMap);
28255
+ break;
28256
+ case "member_assign":
28257
+ rewriteExpr(expr.obj, symbolMap);
28258
+ rewriteExpr(expr.value, symbolMap);
28259
+ break;
28260
+ case "index":
28261
+ rewriteExpr(expr.obj, symbolMap);
28262
+ rewriteExpr(expr.index, symbolMap);
28263
+ break;
28264
+ case "index_assign":
28265
+ rewriteExpr(expr.obj, symbolMap);
28266
+ rewriteExpr(expr.index, symbolMap);
28267
+ rewriteExpr(expr.value, symbolMap);
28268
+ break;
28269
+ case "array_lit":
28270
+ for (const el of expr.elements)
28271
+ rewriteExpr(el, symbolMap);
28272
+ break;
28273
+ case "struct_lit":
28274
+ for (const f of expr.fields)
28275
+ rewriteExpr(f.value, symbolMap);
28276
+ break;
28277
+ case "invoke":
28278
+ rewriteExpr(expr.callee, symbolMap);
28279
+ for (const arg of expr.args)
28280
+ rewriteExpr(arg, symbolMap);
28281
+ break;
28282
+ case "tuple_lit":
28283
+ for (const el of expr.elements)
28284
+ rewriteExpr(el, symbolMap);
28285
+ break;
28286
+ case "static_call":
28287
+ for (const arg of expr.args)
28288
+ rewriteExpr(arg, symbolMap);
28289
+ break;
28290
+ }
28291
+ }
28292
+ }
28293
+ });
28294
+
25395
28295
  // ../../dist/src/mc-validator/index.js
25396
28296
  var require_mc_validator = __commonJS({
25397
28297
  "../../dist/src/mc-validator/index.js"(exports2) {
@@ -26165,7 +29065,7 @@ var require_src = __commonJS({
26165
29065
  "../../dist/src/index.js"(exports2) {
26166
29066
  "use strict";
26167
29067
  Object.defineProperty(exports2, "__esModule", { value: true });
26168
- exports2.resetCompileCache = exports2.compileIncremental = exports2.parseImports = exports2.DependencyGraph = exports2.hashFile = exports2.FileCache = exports2.MCCommandValidator = exports2.preprocessSourceWithMetadata = exports2.preprocessSource = exports2.Parser = exports2.Lexer = exports2.compile = exports2.version = void 0;
29068
+ exports2.resetCompileCache = exports2.compileIncremental = exports2.parseImports = exports2.DependencyGraph = exports2.hashFile = exports2.FileCache = exports2.MCCommandValidator = exports2.preprocessSourceWithMetadata = exports2.preprocessSource = exports2.Parser = exports2.Lexer = exports2.DEFAULT_MC_VERSION = exports2.compareMcVersion = exports2.parseMcVersion = exports2.McVersion = exports2.compileModules = exports2.compile = exports2.version = void 0;
26169
29069
  exports2.check = check;
26170
29070
  exports2.checkWithWarnings = checkWithWarnings;
26171
29071
  exports2.version = "2.0.0";
@@ -26174,6 +29074,23 @@ var require_src = __commonJS({
26174
29074
  Object.defineProperty(exports2, "compile", { enumerable: true, get: function() {
26175
29075
  return compile_2.compile;
26176
29076
  } });
29077
+ var modules_1 = require_modules();
29078
+ Object.defineProperty(exports2, "compileModules", { enumerable: true, get: function() {
29079
+ return modules_1.compileModules;
29080
+ } });
29081
+ var mc_version_1 = require_mc_version();
29082
+ Object.defineProperty(exports2, "McVersion", { enumerable: true, get: function() {
29083
+ return mc_version_1.McVersion;
29084
+ } });
29085
+ Object.defineProperty(exports2, "parseMcVersion", { enumerable: true, get: function() {
29086
+ return mc_version_1.parseMcVersion;
29087
+ } });
29088
+ Object.defineProperty(exports2, "compareMcVersion", { enumerable: true, get: function() {
29089
+ return mc_version_1.compareMcVersion;
29090
+ } });
29091
+ Object.defineProperty(exports2, "DEFAULT_MC_VERSION", { enumerable: true, get: function() {
29092
+ return mc_version_1.DEFAULT_MC_VERSION;
29093
+ } });
26177
29094
  var lexer_1 = require_lexer();
26178
29095
  Object.defineProperty(exports2, "Lexer", { enumerable: true, get: function() {
26179
29096
  return lexer_1.Lexer;