Commit 58c3e62f
58c3e62f6054Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
codegen: clarify the poly-dispatch void-arm comment
Adopt the improved comment from Sam Ruby's #1470 (a follow-up to #1469 that landed independently in 744da4d5): spell out that the guard fires when the override is emitted as a void C function -- method_is_void, i.e. a VOID/NIL/ UNKNOWN return type, or initialize. Comment only; no generated-code change.
Refs #1469, #1470
Co-Authored-By: Sam Ruby [email protected] Co-Authored-By: Claude Opus 4.8 [email protected]
Details
- Commit
- 58c3e62f6054
- Parent
- 226d77e17962
src/codegen_fold.cmodifiedView file
@@ -3121,7 +3121,8 @@
31213121
TyKind arm_ret = (TyKind)c->scopes[kmi].ret;31223122
const char *kfn = mc(c->scopes[kmi].name);31233123
if (method_is_void(&c->scopes[kmi])) {3124-
/* void-returning override: call it, assign nil/zero to the result temp */3124+
/* override emitted as a void C function (method_is_void: VOID/NIL/UNKNOWN3125+
ret, or initialize) -- call it, assign nil/zero to the result temp */31253126
buf_printf(b, " case %d: sp_%s_%s((sp_%s *)%s", k,31263127
c->classes[kd].name, kfn, c->classes[kd].name, selfptr);31273128
for (int a = 0; a < np; a++) buf_printf(b, ", _t%d", atmp[a]);