kumi 0.0.30 → 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
@@ -0,0 +1,35 @@
1
+ (Root
2
+ inputs: [
3
+ (InputDeclaration :tax_rate :integer)
4
+ (InputDeclaration :order_items :array
5
+ [
6
+ (InputDeclaration :item :hash
7
+ [
8
+ (InputDeclaration :quantity :integer)
9
+ (InputDeclaration :unit_price :integer)
10
+ ]
11
+ )
12
+ ]
13
+ )
14
+ ]
15
+ values: [
16
+ (ValueDeclaration :order_subtotal
17
+ (ImportCall :subtotal
18
+ (items (InputReference :order_items))
19
+ )
20
+ )
21
+ (ValueDeclaration :tax_amount
22
+ (CallExpression :multiply
23
+ (DeclarationReference :order_subtotal)
24
+ (InputReference :tax_rate)
25
+ )
26
+ )
27
+ (ValueDeclaration :total
28
+ (CallExpression :add
29
+ (DeclarationReference :order_subtotal)
30
+ (DeclarationReference :tax_amount)
31
+ )
32
+ )
33
+ ]
34
+ traits: []
35
+ )
@@ -0,0 +1,8 @@
1
+ tax_rate: integer
2
+ order_items: array (array) access_mode=element
3
+ └─> item: element_access
4
+ item: hash (hash)
5
+ └─> quantity: property_access
6
+ └─> unit_price: property_access
7
+ quantity: integer
8
+ unit_price: integer
@@ -0,0 +1,19 @@
1
+ (LIR
2
+ (Declaration order_subtotal
3
+ %t1 = load_input "order_items" :: array
4
+ %t2 = importschemacall %t1 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
5
+ yield %t2
6
+ )
7
+ (Declaration tax_amount
8
+ %t3 = load_decl order_subtotal :: integer
9
+ %t4 = load_input "tax_rate" :: integer
10
+ %t5 = call core.mul:numeric(%t3, %t4) :: integer
11
+ yield %t5
12
+ )
13
+ (Declaration total
14
+ %t6 = load_decl order_subtotal :: integer
15
+ %t7 = load_decl tax_amount :: integer
16
+ %t8 = call core.add(%t6, %t7) :: integer
17
+ yield %t8
18
+ )
19
+ )
@@ -0,0 +1,19 @@
1
+ (LIR
2
+ (Declaration order_subtotal
3
+ %t1 = load_input "order_items" :: array
4
+ %t2 = importschemacall %t1 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
5
+ yield %t2
6
+ )
7
+ (Declaration tax_amount
8
+ %t3 = load_decl order_subtotal :: integer
9
+ %t4 = load_input "tax_rate" :: integer
10
+ %t5 = call core.mul:numeric(%t3, %t4) :: integer
11
+ yield %t5
12
+ )
13
+ (Declaration total
14
+ %t6 = load_decl order_subtotal :: integer
15
+ %t7 = load_decl tax_amount :: integer
16
+ %t8 = call core.add(%t6, %t7) :: integer
17
+ yield %t8
18
+ )
19
+ )
@@ -0,0 +1,24 @@
1
+ (LIR
2
+ (Declaration order_subtotal
3
+ %t1 = load_input "order_items" :: array
4
+ %t2 = importschemacall %t1 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
5
+ yield %t2
6
+ )
7
+ (Declaration tax_amount
8
+ %t9 = load_input "order_items" :: array
9
+ %t10 = importschemacall %t9 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
10
+ %t4 = load_input "tax_rate" :: integer
11
+ %t5 = call core.mul:numeric(%t10, %t4) :: integer
12
+ yield %t5
13
+ )
14
+ (Declaration total
15
+ %t11 = load_input "order_items" :: array
16
+ %t12 = importschemacall %t11 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
17
+ %t16 = load_input "order_items" :: array
18
+ %t17 = importschemacall %t16 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
19
+ %t14 = load_input "tax_rate" :: integer
20
+ %t15 = call core.mul:numeric(%t17, %t14) :: integer
21
+ %t8 = call core.add(%t12, %t15) :: integer
22
+ yield %t8
23
+ )
24
+ )
@@ -0,0 +1,22 @@
1
+ (LIR
2
+ (Declaration order_subtotal
3
+ %t1 = load_input "order_items" :: array
4
+ %t2 = importschemacall %t1 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
5
+ yield %t2
6
+ )
7
+ (Declaration tax_amount
8
+ %t9 = load_input "order_items" :: array
9
+ %t10 = importschemacall %t9 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
10
+ %t4 = load_input "tax_rate" :: integer
11
+ %t5 = call core.mul:numeric(%t10, %t4) :: integer
12
+ yield %t5
13
+ )
14
+ (Declaration total
15
+ %t11 = load_input "order_items" :: array
16
+ %t12 = importschemacall %t11 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
17
+ %t14 = load_input "tax_rate" :: integer
18
+ %t15 = call core.mul:numeric(%t12, %t14) :: integer
19
+ %t8 = call core.add(%t12, %t15) :: integer
20
+ yield %t8
21
+ )
22
+ )
@@ -0,0 +1,22 @@
1
+ (LIR
2
+ (Declaration order_subtotal
3
+ %t1 = load_input "order_items" :: array
4
+ %t2 = importschemacall %t1 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
5
+ yield %t2
6
+ )
7
+ (Declaration tax_amount
8
+ %t9 = load_input "order_items" :: array
9
+ %t10 = importschemacall %t9 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
10
+ %t4 = load_input "tax_rate" :: integer
11
+ %t5 = call core.mul:numeric(%t10, %t4) :: integer
12
+ yield %t5
13
+ )
14
+ (Declaration total
15
+ %t11 = load_input "order_items" :: array
16
+ %t12 = importschemacall %t11 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
17
+ %t14 = load_input "tax_rate" :: integer
18
+ %t15 = call core.mul:numeric(%t12, %t14) :: integer
19
+ %t8 = call core.add(%t12, %t15) :: integer
20
+ yield %t8
21
+ )
22
+ )
@@ -0,0 +1,22 @@
1
+ (LIR
2
+ (Declaration order_subtotal
3
+ %t1 = load_input "order_items" :: array
4
+ %t2 = importschemacall %t1 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
5
+ yield %t2
6
+ )
7
+ (Declaration tax_amount
8
+ %t9 = load_input "order_items" :: array
9
+ %t10 = importschemacall %t9 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
10
+ %t4 = load_input "tax_rate" :: integer
11
+ %t5 = call core.mul:numeric(%t10, %t4) :: integer
12
+ yield %t5
13
+ )
14
+ (Declaration total
15
+ %t11 = load_input "order_items" :: array
16
+ %t12 = importschemacall %t11 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
17
+ %t14 = load_input "tax_rate" :: integer
18
+ %t15 = call core.mul:numeric(%t12, %t14) :: integer
19
+ %t8 = call core.add(%t12, %t15) :: integer
20
+ yield %t8
21
+ )
22
+ )
@@ -0,0 +1,22 @@
1
+ (LIR
2
+ (Declaration order_subtotal
3
+ %t1 = load_input "order_items" :: array
4
+ %t2 = importschemacall %t1 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
5
+ yield %t2
6
+ )
7
+ (Declaration tax_amount
8
+ %t9 = load_input "order_items" :: array
9
+ %t10 = importschemacall %t9 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
10
+ %t4 = load_input "tax_rate" :: integer
11
+ %t5 = call core.mul:numeric(%t10, %t4) :: integer
12
+ yield %t5
13
+ )
14
+ (Declaration total
15
+ %t11 = load_input "order_items" :: array
16
+ %t12 = importschemacall %t11 fn_name="subtotal" source_module="Kumi::TestSharedSchemas::Subtotal" input_mapping_keys=["items"] :: integer
17
+ %t14 = load_input "tax_rate" :: integer
18
+ %t15 = call core.mul:numeric(%t12, %t14) :: integer
19
+ %t8 = call core.add(%t12, %t15) :: integer
20
+ yield %t8
21
+ )
22
+ )
@@ -0,0 +1,19 @@
1
+ (NAST
2
+ (VALUE order_subtotal
3
+ (ImportCall :subtotal
4
+ (items (InputRef [:order_items]))
5
+ )
6
+ )
7
+ (VALUE tax_amount
8
+ (Call :multiply
9
+ (Ref order_subtotal)
10
+ (InputRef [:tax_rate])
11
+ )
12
+ )
13
+ (VALUE total
14
+ (Call :add
15
+ (Ref order_subtotal)
16
+ (Ref tax_amount)
17
+ )
18
+ )
19
+ )
@@ -0,0 +1,23 @@
1
+ export function _order_subtotal(input) {
2
+ let t1 = input["order_items"];
3
+ let t2 = Kumi.TestSharedSchemas.Subtotal.from({'items': t1})._subtotal;
4
+ return t2;
5
+ }
6
+
7
+ export function _tax_amount(input) {
8
+ let t9 = input["order_items"];
9
+ let t10 = Kumi.TestSharedSchemas.Subtotal.from({'items': t9})._subtotal;
10
+ let t4 = input["tax_rate"];
11
+ let t5 = t10 * t4;
12
+ return t5;
13
+ }
14
+
15
+ export function _total(input) {
16
+ let t11 = input["order_items"];
17
+ let t12 = Kumi.TestSharedSchemas.Subtotal.from({'items': t11})._subtotal;
18
+ let t14 = input["tax_rate"];
19
+ let t15 = t12 * t14;
20
+ let t8 = t12 + t15;
21
+ return t8;
22
+ }
23
+
@@ -0,0 +1,22 @@
1
+ # Autogenerated by Kumi Codegen
2
+ module Kumi::Compiled::KUMI_20f9b0ca3a492d9c3175af190d6e04de64cfaec4f8d8e730c8581f39625883f9
3
+ def self._order_subtotal(input)
4
+ t1 = input["order_items"] || input[:order_items]
5
+ Kumi::TestSharedSchemas::Subtotal._subtotal({"items" => t1})
6
+ end
7
+
8
+ def self._tax_amount(input)
9
+ t9 = input["order_items"] || input[:order_items]
10
+ t10 = Kumi::TestSharedSchemas::Subtotal._subtotal({"items" => t9})
11
+ t4 = input["tax_rate"] || input[:tax_rate]
12
+ t10 * t4
13
+ end
14
+
15
+ def self._total(input)
16
+ t11 = input["order_items"] || input[:order_items]
17
+ t12 = Kumi::TestSharedSchemas::Subtotal._subtotal({"items" => t11})
18
+ t14 = input["tax_rate"] || input[:tax_rate]
19
+ t15 = t12 * t14
20
+ t12 + t15
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ (SNAST
2
+ (VALUE order_subtotal
3
+ (ImportCall :subtotal
4
+ (items (InputRef order_items key_chain=[]) :: [] -> array)
5
+ ) :: [] -> integer
6
+ ) :: [] -> integer
7
+ (VALUE tax_amount
8
+ (Call :core.mul:numeric
9
+ (Ref order_subtotal) :: [] -> integer
10
+ (InputRef tax_rate key_chain=[]) :: [] -> integer
11
+ ) :: [] -> integer
12
+ ) :: [] -> integer
13
+ (VALUE total
14
+ (Call :core.add
15
+ (Ref order_subtotal) :: [] -> integer
16
+ (Ref tax_amount) :: [] -> integer
17
+ ) :: [] -> integer
18
+ ) :: [] -> integer
19
+ )
@@ -0,0 +1,5 @@
1
+ {
2
+ "order_subtotal": 175,
3
+ "tax_amount": 1750,
4
+ "total": 1925
5
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "tax_rate": 10,
3
+ "order_items": [
4
+ {
5
+ "quantity": 2,
6
+ "unit_price": 50
7
+ },
8
+ {
9
+ "quantity": 3,
10
+ "unit_price": 25
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,17 @@
1
+ import :subtotal, from: Kumi::TestSharedSchemas::Subtotal
2
+
3
+ schema do
4
+ input do
5
+ integer :tax_rate
6
+ array :order_items do
7
+ hash :item do
8
+ integer :quantity
9
+ integer :unit_price
10
+ end
11
+ end
12
+ end
13
+
14
+ value :order_subtotal, subtotal(items: input.order_items)
15
+ value :tax_amount, order_subtotal * input.tax_rate
16
+ value :total, order_subtotal + tax_amount
17
+ end
@@ -0,0 +1,35 @@
1
+ (Root
2
+ inputs: [
3
+ (InputDeclaration :amount :decimal)
4
+ (InputDeclaration :discount_rate :decimal)
5
+ ]
6
+ values: [
7
+ (ValueDeclaration :tax_amount
8
+ (ImportCall :tax
9
+ (amount (InputReference :amount))
10
+ )
11
+ )
12
+ (ValueDeclaration :price_after_tax
13
+ (CallExpression :add
14
+ (InputReference :amount)
15
+ (DeclarationReference :tax_amount)
16
+ )
17
+ )
18
+ (ValueDeclaration :discounted_price
19
+ (ImportCall :discounted
20
+ (price (DeclarationReference :price_after_tax))
21
+ (rate (InputReference :discount_rate))
22
+ )
23
+ )
24
+ (ValueDeclaration :discount_amount
25
+ (ImportCall :savings
26
+ (price (DeclarationReference :price_after_tax))
27
+ (rate (InputReference :discount_rate))
28
+ )
29
+ )
30
+ (ValueDeclaration :final_price
31
+ (DeclarationReference :discounted_price)
32
+ )
33
+ ]
34
+ traits: []
35
+ )
@@ -0,0 +1,2 @@
1
+ amount: decimal
2
+ discount_rate: decimal
@@ -0,0 +1,29 @@
1
+ (LIR
2
+ (Declaration tax_amount
3
+ %t1 = load_input "amount" :: decimal
4
+ %t2 = importschemacall %t1 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
5
+ yield %t2
6
+ )
7
+ (Declaration price_after_tax
8
+ %t3 = load_input "amount" :: decimal
9
+ %t4 = load_decl tax_amount :: float
10
+ %t5 = call core.add(%t3, %t4) :: float
11
+ yield %t5
12
+ )
13
+ (Declaration discounted_price
14
+ %t6 = load_decl price_after_tax :: float
15
+ %t7 = load_input "discount_rate" :: decimal
16
+ %t8 = importschemacall %t6, %t7 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: float
17
+ yield %t8
18
+ )
19
+ (Declaration discount_amount
20
+ %t9 = load_decl price_after_tax :: float
21
+ %t10 = load_input "discount_rate" :: decimal
22
+ %t11 = importschemacall %t9, %t10 fn_name="savings" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: decimal
23
+ yield %t11
24
+ )
25
+ (Declaration final_price
26
+ %t12 = load_decl discounted_price :: float
27
+ yield %t12
28
+ )
29
+ )
@@ -0,0 +1,29 @@
1
+ (LIR
2
+ (Declaration tax_amount
3
+ %t1 = load_input "amount" :: decimal
4
+ %t2 = importschemacall %t1 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
5
+ yield %t2
6
+ )
7
+ (Declaration price_after_tax
8
+ %t3 = load_input "amount" :: decimal
9
+ %t4 = load_decl tax_amount :: float
10
+ %t5 = call core.add(%t3, %t4) :: float
11
+ yield %t5
12
+ )
13
+ (Declaration discounted_price
14
+ %t6 = load_decl price_after_tax :: float
15
+ %t7 = load_input "discount_rate" :: decimal
16
+ %t8 = importschemacall %t6, %t7 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: float
17
+ yield %t8
18
+ )
19
+ (Declaration discount_amount
20
+ %t9 = load_decl price_after_tax :: float
21
+ %t10 = load_input "discount_rate" :: decimal
22
+ %t11 = importschemacall %t9, %t10 fn_name="savings" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: decimal
23
+ yield %t11
24
+ )
25
+ (Declaration final_price
26
+ %t12 = load_decl discounted_price :: float
27
+ yield %t12
28
+ )
29
+ )
@@ -0,0 +1,41 @@
1
+ (LIR
2
+ (Declaration tax_amount
3
+ %t1 = load_input "amount" :: decimal
4
+ %t2 = importschemacall %t1 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
5
+ yield %t2
6
+ )
7
+ (Declaration price_after_tax
8
+ %t3 = load_input "amount" :: decimal
9
+ %t13 = load_input "amount" :: decimal
10
+ %t14 = importschemacall %t13 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
11
+ %t5 = call core.add(%t3, %t14) :: float
12
+ yield %t5
13
+ )
14
+ (Declaration discounted_price
15
+ %t15 = load_input "amount" :: decimal
16
+ %t18 = load_input "amount" :: decimal
17
+ %t19 = importschemacall %t18 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
18
+ %t17 = call core.add(%t15, %t19) :: float
19
+ %t7 = load_input "discount_rate" :: decimal
20
+ %t8 = importschemacall %t17, %t7 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: float
21
+ yield %t8
22
+ )
23
+ (Declaration discount_amount
24
+ %t20 = load_input "amount" :: decimal
25
+ %t23 = load_input "amount" :: decimal
26
+ %t24 = importschemacall %t23 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
27
+ %t22 = call core.add(%t20, %t24) :: float
28
+ %t10 = load_input "discount_rate" :: decimal
29
+ %t11 = importschemacall %t22, %t10 fn_name="savings" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: decimal
30
+ yield %t11
31
+ )
32
+ (Declaration final_price
33
+ %t28 = load_input "amount" :: decimal
34
+ %t31 = load_input "amount" :: decimal
35
+ %t32 = importschemacall %t31 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
36
+ %t30 = call core.add(%t28, %t32) :: float
37
+ %t26 = load_input "discount_rate" :: decimal
38
+ %t27 = importschemacall %t30, %t26 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: float
39
+ yield %t27
40
+ )
41
+ )
@@ -0,0 +1,37 @@
1
+ (LIR
2
+ (Declaration tax_amount
3
+ %t1 = load_input "amount" :: decimal
4
+ %t2 = importschemacall %t1 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
5
+ yield %t2
6
+ )
7
+ (Declaration price_after_tax
8
+ %t3 = load_input "amount" :: decimal
9
+ %t14 = importschemacall %t3 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
10
+ %t5 = call core.add(%t3, %t14) :: float
11
+ yield %t5
12
+ )
13
+ (Declaration discounted_price
14
+ %t15 = load_input "amount" :: decimal
15
+ %t19 = importschemacall %t15 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
16
+ %t17 = call core.add(%t15, %t19) :: float
17
+ %t7 = load_input "discount_rate" :: decimal
18
+ %t8 = importschemacall %t17, %t7 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: float
19
+ yield %t8
20
+ )
21
+ (Declaration discount_amount
22
+ %t20 = load_input "amount" :: decimal
23
+ %t24 = importschemacall %t20 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
24
+ %t22 = call core.add(%t20, %t24) :: float
25
+ %t10 = load_input "discount_rate" :: decimal
26
+ %t11 = importschemacall %t22, %t10 fn_name="savings" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: decimal
27
+ yield %t11
28
+ )
29
+ (Declaration final_price
30
+ %t28 = load_input "amount" :: decimal
31
+ %t32 = importschemacall %t28 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
32
+ %t30 = call core.add(%t28, %t32) :: float
33
+ %t26 = load_input "discount_rate" :: decimal
34
+ %t27 = importschemacall %t30, %t26 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: float
35
+ yield %t27
36
+ )
37
+ )
@@ -0,0 +1,37 @@
1
+ (LIR
2
+ (Declaration tax_amount
3
+ %t1 = load_input "amount" :: decimal
4
+ %t2 = importschemacall %t1 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
5
+ yield %t2
6
+ )
7
+ (Declaration price_after_tax
8
+ %t3 = load_input "amount" :: decimal
9
+ %t14 = importschemacall %t3 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
10
+ %t5 = call core.add(%t3, %t14) :: float
11
+ yield %t5
12
+ )
13
+ (Declaration discounted_price
14
+ %t15 = load_input "amount" :: decimal
15
+ %t19 = importschemacall %t15 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
16
+ %t17 = call core.add(%t15, %t19) :: float
17
+ %t7 = load_input "discount_rate" :: decimal
18
+ %t8 = importschemacall %t17, %t7 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: float
19
+ yield %t8
20
+ )
21
+ (Declaration discount_amount
22
+ %t20 = load_input "amount" :: decimal
23
+ %t24 = importschemacall %t20 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
24
+ %t22 = call core.add(%t20, %t24) :: float
25
+ %t10 = load_input "discount_rate" :: decimal
26
+ %t11 = importschemacall %t22, %t10 fn_name="savings" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: decimal
27
+ yield %t11
28
+ )
29
+ (Declaration final_price
30
+ %t28 = load_input "amount" :: decimal
31
+ %t32 = importschemacall %t28 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
32
+ %t30 = call core.add(%t28, %t32) :: float
33
+ %t26 = load_input "discount_rate" :: decimal
34
+ %t27 = importschemacall %t30, %t26 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: float
35
+ yield %t27
36
+ )
37
+ )
@@ -0,0 +1,37 @@
1
+ (LIR
2
+ (Declaration tax_amount
3
+ %t1 = load_input "amount" :: decimal
4
+ %t2 = importschemacall %t1 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
5
+ yield %t2
6
+ )
7
+ (Declaration price_after_tax
8
+ %t3 = load_input "amount" :: decimal
9
+ %t14 = importschemacall %t3 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
10
+ %t5 = call core.add(%t3, %t14) :: float
11
+ yield %t5
12
+ )
13
+ (Declaration discounted_price
14
+ %t15 = load_input "amount" :: decimal
15
+ %t19 = importschemacall %t15 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
16
+ %t17 = call core.add(%t15, %t19) :: float
17
+ %t7 = load_input "discount_rate" :: decimal
18
+ %t8 = importschemacall %t17, %t7 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: float
19
+ yield %t8
20
+ )
21
+ (Declaration discount_amount
22
+ %t20 = load_input "amount" :: decimal
23
+ %t24 = importschemacall %t20 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
24
+ %t22 = call core.add(%t20, %t24) :: float
25
+ %t10 = load_input "discount_rate" :: decimal
26
+ %t11 = importschemacall %t22, %t10 fn_name="savings" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: decimal
27
+ yield %t11
28
+ )
29
+ (Declaration final_price
30
+ %t28 = load_input "amount" :: decimal
31
+ %t32 = importschemacall %t28 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
32
+ %t30 = call core.add(%t28, %t32) :: float
33
+ %t26 = load_input "discount_rate" :: decimal
34
+ %t27 = importschemacall %t30, %t26 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: float
35
+ yield %t27
36
+ )
37
+ )
@@ -0,0 +1,37 @@
1
+ (LIR
2
+ (Declaration tax_amount
3
+ %t1 = load_input "amount" :: decimal
4
+ %t2 = importschemacall %t1 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
5
+ yield %t2
6
+ )
7
+ (Declaration price_after_tax
8
+ %t3 = load_input "amount" :: decimal
9
+ %t14 = importschemacall %t3 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
10
+ %t5 = call core.add(%t3, %t14) :: float
11
+ yield %t5
12
+ )
13
+ (Declaration discounted_price
14
+ %t15 = load_input "amount" :: decimal
15
+ %t19 = importschemacall %t15 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
16
+ %t17 = call core.add(%t15, %t19) :: float
17
+ %t7 = load_input "discount_rate" :: decimal
18
+ %t8 = importschemacall %t17, %t7 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: float
19
+ yield %t8
20
+ )
21
+ (Declaration discount_amount
22
+ %t20 = load_input "amount" :: decimal
23
+ %t24 = importschemacall %t20 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
24
+ %t22 = call core.add(%t20, %t24) :: float
25
+ %t10 = load_input "discount_rate" :: decimal
26
+ %t11 = importschemacall %t22, %t10 fn_name="savings" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: decimal
27
+ yield %t11
28
+ )
29
+ (Declaration final_price
30
+ %t28 = load_input "amount" :: decimal
31
+ %t32 = importschemacall %t28 fn_name="tax" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
32
+ %t30 = call core.add(%t28, %t32) :: float
33
+ %t26 = load_input "discount_rate" :: decimal
34
+ %t27 = importschemacall %t30, %t26 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Discount" input_mapping_keys=["price", "rate"] :: float
35
+ yield %t27
36
+ )
37
+ )
@@ -0,0 +1,28 @@
1
+ (NAST
2
+ (VALUE tax_amount
3
+ (ImportCall :tax
4
+ (amount (InputRef [:amount]))
5
+ )
6
+ )
7
+ (VALUE price_after_tax
8
+ (Call :add
9
+ (InputRef [:amount])
10
+ (Ref tax_amount)
11
+ )
12
+ )
13
+ (VALUE discounted_price
14
+ (ImportCall :discounted
15
+ (price (Ref price_after_tax))
16
+ (rate (InputRef [:discount_rate]))
17
+ )
18
+ )
19
+ (VALUE discount_amount
20
+ (ImportCall :savings
21
+ (price (Ref price_after_tax))
22
+ (rate (InputRef [:discount_rate]))
23
+ )
24
+ )
25
+ (VALUE final_price
26
+ (Ref discounted_price)
27
+ )
28
+ )