Commit 7c7a0d1b
7c7a0d1b7db1Merged
ydah <[email protected]> · 6 months ago · 4 files · +2 added · ~2 modified
Description
fix(codegen): use ruby truthiness for scalar conditions
Details
- Commit
- 7c7a0d1b7db1
- Parent
- 1c819212d772
spinel_analyze.rbmodifiedView file
@@ -2585,6 +2585,10 @@
25852585
mname = @nd_name[nid]25862586
recv = @nd_receiver[nid]25872587
2588+
if recv < 0 && mname == "block_given?"2589+
return "bool"2590+
end2591+
25882592
# Methods on a `rescue => e` bound exception variable. The variable25892593
# itself is string-typed but .class / .message / .to_s / .inspect /25902594
# .full_message return strings; .backtrace returns nil for now.@@ -3087,7 +3091,7 @@
30873091
return "int"30883092
end30893093
if mname == "=~"3090-
return "int"3094+
return "bool"30913095
end30923096
if mname == "<<"30933097
if recv >= 0spinel_codegen.rbmodifiedView file
Loading diff…
test/scalar_zero_truthiness.rbaddedView file
Loading diff…
test/scalar_zero_truthiness.rb.expectedaddedView file
Loading diff…