Commit cb11b146

cb11b146dcbfMerged

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

Description

puts on a bare class constant renders the class name

Co-Authored-By: Claude Opus 4.8 [email protected]

Details

Commit
cb11b146dcbf
Parent
fe8f7860bf11

src/codegen.cmodifiedView file

@@ -3907,6 +3907,11 @@
39073907 else if (t == TY_NIL) {
39083908 buf_puts(b, "(void)("); emit_expr(c, arg, b); buf_puts(b, "); putchar('\\n'); /* puts nil */\n");
39093909 }
3910+ else if (nt_type(c->nt, arg) && !strcmp(nt_type(c->nt, arg), "ConstantReadNode") &&
3911+ nt_str(c->nt, arg, "name") && comp_class_index(c, nt_str(c->nt, arg, "name")) >= 0) {
3912+ /* `puts SomeClass` -- a bare class constant renders its name */
3913+ buf_printf(b, "puts(\"%s\");\n", nt_str(c->nt, arg, "name"));
3914+ }
39103915 else {
39113916 unsupported(c, arg, "puts argument");
39123917 }