Commit 669963c7

669963c7aed7Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified

Description

Box Fiber/IO into poly in emit_boxed_text

emit_boxed_text lacked TY_FIBER / TY_IO cases, so a poly-dispatch arm that boxed a Fiber-returning method (e.g. @video.dispose -> NES#dispose returning the PPU fiber) fell through to the sp_box_int fallback, passing a pointer to sp_box_int (the 6 optcarrot -Wint-conversion warnings). Mirror emit_boxed: box them via sp_box_obj with SP_BUILTIN_FIBER / SP_BUILTIN_IO.

Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]

Details

Commit
669963c7aed7
Parent
f7ae6bebe792

src/codegen.cmodifiedView file

@@ -3,6 +3,8 @@
33 void emit_boxed_text(Compiler *c, TyKind t, const char *expr, Buf *b) {
44 if (t == TY_POLY) { buf_puts(b, expr); return; }
55 if (t == TY_EXCEPTION) { buf_printf(b, "sp_box_obj(%s, SP_BUILTIN_EXCEPTION)", expr); return; }
6+ if (t == TY_FIBER) { buf_printf(b, "sp_box_obj((void *)(%s), SP_BUILTIN_FIBER)", expr); return; }
7+ if (t == TY_IO) { buf_printf(b, "sp_box_obj((void *)(%s), SP_BUILTIN_IO)", expr); return; }
68 if (ty_is_object(t)) { buf_printf(b, "sp_box_obj(%s, %d)", expr, ty_object_class(t)); return; }
79 if (ty_is_hash(t) && hash_box_cls(t)) { buf_printf(b, "sp_box_obj(%s, %s)", expr, hash_box_cls(t)); return; }
810 const char *fn = NULL;