mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
The bug was in codegen_colon3 which used genop_2(OP_OCLASS, sym) treating OCLASS as BB format, but OCLASS is B format that only loads ::Object without a symbol parameter. The fix uses the correct two-instruction pattern: OCLASS to load Object class, then GETMCNST to retrieve the constant from it. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5271,9 +5271,9 @@ static void
|
||||
codegen_colon3(codegen_scope *s, node *varnode, int val)
|
||||
{
|
||||
struct mrb_ast_colon3_node *n = (struct mrb_ast_colon3_node*)varnode;
|
||||
// Generate COLON3 (::Name) access manually
|
||||
int sym = new_sym(s, n->name);
|
||||
genop_2(s, OP_OCLASS, cursp(), sym);
|
||||
genop_1(s, OP_OCLASS, cursp());
|
||||
genop_2(s, OP_GETMCNST, cursp(), sym);
|
||||
if (val) push();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user