Commit 26c72506
26c725060f9eMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
fix(codegen): str_sub_range_r and sp_sleep unbox bigint args
Details
- Commit
- 26c725060f9e
- Parent
- fc5b0c4da28c
spinel_codegen.rbmodifiedView file
@@ -14902,7 +14902,7 @@
1490214902
if mname == "sleep"1490314903
args_id = @nd_arguments[nid]1490414904
if args_id >= 014905-
emit(" sp_sleep((mrb_float)" + compile_arg0(nid) + ");")14905+
emit(" sp_sleep(" + compile_arg0_as_float(nid) + ");")1490614906
end1490714907
return "0"1490814908
end@@ -17288,12 +17288,22 @@
1728817288
left = "0"1728917289
else1729017290
left = compile_expr(left_nid_543)17291+
# promote-mode: range bounds may be bigint LVs; unbox to17292+
# mrb_int for the runtime helper.17293+
if infer_type(left_nid_543) == "bigint" || expr_emit_is_bigint(left_nid_543) == 117294+
@needs_bigint = 117295+
left = "sp_bigint_to_int((sp_Bigint *)" + left + ")"17296+
end1729117297
end1729217298
if right_nid_543 < 01729317299
right = "-1"1729417300
excl_543 = "0"1729517301
else1729617302
right = compile_expr(right_nid_543)17303+
if infer_type(right_nid_543) == "bigint" || expr_emit_is_bigint(right_nid_543) == 117304+
@needs_bigint = 117305+
right = "sp_bigint_to_int((sp_Bigint *)" + right + ")"17306+
end1729717307
excl_543 = (range_excl_end(range_node_543) == 1 ? "1" : "0")1729817308
end1729917309
return (use_len ? "sp_str_sub_range_len_r" : "sp_str_sub_range_r") + "(" + lprefix + ", " + left + ", " + right + ", " + excl_543 + ")"