Commit 669739cd

669739cdfcf7Merged

ydah <[email protected]> · 6 months ago · 6 files · ~6 modified

Description

fix(codegen): handle self block_given and regex truthiness

Details

Commit
669739cdfcf7
Parent
7c7a0d1b7db1

spinel_analyze.rbmodifiedView file

@@ -2585,8 +2585,10 @@
25852585 mname = @nd_name[nid]
25862586 recv = @nd_receiver[nid]
25872587
2588- if recv < 0 && mname == "block_given?"
2589- return "bool"
2588+ if mname == "block_given?"
2589+ if recv < 0 || (recv >= 0 && @nd_type[recv] == "SelfNode")
2590+ return "bool"
2591+ end
25902592 end
25912593
25922594 # Methods on a `rescue => e` bound exception variable. The variable
@@ -3091,7 +3093,7 @@
30913093 return "int"
30923094 end
30933095 if mname == "=~"
3094- return "bool"
3096+ return "int"
30953097 end
30963098 if mname == "<<"
30973099 if recv >= 0