Commit 0b3bd1a3
0b3bd1a36903Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
refactor(codegen): hoist AndNode operand IDs to locals
Mirror the OrNode pattern in the block immediately below: extract left_nid / right_nid once instead of indexing @nd_left / @nd_right twice. No behavior change.
Refs #250
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- 0b3bd1a36903
- Parent
- 4017ead0d098
spinel_codegen.rbmodifiedView file
@@ -17099,10 +17099,12 @@
1709917099
return compile_unless_expr(nid)1710017100
end1710117101
if t == "AndNode"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])17102+
left_nid = @nd_left[nid]17103+
right_nid = @nd_right[nid]17104+
lt = infer_type(left_nid)17105+
rt = infer_type(right_nid)17106+
le = compile_expr(left_nid)17107+
re = compile_expr(right_nid)1710617108
le_t = lt == "poly" ? "sp_poly_truthy(" + le + ")" : le1710717109
re_t = rt == "poly" ? "sp_poly_truthy(" + re + ")" : re1710817110
return "(" + le_t + " && " + re_t + ")"