Commit 000fe5e5

000fe5e5ce2aMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · +2 added · ~1 modified

Description

Merge pull request #317 from mame/pr/poly-array-push-handlers

fix(codegen): poly_array << / push handlers in both expr and stmt context

Details

Commit
000fe5e5ce2a
Parent
42c00eb066d0
Merge parent
8ad869e58a58

spinel_codegen.rbmodifiedView file

@@ -22044,6 +22044,12 @@
2204422044 rc = compile_expr_gc_rooted(recv)
2204522045 return "(sp_PtrArray_push(" + rc + ", " + compile_arg0(nid) + "), " + rc + ")"
2204622046 end
22047+ if lt == "poly_array"
22048+ @needs_rb_value = 1
22049+ @needs_gc = 1
22050+ rc = compile_expr_gc_rooted(recv)
22051+ return "(sp_PolyArray_push(" + rc + ", " + box_expr_to_poly(get_args(@nd_arguments[nid])[0]) + "), " + rc + ")"
22052+ end
2204722053 if lt == "poly"
2204822054 @needs_rb_value = 1
2204922055 return "sp_poly_shl(" + compile_expr(recv) + ", " + box_expr_to_poly(get_args(@nd_arguments[nid])[0]) + ")"
@@ -29310,6 +29316,22 @@
2931029316 emit(" sp_PtrArray_push(" + rc + ", " + compile_arg0(nid) + ");")
2931129317 return 1
2931229318 end
29319+ if rt == "poly_array"
29320+ rc = compile_expr_gc_rooted(recv)
29321+ args_id3 = @nd_arguments[nid]
29322+ if args_id3 >= 0
29323+ aa = get_args(args_id3)
29324+ if aa.length > 0
29325+ vt = infer_type(aa[0])
29326+ vexpr = compile_expr(aa[0])
29327+ if vt != "poly"
29328+ vexpr = box_value_to_poly(vt, vexpr)
29329+ end
29330+ emit(" sp_PolyArray_push(" + rc + ", " + vexpr + ");")
29331+ return 1
29332+ end
29333+ end
29334+ end
2931329335 end
2931429336 end
2931529337