Commit 53b92f29
53b92f29ed2dMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · +2 added · ~1 modified
Description
Merge pull request #460 from ryanseys/rs-proc-anon-dot-call
fix(codegen): dispatch .call on anonymous proc receiver (incl. chained / ternary)
Details
- Commit
- 53b92f29ed2d
- Parent
- 32d326c660eb
- Merge parent
- 5e9604f42efc
spinel_codegen.rbmodifiedView file
@@ -13024,6 +13024,20 @@
1302413024
return "sp_proc_call(lv_" + rname + ", (mrb_int[]){" + ca + "})"1302513025
end1302613026
end13027+
13028+
# Anonymous-proc-receiver dispatch — `proc { ... }.call`, or any13029+
# expression chain whose inferred type is `proc` (e.g.13030+
# `factory().call`). The LocalVariableReadNode branch above handles13031+
# the named-proc case directly; this generic branch compiles the13032+
# receiver expression and feeds it to sp_proc_call, using the same13033+
# arg-array packing convention.13034+
if infer_type(recv) == "proc"13035+
ca_anon = compile_call_args(nid)13036+
if ca_anon == ""13037+
ca_anon = "0"13038+
end13039+
return "sp_proc_call(" + compile_expr(recv) + ", (mrb_int[]){" + ca_anon + "})"13040+
end1302713041
end1302813042
""1302913043
endtest/proc_anon_dot_call.rbaddedView file
Loading diff…
test/proc_anon_dot_call.rb.expectedaddedView file
Loading diff…