kumi 0.0.31 → 0.0.33

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 (294) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -1
  3. data/README.md +31 -99
  4. data/data/kernels/ruby/core/arithmetic.yaml +2 -2
  5. data/docs/COMPOSED_SCHEMAS.md +137 -0
  6. data/docs/SCHEMA_IMPORTS.md +275 -0
  7. data/docs/SYNTAX.md +48 -0
  8. data/golden/array_element/expected/schema_ruby.rb +2 -27
  9. data/golden/array_index/expected/nast.txt +6 -6
  10. data/golden/array_index/expected/schema_ruby.rb +4 -31
  11. data/golden/array_operations/expected/lir_06_const_prop.txt +4 -8
  12. data/golden/array_operations/expected/schema_javascript.mjs +4 -8
  13. data/golden/array_operations/expected/schema_ruby.rb +10 -43
  14. data/golden/cascade_logic/expected/lir_06_const_prop.txt +7 -14
  15. data/golden/cascade_logic/expected/schema_javascript.mjs +7 -14
  16. data/golden/cascade_logic/expected/schema_ruby.rb +11 -45
  17. data/golden/chained_fusion/expected/lir_06_const_prop.txt +8 -18
  18. data/golden/chained_fusion/expected/schema_javascript.mjs +8 -18
  19. data/golden/chained_fusion/expected/schema_ruby.rb +14 -53
  20. data/golden/decimal_explicit/expected/schema_ruby.rb +4 -31
  21. data/golden/element_arrays/expected/lir_06_const_prop.txt +5 -11
  22. data/golden/element_arrays/expected/schema_javascript.mjs +5 -11
  23. data/golden/element_arrays/expected/schema_ruby.rb +13 -50
  24. data/golden/empty_and_null_inputs/expected/schema_ruby.rb +4 -31
  25. data/golden/example_xpto/expected/ast.txt +23 -0
  26. data/golden/example_xpto/expected/input_plan.txt +1 -0
  27. data/golden/example_xpto/expected/lir_00_unoptimized.txt +16 -0
  28. data/golden/example_xpto/expected/lir_01_hoist_scalar_references.txt +16 -0
  29. data/golden/example_xpto/expected/lir_02_inlined.txt +16 -0
  30. data/golden/example_xpto/expected/lir_03_cse.txt +16 -0
  31. data/golden/example_xpto/expected/lir_04_1_loop_fusion.txt +16 -0
  32. data/golden/example_xpto/expected/lir_04_loop_invcm.txt +16 -0
  33. data/golden/example_xpto/expected/lir_06_const_prop.txt +13 -0
  34. data/golden/example_xpto/expected/nast.txt +17 -0
  35. data/golden/example_xpto/expected/schema_javascript.mjs +13 -0
  36. data/golden/example_xpto/expected/schema_ruby.rb +13 -0
  37. data/golden/example_xpto/expected/snast.txt +17 -0
  38. data/golden/example_xpto/expected.json +4 -0
  39. data/golden/example_xpto/input.json +3 -0
  40. data/golden/example_xpto/schema.kumi +8 -0
  41. data/golden/function_overload/expected/schema_ruby.rb +2 -27
  42. data/golden/game_of_life/expected/lir_06_const_prop.txt +236 -287
  43. data/golden/game_of_life/expected/schema_javascript.mjs +32 -39
  44. data/golden/game_of_life/expected/schema_ruby.rb +34 -66
  45. data/golden/hash_keys/expected/lir_06_const_prop.txt +4 -10
  46. data/golden/hash_keys/expected/schema_javascript.mjs +6 -12
  47. data/golden/hash_keys/expected/schema_ruby.rb +8 -39
  48. data/golden/hash_value/expected/lir_06_const_prop.txt +3 -6
  49. data/golden/hash_value/expected/schema_javascript.mjs +3 -6
  50. data/golden/hash_value/expected/schema_ruby.rb +7 -37
  51. data/golden/hierarchical_complex/expected/lir_06_const_prop.txt +9 -18
  52. data/golden/hierarchical_complex/expected/schema_javascript.mjs +9 -18
  53. data/golden/hierarchical_complex/expected/schema_ruby.rb +14 -51
  54. data/golden/inline_rename_scope_leak/expected/lir_06_const_prop.txt +2 -6
  55. data/golden/inline_rename_scope_leak/expected/schema_javascript.mjs +2 -6
  56. data/golden/inline_rename_scope_leak/expected/schema_ruby.rb +7 -39
  57. data/golden/input_reference/expected/schema_ruby.rb +6 -35
  58. data/golden/interleaved_fusion/expected/lir_06_const_prop.txt +6 -14
  59. data/golden/interleaved_fusion/expected/schema_javascript.mjs +6 -14
  60. data/golden/interleaved_fusion/expected/schema_ruby.rb +11 -47
  61. data/golden/let_inline/expected/lir_06_const_prop.txt +1 -2
  62. data/golden/let_inline/expected/schema_javascript.mjs +1 -2
  63. data/golden/let_inline/expected/schema_ruby.rb +3 -29
  64. data/golden/loop_fusion/expected/lir_06_const_prop.txt +4 -10
  65. data/golden/loop_fusion/expected/schema_javascript.mjs +4 -10
  66. data/golden/loop_fusion/expected/schema_ruby.rb +8 -41
  67. data/golden/min_reduce_scope/expected/lir_06_const_prop.txt +3 -6
  68. data/golden/min_reduce_scope/expected/schema_javascript.mjs +3 -6
  69. data/golden/min_reduce_scope/expected/schema_ruby.rb +8 -39
  70. data/golden/mixed_dimensions/expected/lir_06_const_prop.txt +1 -2
  71. data/golden/mixed_dimensions/expected/schema_javascript.mjs +1 -2
  72. data/golden/mixed_dimensions/expected/schema_ruby.rb +5 -33
  73. data/golden/multirank_hoisting/expected/lir_06_const_prop.txt +9 -18
  74. data/golden/multirank_hoisting/expected/schema_javascript.mjs +9 -18
  75. data/golden/multirank_hoisting/expected/schema_ruby.rb +16 -55
  76. data/golden/nested_hash/expected/lir_06_const_prop.txt +1 -2
  77. data/golden/nested_hash/expected/schema_javascript.mjs +1 -2
  78. data/golden/nested_hash/expected/schema_ruby.rb +3 -29
  79. data/golden/reduction_broadcast/expected/schema_ruby.rb +5 -33
  80. data/golden/roll/expected/lir_06_const_prop.txt +8 -15
  81. data/golden/roll/expected/schema_javascript.mjs +8 -15
  82. data/golden/roll/expected/schema_ruby.rb +13 -48
  83. data/golden/schema_imports_broadcasting_with_imports/expected/ast.txt +26 -0
  84. data/golden/schema_imports_broadcasting_with_imports/expected/input_plan.txt +5 -0
  85. data/golden/schema_imports_broadcasting_with_imports/expected/lir_00_unoptimized.txt +20 -0
  86. data/golden/schema_imports_broadcasting_with_imports/expected/lir_01_hoist_scalar_references.txt +20 -0
  87. data/golden/schema_imports_broadcasting_with_imports/expected/lir_02_inlined.txt +22 -0
  88. data/golden/schema_imports_broadcasting_with_imports/expected/lir_03_cse.txt +21 -0
  89. data/golden/schema_imports_broadcasting_with_imports/expected/lir_04_1_loop_fusion.txt +21 -0
  90. data/golden/schema_imports_broadcasting_with_imports/expected/lir_04_loop_invcm.txt +21 -0
  91. data/golden/schema_imports_broadcasting_with_imports/expected/lir_06_const_prop.txt +21 -0
  92. data/golden/schema_imports_broadcasting_with_imports/expected/nast.txt +12 -0
  93. data/golden/schema_imports_broadcasting_with_imports/expected/schema_javascript.mjs +22 -0
  94. data/golden/schema_imports_broadcasting_with_imports/expected/schema_ruby.rb +24 -0
  95. data/golden/schema_imports_broadcasting_with_imports/expected/snast.txt +12 -0
  96. data/golden/schema_imports_broadcasting_with_imports/expected.json +4 -0
  97. data/golden/schema_imports_broadcasting_with_imports/input.json +7 -0
  98. data/golden/schema_imports_broadcasting_with_imports/schema.kumi +14 -0
  99. data/golden/schema_imports_complex_order_calc/expected/ast.txt +82 -0
  100. data/golden/schema_imports_complex_order_calc/expected/input_plan.txt +16 -0
  101. data/golden/schema_imports_complex_order_calc/expected/lir_00_unoptimized.txt +94 -0
  102. data/golden/schema_imports_complex_order_calc/expected/lir_01_hoist_scalar_references.txt +94 -0
  103. data/golden/schema_imports_complex_order_calc/expected/lir_02_inlined.txt +187 -0
  104. data/golden/schema_imports_complex_order_calc/expected/lir_03_cse.txt +131 -0
  105. data/golden/schema_imports_complex_order_calc/expected/lir_04_1_loop_fusion.txt +131 -0
  106. data/golden/schema_imports_complex_order_calc/expected/lir_04_loop_invcm.txt +131 -0
  107. data/golden/schema_imports_complex_order_calc/expected/lir_06_const_prop.txt +131 -0
  108. data/golden/schema_imports_complex_order_calc/expected/nast.txt +56 -0
  109. data/golden/schema_imports_complex_order_calc/expected/schema_javascript.mjs +147 -0
  110. data/golden/schema_imports_complex_order_calc/expected/schema_ruby.rb +149 -0
  111. data/golden/schema_imports_complex_order_calc/expected/snast.txt +56 -0
  112. data/golden/schema_imports_complex_order_calc/expected.json +12 -0
  113. data/golden/schema_imports_complex_order_calc/input.json +20 -0
  114. data/golden/schema_imports_complex_order_calc/schema.kumi +33 -0
  115. data/golden/schema_imports_composed_order/expected/ast.txt +33 -0
  116. data/golden/schema_imports_composed_order/expected/input_plan.txt +3 -0
  117. data/golden/schema_imports_composed_order/expected/lir_00_unoptimized.txt +25 -0
  118. data/golden/schema_imports_composed_order/expected/lir_01_hoist_scalar_references.txt +25 -0
  119. data/golden/schema_imports_composed_order/expected/lir_02_inlined.txt +33 -0
  120. data/golden/schema_imports_composed_order/expected/lir_03_cse.txt +33 -0
  121. data/golden/schema_imports_composed_order/expected/lir_04_1_loop_fusion.txt +33 -0
  122. data/golden/schema_imports_composed_order/expected/lir_04_loop_invcm.txt +33 -0
  123. data/golden/schema_imports_composed_order/expected/lir_06_const_prop.txt +33 -0
  124. data/golden/schema_imports_composed_order/expected/nast.txt +25 -0
  125. data/golden/schema_imports_composed_order/expected/schema_javascript.mjs +35 -0
  126. data/golden/schema_imports_composed_order/expected/schema_ruby.rb +33 -0
  127. data/golden/schema_imports_composed_order/expected/snast.txt +25 -0
  128. data/golden/schema_imports_composed_order/expected.json +6 -0
  129. data/golden/schema_imports_composed_order/input.json +5 -0
  130. data/golden/schema_imports_composed_order/schema.kumi +15 -0
  131. data/golden/schema_imports_discount_with_tax/expected/ast.txt +37 -0
  132. data/golden/schema_imports_discount_with_tax/expected/input_plan.txt +2 -0
  133. data/golden/schema_imports_discount_with_tax/expected/lir_00_unoptimized.txt +30 -0
  134. data/golden/schema_imports_discount_with_tax/expected/lir_01_hoist_scalar_references.txt +30 -0
  135. data/golden/schema_imports_discount_with_tax/expected/lir_02_inlined.txt +37 -0
  136. data/golden/schema_imports_discount_with_tax/expected/lir_03_cse.txt +34 -0
  137. data/golden/schema_imports_discount_with_tax/expected/lir_04_1_loop_fusion.txt +34 -0
  138. data/golden/schema_imports_discount_with_tax/expected/lir_04_loop_invcm.txt +34 -0
  139. data/golden/schema_imports_discount_with_tax/expected/lir_06_const_prop.txt +34 -0
  140. data/golden/schema_imports_discount_with_tax/expected/nast.txt +30 -0
  141. data/golden/schema_imports_discount_with_tax/expected/schema_javascript.mjs +37 -0
  142. data/golden/schema_imports_discount_with_tax/expected/schema_ruby.rb +34 -0
  143. data/golden/schema_imports_discount_with_tax/expected/snast.txt +30 -0
  144. data/golden/schema_imports_discount_with_tax/expected.json +7 -0
  145. data/golden/schema_imports_discount_with_tax/input.json +4 -0
  146. data/golden/schema_imports_discount_with_tax/schema.kumi +15 -0
  147. data/golden/schema_imports_line_items/expected/ast.txt +35 -0
  148. data/golden/schema_imports_line_items/expected/input_plan.txt +8 -0
  149. data/golden/schema_imports_line_items/expected/lir_00_unoptimized.txt +19 -0
  150. data/golden/schema_imports_line_items/expected/lir_01_hoist_scalar_references.txt +19 -0
  151. data/golden/schema_imports_line_items/expected/lir_02_inlined.txt +24 -0
  152. data/golden/schema_imports_line_items/expected/lir_03_cse.txt +22 -0
  153. data/golden/schema_imports_line_items/expected/lir_04_1_loop_fusion.txt +22 -0
  154. data/golden/schema_imports_line_items/expected/lir_04_loop_invcm.txt +22 -0
  155. data/golden/schema_imports_line_items/expected/lir_06_const_prop.txt +22 -0
  156. data/golden/schema_imports_line_items/expected/nast.txt +19 -0
  157. data/golden/schema_imports_line_items/expected/schema_javascript.mjs +23 -0
  158. data/golden/schema_imports_line_items/expected/schema_ruby.rb +22 -0
  159. data/golden/schema_imports_line_items/expected/snast.txt +19 -0
  160. data/golden/schema_imports_line_items/expected.json +5 -0
  161. data/golden/schema_imports_line_items/input.json +13 -0
  162. data/golden/schema_imports_line_items/schema.kumi +17 -0
  163. data/golden/schema_imports_multiple/expected/ast.txt +35 -0
  164. data/golden/schema_imports_multiple/expected/input_plan.txt +2 -0
  165. data/golden/schema_imports_multiple/expected/lir_00_unoptimized.txt +29 -0
  166. data/golden/schema_imports_multiple/expected/lir_01_hoist_scalar_references.txt +29 -0
  167. data/golden/schema_imports_multiple/expected/lir_02_inlined.txt +41 -0
  168. data/golden/schema_imports_multiple/expected/lir_03_cse.txt +37 -0
  169. data/golden/schema_imports_multiple/expected/lir_04_1_loop_fusion.txt +37 -0
  170. data/golden/schema_imports_multiple/expected/lir_04_loop_invcm.txt +37 -0
  171. data/golden/schema_imports_multiple/expected/lir_06_const_prop.txt +37 -0
  172. data/golden/schema_imports_multiple/expected/nast.txt +28 -0
  173. data/golden/schema_imports_multiple/expected/schema_javascript.mjs +40 -0
  174. data/golden/schema_imports_multiple/expected/schema_ruby.rb +37 -0
  175. data/golden/schema_imports_multiple/expected/snast.txt +28 -0
  176. data/golden/schema_imports_multiple/expected.json +7 -0
  177. data/golden/schema_imports_multiple/input.json +4 -0
  178. data/golden/schema_imports_multiple/schema.kumi +15 -0
  179. data/golden/schema_imports_nested_expressions/expected/ast.txt +31 -0
  180. data/golden/schema_imports_nested_expressions/expected/input_plan.txt +3 -0
  181. data/golden/schema_imports_nested_expressions/expected/lir_00_unoptimized.txt +22 -0
  182. data/golden/schema_imports_nested_expressions/expected/lir_01_hoist_scalar_references.txt +22 -0
  183. data/golden/schema_imports_nested_expressions/expected/lir_02_inlined.txt +32 -0
  184. data/golden/schema_imports_nested_expressions/expected/lir_03_cse.txt +32 -0
  185. data/golden/schema_imports_nested_expressions/expected/lir_04_1_loop_fusion.txt +32 -0
  186. data/golden/schema_imports_nested_expressions/expected/lir_04_loop_invcm.txt +32 -0
  187. data/golden/schema_imports_nested_expressions/expected/lir_06_const_prop.txt +28 -0
  188. data/golden/schema_imports_nested_expressions/expected/nast.txt +23 -0
  189. data/golden/schema_imports_nested_expressions/expected/schema_javascript.mjs +29 -0
  190. data/golden/schema_imports_nested_expressions/expected/schema_ruby.rb +28 -0
  191. data/golden/schema_imports_nested_expressions/expected/snast.txt +23 -0
  192. data/golden/schema_imports_nested_expressions/expected.json +5 -0
  193. data/golden/schema_imports_nested_expressions/input.json +5 -0
  194. data/golden/schema_imports_nested_expressions/schema.kumi +13 -0
  195. data/golden/schema_imports_nested_with_reductions/expected/ast.txt +47 -0
  196. data/golden/schema_imports_nested_with_reductions/expected/input_plan.txt +12 -0
  197. data/golden/schema_imports_nested_with_reductions/expected/lir_00_unoptimized.txt +31 -0
  198. data/golden/schema_imports_nested_with_reductions/expected/lir_01_hoist_scalar_references.txt +31 -0
  199. data/golden/schema_imports_nested_with_reductions/expected/lir_02_inlined.txt +58 -0
  200. data/golden/schema_imports_nested_with_reductions/expected/lir_03_cse.txt +49 -0
  201. data/golden/schema_imports_nested_with_reductions/expected/lir_04_1_loop_fusion.txt +51 -0
  202. data/golden/schema_imports_nested_with_reductions/expected/lir_04_loop_invcm.txt +49 -0
  203. data/golden/schema_imports_nested_with_reductions/expected/lir_06_const_prop.txt +49 -0
  204. data/golden/schema_imports_nested_with_reductions/expected/nast.txt +23 -0
  205. data/golden/schema_imports_nested_with_reductions/expected/schema_javascript.mjs +49 -0
  206. data/golden/schema_imports_nested_with_reductions/expected/schema_ruby.rb +52 -0
  207. data/golden/schema_imports_nested_with_reductions/expected/snast.txt +23 -0
  208. data/golden/schema_imports_nested_with_reductions/expected.json +6 -0
  209. data/golden/schema_imports_nested_with_reductions/input.json +16 -0
  210. data/golden/schema_imports_nested_with_reductions/schema.kumi +23 -0
  211. data/golden/schema_imports_with_imports/expected/ast.txt +19 -0
  212. data/golden/schema_imports_with_imports/expected/input_plan.txt +1 -0
  213. data/golden/schema_imports_with_imports/expected/lir_00_unoptimized.txt +13 -0
  214. data/golden/schema_imports_with_imports/expected/lir_01_hoist_scalar_references.txt +13 -0
  215. data/golden/schema_imports_with_imports/expected/lir_02_inlined.txt +14 -0
  216. data/golden/schema_imports_with_imports/expected/lir_03_cse.txt +13 -0
  217. data/golden/schema_imports_with_imports/expected/lir_04_1_loop_fusion.txt +13 -0
  218. data/golden/schema_imports_with_imports/expected/lir_04_loop_invcm.txt +13 -0
  219. data/golden/schema_imports_with_imports/expected/lir_06_const_prop.txt +13 -0
  220. data/golden/schema_imports_with_imports/expected/nast.txt +13 -0
  221. data/golden/schema_imports_with_imports/expected/schema_javascript.mjs +13 -0
  222. data/golden/schema_imports_with_imports/expected/schema_ruby.rb +13 -0
  223. data/golden/schema_imports_with_imports/expected/snast.txt +13 -0
  224. data/golden/schema_imports_with_imports/expected.json +4 -0
  225. data/golden/schema_imports_with_imports/input.json +3 -0
  226. data/golden/schema_imports_with_imports/schema.kumi +10 -0
  227. data/golden/shift/expected/lir_06_const_prop.txt +18 -30
  228. data/golden/shift/expected/schema_javascript.mjs +18 -30
  229. data/golden/shift/expected/schema_ruby.rb +25 -67
  230. data/golden/shift_2d/expected/lir_06_const_prop.txt +36 -60
  231. data/golden/shift_2d/expected/schema_javascript.mjs +36 -60
  232. data/golden/shift_2d/expected/schema_ruby.rb +49 -109
  233. data/golden/simple_math/expected/lir_06_const_prop.txt +3 -6
  234. data/golden/simple_math/expected/schema_javascript.mjs +3 -6
  235. data/golden/simple_math/expected/schema_ruby.rb +8 -39
  236. data/golden/streaming_basics/expected/lir_06_const_prop.txt +6 -12
  237. data/golden/streaming_basics/expected/schema_javascript.mjs +6 -12
  238. data/golden/streaming_basics/expected/schema_ruby.rb +14 -51
  239. data/golden/tuples/expected/lir_06_const_prop.txt +5 -22
  240. data/golden/tuples/expected/schema_javascript.mjs +5 -22
  241. data/golden/tuples/expected/schema_ruby.rb +11 -57
  242. data/golden/tuples_and_arrays/expected/lir_06_const_prop.txt +4 -8
  243. data/golden/tuples_and_arrays/expected/schema_javascript.mjs +4 -8
  244. data/golden/tuples_and_arrays/expected/schema_ruby.rb +9 -41
  245. data/golden/us_tax_2024/expected/lir_06_const_prop.txt +94 -171
  246. data/golden/us_tax_2024/expected/schema_javascript.mjs +13 -21
  247. data/golden/us_tax_2024/expected/schema_ruby.rb +15 -48
  248. data/golden/with_constants/expected/lir_06_const_prop.txt +3 -8
  249. data/golden/with_constants/expected/schema_javascript.mjs +3 -8
  250. data/golden/with_constants/expected/schema_ruby.rb +5 -35
  251. data/lib/kumi/analyzer.rb +8 -7
  252. data/lib/kumi/configuration.rb +7 -6
  253. data/lib/kumi/core/analyzer/passes/attach_anchors_pass.rb +1 -1
  254. data/lib/kumi/core/analyzer/passes/attach_terminal_info_pass.rb +1 -1
  255. data/lib/kumi/core/analyzer/passes/codegen/js/declaration_emitter.rb +20 -0
  256. data/lib/kumi/core/analyzer/passes/codegen/ruby/declaration_emitter.rb +16 -7
  257. data/lib/kumi/core/analyzer/passes/codegen/ruby/output_buffer.rb +3 -35
  258. data/lib/kumi/core/analyzer/passes/dependency_resolver.rb +6 -0
  259. data/lib/kumi/core/analyzer/passes/import_analysis_pass.rb +90 -0
  260. data/lib/kumi/core/analyzer/passes/lir/constant_propagation_pass.rb +77 -36
  261. data/lib/kumi/core/analyzer/passes/lir/lower_pass.rb +26 -11
  262. data/lib/kumi/core/analyzer/passes/name_indexer.rb +20 -2
  263. data/lib/kumi/core/analyzer/passes/nast_dimensional_analyzer_pass.rb +44 -0
  264. data/lib/kumi/core/analyzer/passes/normalize_to_nast_pass.rb +30 -0
  265. data/lib/kumi/core/analyzer/passes/semantic_constraint_validator.rb +5 -1
  266. data/lib/kumi/core/analyzer/passes/snast_pass.rb +15 -0
  267. data/lib/kumi/core/lir/build.rb +27 -0
  268. data/lib/kumi/core/lir/peephole.rb +164 -0
  269. data/lib/kumi/core/nast.rb +16 -0
  270. data/lib/kumi/core/ruby_parser/build_context.rb +3 -1
  271. data/lib/kumi/core/ruby_parser/parser.rb +1 -1
  272. data/lib/kumi/core/ruby_parser/schema_builder.rb +33 -3
  273. data/lib/kumi/dev/golden/result.rb +9 -3
  274. data/lib/kumi/dev/golden/runtime_test.rb +16 -1
  275. data/lib/kumi/dev/golden.rb +18 -20
  276. data/lib/kumi/dev/golden_schema_modules.rb +8 -0
  277. data/lib/kumi/dev/golden_schema_wrapper.rb +116 -0
  278. data/lib/kumi/dev/support/kumi_runner.mjs +18 -0
  279. data/lib/kumi/schema.rb +44 -2
  280. data/lib/kumi/support/lir_printer.rb +21 -5
  281. data/lib/kumi/support/nast_printer.rb +11 -0
  282. data/lib/kumi/support/s_expression_printer.rb +9 -0
  283. data/lib/kumi/support/snast_printer.rb +6 -0
  284. data/lib/kumi/syntax/import_call.rb +11 -0
  285. data/lib/kumi/syntax/import_declaration.rb +11 -0
  286. data/lib/kumi/syntax/root.rb +2 -2
  287. data/lib/kumi/test_shared_schemas/compound.rb +21 -0
  288. data/lib/kumi/test_shared_schemas/discount.rb +19 -0
  289. data/lib/kumi/test_shared_schemas/price.rb +19 -0
  290. data/lib/kumi/test_shared_schemas/subtotal.rb +22 -0
  291. data/lib/kumi/test_shared_schemas/tax.rb +18 -0
  292. data/lib/kumi/version.rb +1 -1
  293. data/lib/kumi.rb +19 -4
  294. metadata +176 -3
@@ -1,47 +1,15 @@
1
1
  # Autogenerated by Kumi Codegen
2
- module Kumi::Compiled::KUMI_38e52950a42d13f281d275be711f674d914feaf059f72c64a582b8de5c8f192c
3
- def self.from(input_data = nil)
4
- instance = Object.new
5
- instance.extend(self)
6
- instance.instance_variable_set(:@input, input_data)
7
- instance
8
- end
9
-
10
- def self.__kumi_executable__
11
- instance = Object.new
12
- instance.extend(self)
13
- instance
14
- end
15
-
16
- def update(input_data)
17
- @input = @input.merge(input_data)
18
- self
19
- end
20
-
21
- def [](name)
22
- case name
23
- when :global_offset_plus then _global_offset_plus
24
- when :batch_bias then _batch_bias
25
- when :row_scale2 then _row_scale2
26
- when :elem_affine then _elem_affine
27
- when :row_sum_affine then _row_sum_affine
28
- when :batch_total_affine then _batch_total_affine
29
- else raise KeyError, "Unknown declaration"
30
- end
31
- end
32
-
33
- def _global_offset_plus(input = @input)
2
+ module Kumi::Compiled::KUMI_370ac782feb059e263a962e9d2c6b5de9914ae3e7636c3efdc00616eff6659b5
3
+ def self._global_offset_plus(input)
34
4
  t1 = input["global_offset"] || input[:global_offset]
35
- t2 = 1.0
36
- t1 + t2
5
+ t1 + 1.0
37
6
  end
38
7
 
39
- def _batch_bias(input = @input)
8
+ def self._batch_bias(input)
40
9
  out = []
41
10
  t4 = input["batch"] || input[:batch]
42
11
  t54 = input["global_offset"] || input[:global_offset]
43
- t55 = 1.0
44
- t56 = t54 + t55
12
+ t56 = t54 + 1.0
45
13
  t4.each_with_index do |batch_el_5, batch_i_6|
46
14
  t7 = batch_el_5["mean"] || batch_el_5[:mean]
47
15
  t9 = t7 + t56
@@ -50,16 +18,15 @@ module Kumi::Compiled::KUMI_38e52950a42d13f281d275be711f674d914feaf059f72c64a582
50
18
  out
51
19
  end
52
20
 
53
- def _row_scale2(input = @input)
21
+ def self._row_scale2(input)
54
22
  out = []
55
23
  t10 = input["batch"] || input[:batch]
56
- t17 = 2.0
57
24
  t10.each_with_index do |batch_el_11, batch_i_12|
58
25
  out_1 = []
59
26
  t13 = batch_el_11["row"] || batch_el_11[:row]
60
27
  t13.each_with_index do |row_el_14, row_i_15|
61
28
  t16 = row_el_14["scale"] || row_el_14[:scale]
62
- t18 = t16 * t17
29
+ t18 = t16 * 2.0
63
30
  out_1 << t18
64
31
  end
65
32
  out << out_1
@@ -67,13 +34,11 @@ module Kumi::Compiled::KUMI_38e52950a42d13f281d275be711f674d914feaf059f72c64a582
67
34
  out
68
35
  end
69
36
 
70
- def _elem_affine(input = @input)
37
+ def self._elem_affine(input)
71
38
  out = []
72
39
  t66 = input["global_offset"] || input[:global_offset]
73
- t67 = 1.0
74
- t68 = t66 + t67
40
+ t68 = t66 + 1.0
75
41
  t19 = input["batch"] || input[:batch]
76
- t60 = 2.0
77
42
  t19.each_with_index do |batch_el_20, batch_i_21|
78
43
  out_1 = []
79
44
  t64 = batch_el_20["mean"] || batch_el_20[:mean]
@@ -82,7 +47,7 @@ module Kumi::Compiled::KUMI_38e52950a42d13f281d275be711f674d914feaf059f72c64a582
82
47
  t22.each_with_index do |row_el_23, row_i_24|
83
48
  out_2 = []
84
49
  t59 = row_el_23["scale"] || row_el_23[:scale]
85
- t61 = t59 * t60
50
+ t61 = t59 * 2.0
86
51
  t25 = row_el_23["col"] || row_el_23[:col]
87
52
  t25.each_with_index do |col_el_26, col_i_27|
88
53
  t28 = col_el_26["val"] || col_el_26[:val]
@@ -97,13 +62,11 @@ module Kumi::Compiled::KUMI_38e52950a42d13f281d275be711f674d914feaf059f72c64a582
97
62
  out
98
63
  end
99
64
 
100
- def _row_sum_affine(input = @input)
65
+ def self._row_sum_affine(input)
101
66
  out = []
102
67
  t86 = input["global_offset"] || input[:global_offset]
103
- t87 = 1.0
104
- t88 = t86 + t87
68
+ t88 = t86 + 1.0
105
69
  t33 = input["batch"] || input[:batch]
106
- t80 = 2.0
107
70
  t33.each_with_index do |batch_el_34, batch_i_35|
108
71
  out_1 = []
109
72
  t84 = batch_el_34["mean"] || batch_el_34[:mean]
@@ -111,7 +74,7 @@ module Kumi::Compiled::KUMI_38e52950a42d13f281d275be711f674d914feaf059f72c64a582
111
74
  t85 = t84 + t88
112
75
  t36.each_with_index do |row_el_37, row_i_38|
113
76
  t79 = row_el_37["scale"] || row_el_37[:scale]
114
- t81 = t79 * t80
77
+ t81 = t79 * 2.0
115
78
  acc_39 = 0.0
116
79
  t40 = row_el_37["col"] || row_el_37[:col]
117
80
  t40.each_with_index do |col_el_41, col_i_42|
@@ -128,13 +91,11 @@ module Kumi::Compiled::KUMI_38e52950a42d13f281d275be711f674d914feaf059f72c64a582
128
91
  out
129
92
  end
130
93
 
131
- def _batch_total_affine(input = @input)
94
+ def self._batch_total_affine(input)
132
95
  out = []
133
96
  t115 = input["global_offset"] || input[:global_offset]
134
- t116 = 1.0
135
- t117 = t115 + t116
97
+ t117 = t115 + 1.0
136
98
  t45 = input["batch"] || input[:batch]
137
- t109 = 2.0
138
99
  t45.each_with_index do |batch_el_46, batch_i_47|
139
100
  t113 = batch_el_46["mean"] || batch_el_46[:mean]
140
101
  acc_48 = 0.0
@@ -142,7 +103,7 @@ module Kumi::Compiled::KUMI_38e52950a42d13f281d275be711f674d914feaf059f72c64a582
142
103
  t114 = t113 + t117
143
104
  t49.each_with_index do |row_el_50, row_i_51|
144
105
  t108 = row_el_50["scale"] || row_el_50[:scale]
145
- t110 = t108 * t109
106
+ t110 = t108 * 2.0
146
107
  acc92 = 0.0
147
108
  t93 = row_el_50["col"] || row_el_50[:col]
148
109
  t93.each_with_index do |t94, t95|
@@ -3,8 +3,7 @@
3
3
  %t1 = load_input "x" :: any
4
4
  %t2 = load_field t1["y"] :: any
5
5
  %t3 = load_field t2["z"] :: integer
6
- %t4 = const 2 :: integer
7
- %t5 = call core.mul:numeric(%t3, %t4) :: integer
6
+ %t5 = call core.mul:numeric(%t3, 2) :: integer
8
7
  yield %t5
9
8
  )
10
9
  )
@@ -2,8 +2,7 @@ export function _double(input) {
2
2
  let t1 = input["x"];
3
3
  let t2 = t1["y"];
4
4
  let t3 = t2["z"];
5
- const t4 = 2;
6
- let t5 = t3 * t4;
5
+ let t5 = t3 * 2;
7
6
  return t5;
8
7
  }
9
8
 
@@ -1,35 +1,9 @@
1
1
  # Autogenerated by Kumi Codegen
2
- module Kumi::Compiled::KUMI_968c950e9550ea6866e905fc32ac2ae9aee50f3d8316a0580fb2ed0efb31b47b
3
- def self.from(input_data = nil)
4
- instance = Object.new
5
- instance.extend(self)
6
- instance.instance_variable_set(:@input, input_data)
7
- instance
8
- end
9
-
10
- def self.__kumi_executable__
11
- instance = Object.new
12
- instance.extend(self)
13
- instance
14
- end
15
-
16
- def update(input_data)
17
- @input = @input.merge(input_data)
18
- self
19
- end
20
-
21
- def [](name)
22
- case name
23
- when :double then _double
24
- else raise KeyError, "Unknown declaration"
25
- end
26
- end
27
-
28
- def _double(input = @input)
2
+ module Kumi::Compiled::KUMI_828578820f1f1a58e1e2eeaad09f06b89503ea9f58ca364a2b5d2440cb379ec1
3
+ def self._double(input)
29
4
  t1 = input["x"] || input[:x]
30
5
  t2 = t1["y"] || t1[:y]
31
6
  t3 = t2["z"] || t2[:z]
32
- t4 = 2
33
- t3 * t4
7
+ t3 * 2
34
8
  end
35
9
  end
@@ -1,34 +1,6 @@
1
1
  # Autogenerated by Kumi Codegen
2
- module Kumi::Compiled::KUMI_4d7e7d13cea88587529ab5ca02b7786b61419b3ed17afe69d36b2d1947311324
3
- def self.from(input_data = nil)
4
- instance = Object.new
5
- instance.extend(self)
6
- instance.instance_variable_set(:@input, input_data)
7
- instance
8
- end
9
-
10
- def self.__kumi_executable__
11
- instance = Object.new
12
- instance.extend(self)
13
- instance
14
- end
15
-
16
- def update(input_data)
17
- @input = @input.merge(input_data)
18
- self
19
- end
20
-
21
- def [](name)
22
- case name
23
- when :dept_headcount then _dept_headcount
24
- when :teams_per_dept then _teams_per_dept
25
- when :avg_headcount_per_dept then _avg_headcount_per_dept
26
- when :is_above_average_team then _is_above_average_team
27
- else raise KeyError, "Unknown declaration"
28
- end
29
- end
30
-
31
- def _dept_headcount(input = @input)
2
+ module Kumi::Compiled::KUMI_735e9f0503a157662ecacc10e3a875ed90b8874700963efbf20ba6199fe41a3f
3
+ def self._dept_headcount(input)
32
4
  out = []
33
5
  t1 = input["departments"] || input[:departments]
34
6
  t1.each_with_index do |departments_el_2, departments_i_3|
@@ -44,7 +16,7 @@ module Kumi::Compiled::KUMI_4d7e7d13cea88587529ab5ca02b7786b61419b3ed17afe69d36b
44
16
  out
45
17
  end
46
18
 
47
- def _teams_per_dept(input = @input)
19
+ def self._teams_per_dept(input)
48
20
  out = []
49
21
  t10 = input["departments"] || input[:departments]
50
22
  t10.each_with_index do |departments_el_11, departments_i_12|
@@ -60,7 +32,7 @@ module Kumi::Compiled::KUMI_4d7e7d13cea88587529ab5ca02b7786b61419b3ed17afe69d36b
60
32
  out
61
33
  end
62
34
 
63
- def _avg_headcount_per_dept(input = @input)
35
+ def self._avg_headcount_per_dept(input)
64
36
  out = []
65
37
  t19 = input["departments"] || input[:departments]
66
38
  t19.each_with_index do |departments_el_20, departments_i_21|
@@ -81,7 +53,7 @@ module Kumi::Compiled::KUMI_4d7e7d13cea88587529ab5ca02b7786b61419b3ed17afe69d36b
81
53
  out
82
54
  end
83
55
 
84
- def _is_above_average_team(input = @input)
56
+ def self._is_above_average_team(input)
85
57
  out = []
86
58
  t25 = input["departments"] || input[:departments]
87
59
  t25.each_with_index do |departments_el_26, departments_i_27|
@@ -2,9 +2,8 @@
2
2
  (Declaration roll_right
3
3
  %t1 = load_input "cells" :: array
4
4
  %t4 = length %t1 :: integer
5
- %t5 = const 1 :: integer
6
5
  loop cells id=L1 in %t1 as el=%cells_el_2, idx=%cells_i_3
7
- %t6 = call core.sub(%cells_i_3, %t5) :: integer
6
+ %t6 = call core.sub(%cells_i_3, 1) :: integer
8
7
  %t7 = call core.mod(%t6, %t4) :: integer
9
8
  %t8 = call core.add(%t7, %t4) :: integer
10
9
  %t9 = call core.mod(%t8, %t4) :: integer
@@ -15,9 +14,8 @@
15
14
  (Declaration roll_left
16
15
  %t11 = load_input "cells" :: array
17
16
  %t14 = length %t11 :: integer
18
- %t15 = const -1 :: integer
19
17
  loop cells id=L2 in %t11 as el=%cells_el_12, idx=%cells_i_13
20
- %t16 = call core.sub(%cells_i_13, %t15) :: integer
18
+ %t16 = call core.sub(%cells_i_13, -1) :: integer
21
19
  %t17 = call core.mod(%t16, %t14) :: integer
22
20
  %t18 = call core.add(%t17, %t14) :: integer
23
21
  %t19 = call core.mod(%t18, %t14) :: integer
@@ -28,12 +26,10 @@
28
26
  (Declaration roll_right_clamp
29
27
  %t21 = load_input "cells" :: array
30
28
  %t24 = length %t21 :: integer
31
- %t25 = const 1 :: integer
32
- %t29 = const 0 :: integer
33
- %t28 = call core.sub(%t24, %t25) :: integer
29
+ %t28 = call core.sub(%t24, 1) :: integer
34
30
  loop cells id=L3 in %t21 as el=%cells_el_22, idx=%cells_i_23
35
- %t26 = call core.sub(%cells_i_23, %t25) :: integer
36
- %t30 = call core.clamp(%t26, %t29, %t28) :: integer
31
+ %t26 = call core.sub(%cells_i_23, 1) :: integer
32
+ %t30 = call core.clamp(%t26, 0, %t28) :: integer
37
33
  %t31 = gather %t21, %t30 :: integer
38
34
  yield %t31
39
35
  end_loop
@@ -41,13 +37,10 @@
41
37
  (Declaration roll_left_clamp
42
38
  %t32 = load_input "cells" :: array
43
39
  %t35 = length %t32 :: integer
44
- %t36 = const -1 :: integer
45
- %t38 = const 1 :: integer
46
- %t40 = const 0 :: integer
47
- %t39 = call core.sub(%t35, %t38) :: integer
40
+ %t39 = call core.sub(%t35, 1) :: integer
48
41
  loop cells id=L4 in %t32 as el=%cells_el_33, idx=%cells_i_34
49
- %t37 = call core.sub(%cells_i_34, %t36) :: integer
50
- %t41 = call core.clamp(%t37, %t40, %t39) :: integer
42
+ %t37 = call core.sub(%cells_i_34, -1) :: integer
43
+ %t41 = call core.clamp(%t37, 0, %t39) :: integer
51
44
  %t42 = gather %t32, %t41 :: integer
52
45
  yield %t42
53
46
  end_loop
@@ -2,9 +2,8 @@ export function _roll_right(input) {
2
2
  let out = [];
3
3
  let t1 = input["cells"];
4
4
  let t4 = t1.length;
5
- const t5 = 1;
6
5
  t1.forEach((cells_el_2, cells_i_3) => {
7
- let t6 = cells_i_3 - t5;
6
+ let t6 = cells_i_3 - 1;
8
7
  let t7 = ((t6 % t4) + t4) % t4;
9
8
  let t8 = t7 + t4;
10
9
  let t9 = ((t8 % t4) + t4) % t4;
@@ -18,9 +17,8 @@ export function _roll_left(input) {
18
17
  let out = [];
19
18
  let t11 = input["cells"];
20
19
  let t14 = t11.length;
21
- const t15 = -1;
22
20
  t11.forEach((cells_el_12, cells_i_13) => {
23
- let t16 = cells_i_13 - t15;
21
+ let t16 = cells_i_13 - -1;
24
22
  let t17 = ((t16 % t14) + t14) % t14;
25
23
  let t18 = t17 + t14;
26
24
  let t19 = ((t18 % t14) + t14) % t14;
@@ -34,12 +32,10 @@ export function _roll_right_clamp(input) {
34
32
  let out = [];
35
33
  let t21 = input["cells"];
36
34
  let t24 = t21.length;
37
- const t25 = 1;
38
- const t29 = 0;
39
- let t28 = t24 - t25;
35
+ let t28 = t24 - 1;
40
36
  t21.forEach((cells_el_22, cells_i_23) => {
41
- let t26 = cells_i_23 - t25;
42
- let t30 = Math.min(Math.max(t26, t29), t28);
37
+ let t26 = cells_i_23 - 1;
38
+ let t30 = Math.min(Math.max(t26, 0), t28);
43
39
  let t31 = t21[t30];
44
40
  out.push(t31);
45
41
  });
@@ -50,13 +46,10 @@ export function _roll_left_clamp(input) {
50
46
  let out = [];
51
47
  let t32 = input["cells"];
52
48
  let t35 = t32.length;
53
- const t36 = -1;
54
- const t38 = 1;
55
- const t40 = 0;
56
- let t39 = t35 - t38;
49
+ let t39 = t35 - 1;
57
50
  t32.forEach((cells_el_33, cells_i_34) => {
58
- let t37 = cells_i_34 - t36;
59
- let t41 = Math.min(Math.max(t37, t40), t39);
51
+ let t37 = cells_i_34 - -1;
52
+ let t41 = Math.min(Math.max(t37, 0), t39);
60
53
  let t42 = t32[t41];
61
54
  out.push(t42);
62
55
  });
@@ -1,40 +1,11 @@
1
1
  # Autogenerated by Kumi Codegen
2
- module Kumi::Compiled::KUMI_a1445291f04923fe3d936c1514d8bf48488a469a9328b03080feb08b70093276
3
- def self.from(input_data = nil)
4
- instance = Object.new
5
- instance.extend(self)
6
- instance.instance_variable_set(:@input, input_data)
7
- instance
8
- end
9
-
10
- def self.__kumi_executable__
11
- instance = Object.new
12
- instance.extend(self)
13
- instance
14
- end
15
-
16
- def update(input_data)
17
- @input = @input.merge(input_data)
18
- self
19
- end
20
-
21
- def [](name)
22
- case name
23
- when :roll_right then _roll_right
24
- when :roll_left then _roll_left
25
- when :roll_right_clamp then _roll_right_clamp
26
- when :roll_left_clamp then _roll_left_clamp
27
- else raise KeyError, "Unknown declaration"
28
- end
29
- end
30
-
31
- def _roll_right(input = @input)
2
+ module Kumi::Compiled::KUMI_5b73d82c56cb65fcb0e02e2b26a3f7f674fc645882bff7e29b0e469f05a743c1
3
+ def self._roll_right(input)
32
4
  out = []
33
5
  t1 = input["cells"] || input[:cells]
34
6
  t4 = t1.length
35
- t5 = 1
36
7
  t1.each_with_index do |cells_el_2, cells_i_3|
37
- t6 = cells_i_3 - t5
8
+ t6 = cells_i_3 - 1
38
9
  t7 = t6 % t4
39
10
  t8 = t7 + t4
40
11
  t9 = t8 % t4
@@ -44,13 +15,12 @@ module Kumi::Compiled::KUMI_a1445291f04923fe3d936c1514d8bf48488a469a9328b03080fe
44
15
  out
45
16
  end
46
17
 
47
- def _roll_left(input = @input)
18
+ def self._roll_left(input)
48
19
  out = []
49
20
  t11 = input["cells"] || input[:cells]
50
21
  t14 = t11.length
51
- t15 = -1
52
22
  t11.each_with_index do |cells_el_12, cells_i_13|
53
- t16 = cells_i_13 - t15
23
+ t16 = cells_i_13 - -1
54
24
  t17 = t16 % t14
55
25
  t18 = t17 + t14
56
26
  t19 = t18 % t14
@@ -60,33 +30,28 @@ module Kumi::Compiled::KUMI_a1445291f04923fe3d936c1514d8bf48488a469a9328b03080fe
60
30
  out
61
31
  end
62
32
 
63
- def _roll_right_clamp(input = @input)
33
+ def self._roll_right_clamp(input)
64
34
  out = []
65
35
  t21 = input["cells"] || input[:cells]
66
36
  t24 = t21.length
67
- t25 = 1
68
- t29 = 0
69
- t28 = t24 - t25
37
+ t28 = t24 - 1
70
38
  t21.each_with_index do |cells_el_22, cells_i_23|
71
- t26 = cells_i_23 - t25
72
- t30 = [[ t26, t29 ].max, t28 ].min
39
+ t26 = cells_i_23 - 1
40
+ t30 = t26.clamp(0, t28)
73
41
  t31 = t21[t30]
74
42
  out << t31
75
43
  end
76
44
  out
77
45
  end
78
46
 
79
- def _roll_left_clamp(input = @input)
47
+ def self._roll_left_clamp(input)
80
48
  out = []
81
49
  t32 = input["cells"] || input[:cells]
82
50
  t35 = t32.length
83
- t36 = -1
84
- t38 = 1
85
- t40 = 0
86
- t39 = t35 - t38
51
+ t39 = t35 - 1
87
52
  t32.each_with_index do |cells_el_33, cells_i_34|
88
- t37 = cells_i_34 - t36
89
- t41 = [[ t37, t40 ].max, t39 ].min
53
+ t37 = cells_i_34 - -1
54
+ t41 = t37.clamp(0, t39)
90
55
  t42 = t32[t41]
91
56
  out << t42
92
57
  end
@@ -0,0 +1,26 @@
1
+ (Root
2
+ inputs: [
3
+ (InputDeclaration :items :array
4
+ [
5
+ (InputDeclaration :item :hash
6
+ [
7
+ (InputDeclaration :amount :decimal)
8
+ ]
9
+ )
10
+ ]
11
+ )
12
+ ]
13
+ values: [
14
+ (ValueDeclaration :item_taxes
15
+ (ImportCall :tax
16
+ (amount (InputElementReference items.item.amount))
17
+ )
18
+ )
19
+ (ValueDeclaration :total_tax
20
+ (CallExpression :sum
21
+ (DeclarationReference :item_taxes)
22
+ )
23
+ )
24
+ ]
25
+ traits: []
26
+ )
@@ -0,0 +1,5 @@
1
+ items: array (array) access_mode=element
2
+ └─> item: element_access
3
+ item: hash (hash)
4
+ └─> amount: property_access
5
+ amount: decimal
@@ -0,0 +1,20 @@
1
+ (LIR
2
+ (Declaration item_taxes
3
+ %t1 = load_input "items" :: array
4
+ loop items id=L1 in %t1 as el=%items_el_2, idx=%items_i_3
5
+ %t4 = load_field items_el_2["amount"] :: decimal
6
+ %t5 = importschemacall %t4 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
7
+ yield %t5
8
+ end_loop
9
+ )
10
+ (Declaration total_tax
11
+ %acc_6 = decl_acc :: float
12
+ %t7 = load_input "items" :: array
13
+ loop items id=L2 in %t7 as el=%items_el_8, idx=%items_i_9
14
+ %t10 = load_decl item_taxes axes=[items] :: float
15
+ %acc_6 = acc_add agg.sum(%acc_6, %t10) :: float
16
+ end_loop
17
+ %t11 = acc_load %acc_6 :: float
18
+ yield %t11
19
+ )
20
+ )
@@ -0,0 +1,20 @@
1
+ (LIR
2
+ (Declaration item_taxes
3
+ %t1 = load_input "items" :: array
4
+ loop items id=L1 in %t1 as el=%items_el_2, idx=%items_i_3
5
+ %t4 = load_field items_el_2["amount"] :: decimal
6
+ %t5 = importschemacall %t4 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
7
+ yield %t5
8
+ end_loop
9
+ )
10
+ (Declaration total_tax
11
+ %acc_6 = decl_acc :: float
12
+ %t7 = load_input "items" :: array
13
+ loop items id=L2 in %t7 as el=%items_el_8, idx=%items_i_9
14
+ %t10 = load_decl item_taxes axes=[items] :: float
15
+ %acc_6 = acc_add agg.sum(%acc_6, %t10) :: float
16
+ end_loop
17
+ %t11 = acc_load %acc_6 :: float
18
+ yield %t11
19
+ )
20
+ )
@@ -0,0 +1,22 @@
1
+ (LIR
2
+ (Declaration item_taxes
3
+ %t1 = load_input "items" :: array
4
+ loop items id=L1 in %t1 as el=%items_el_2, idx=%items_i_3
5
+ %t4 = load_field items_el_2["amount"] :: decimal
6
+ %t5 = importschemacall %t4 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
7
+ yield %t5
8
+ end_loop
9
+ )
10
+ (Declaration total_tax
11
+ %acc_6 = decl_acc :: float
12
+ %t7 = load_input "items" :: array
13
+ loop items id=L2 in %t7 as el=%items_el_8, idx=%items_i_9
14
+ %t12 = load_input "items" :: array
15
+ %t13 = load_field items_el_8["amount"] :: decimal
16
+ %t14 = importschemacall %t13 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
17
+ %acc_6 = acc_add agg.sum(%acc_6, %t14) :: float
18
+ end_loop
19
+ %t11 = acc_load %acc_6 :: float
20
+ yield %t11
21
+ )
22
+ )
@@ -0,0 +1,21 @@
1
+ (LIR
2
+ (Declaration item_taxes
3
+ %t1 = load_input "items" :: array
4
+ loop items id=L1 in %t1 as el=%items_el_2, idx=%items_i_3
5
+ %t4 = load_field items_el_2["amount"] :: decimal
6
+ %t5 = importschemacall %t4 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
7
+ yield %t5
8
+ end_loop
9
+ )
10
+ (Declaration total_tax
11
+ %acc_6 = decl_acc :: float
12
+ %t7 = load_input "items" :: array
13
+ loop items id=L2 in %t7 as el=%items_el_8, idx=%items_i_9
14
+ %t13 = load_field items_el_8["amount"] :: decimal
15
+ %t14 = importschemacall %t13 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
16
+ %acc_6 = acc_add agg.sum(%acc_6, %t14) :: float
17
+ end_loop
18
+ %t11 = acc_load %acc_6 :: float
19
+ yield %t11
20
+ )
21
+ )
@@ -0,0 +1,21 @@
1
+ (LIR
2
+ (Declaration item_taxes
3
+ %t1 = load_input "items" :: array
4
+ loop items id=L1 in %t1 as el=%items_el_2, idx=%items_i_3
5
+ %t4 = load_field items_el_2["amount"] :: decimal
6
+ %t5 = importschemacall %t4 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
7
+ yield %t5
8
+ end_loop
9
+ )
10
+ (Declaration total_tax
11
+ %acc_6 = decl_acc :: float
12
+ %t7 = load_input "items" :: array
13
+ loop items id=L2 in %t7 as el=%items_el_8, idx=%items_i_9
14
+ %t13 = load_field items_el_8["amount"] :: decimal
15
+ %t14 = importschemacall %t13 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
16
+ %acc_6 = acc_add agg.sum(%acc_6, %t14) :: float
17
+ end_loop
18
+ %t11 = acc_load %acc_6 :: float
19
+ yield %t11
20
+ )
21
+ )
@@ -0,0 +1,21 @@
1
+ (LIR
2
+ (Declaration item_taxes
3
+ %t1 = load_input "items" :: array
4
+ loop items id=L1 in %t1 as el=%items_el_2, idx=%items_i_3
5
+ %t4 = load_field items_el_2["amount"] :: decimal
6
+ %t5 = importschemacall %t4 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
7
+ yield %t5
8
+ end_loop
9
+ )
10
+ (Declaration total_tax
11
+ %acc_6 = decl_acc :: float
12
+ %t7 = load_input "items" :: array
13
+ loop items id=L2 in %t7 as el=%items_el_8, idx=%items_i_9
14
+ %t13 = load_field items_el_8["amount"] :: decimal
15
+ %t14 = importschemacall %t13 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
16
+ %acc_6 = acc_add agg.sum(%acc_6, %t14) :: float
17
+ end_loop
18
+ %t11 = acc_load %acc_6 :: float
19
+ yield %t11
20
+ )
21
+ )
@@ -0,0 +1,21 @@
1
+ (LIR
2
+ (Declaration item_taxes
3
+ %t1 = load_input "items" :: array
4
+ loop items id=L1 in %t1 as el=%items_el_2, idx=%items_i_3
5
+ %t4 = load_field items_el_2["amount"] :: decimal
6
+ %t5 = importschemacall %t4 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
7
+ yield %t5
8
+ end_loop
9
+ )
10
+ (Declaration total_tax
11
+ %acc_6 = decl_acc :: float
12
+ %t7 = load_input "items" :: array
13
+ loop items id=L2 in %t7 as el=%items_el_8, idx=%items_i_9
14
+ %t13 = load_field items_el_8["amount"] :: decimal
15
+ %t14 = importschemacall %t13 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
16
+ %acc_6 = acc_add agg.sum(%acc_6, %t14) :: float
17
+ end_loop
18
+ %t11 = acc_load %acc_6 :: float
19
+ yield %t11
20
+ )
21
+ )
@@ -0,0 +1,12 @@
1
+ (NAST
2
+ (VALUE item_taxes
3
+ (ImportCall :tax
4
+ (amount (InputRef [:items, :item, :amount]))
5
+ )
6
+ )
7
+ (VALUE total_tax
8
+ (Call :sum
9
+ (Ref item_taxes)
10
+ )
11
+ )
12
+ )