Commit 4017ead0
4017ead0d098Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 2 files · +1 added · ~1 modified
Description
Merge pull request #250 from mame/pr/and-node-poly-truthy
fix(codegen): AndNode wraps poly operand with sp_poly_truthy
Details
- Commit
- 4017ead0d098
- Parent
- 7961c572b4e2
- Merge parent
- 6edc17bcc53e
spinel_codegen.rbmodifiedView file
@@ -17099,7 +17099,13 @@
1709917099
return compile_unless_expr(nid)1710017100
end1710117101
if t == "AndNode"17102-
return "(" + compile_expr(@nd_left[nid]) + " && " + compile_expr(@nd_right[nid]) + ")"17102+
lt = infer_type(@nd_left[nid])17103+
rt = infer_type(@nd_right[nid])17104+
le = compile_expr(@nd_left[nid])17105+
re = compile_expr(@nd_right[nid])17106+
le_t = lt == "poly" ? "sp_poly_truthy(" + le + ")" : le17107+
re_t = rt == "poly" ? "sp_poly_truthy(" + re + ")" : re17108+
return "(" + le_t + " && " + re_t + ")"1710317109
end1710417110
if t == "OrNode"1710517111
left_nid = @nd_left[nid]test/and_node_poly_operand.rbaddedView file
Loading diff…