mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
def statement and define_method now return symbol a la Ruby2.1
This commit is contained in:
+1
-1
@@ -1486,7 +1486,7 @@ mod_define_method(mrb_state *mrb, mrb_value self)
|
||||
mrb_proc_copy(p, mrb_proc_ptr(blk));
|
||||
p->flags |= MRB_PROC_STRICT;
|
||||
mrb_define_method_raw(mrb, c, mid, p);
|
||||
return blk;
|
||||
return mrb_symbol_value(mid);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+2
-2
@@ -2317,7 +2317,7 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
pop();
|
||||
genop(s, MKOP_AB(OP_METHOD, cursp(), sym));
|
||||
if (val) {
|
||||
genop(s, MKOP_A(OP_LOADNIL, cursp()));
|
||||
genop(s, MKOP_ABx(OP_LOADSYM, cursp(), sym));
|
||||
push();
|
||||
}
|
||||
}
|
||||
@@ -2337,7 +2337,7 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
pop();
|
||||
genop(s, MKOP_AB(OP_METHOD, cursp(), sym));
|
||||
if (val) {
|
||||
genop(s, MKOP_A(OP_LOADNIL, cursp()));
|
||||
genop(s, MKOP_ABx(OP_LOADSYM, cursp(), sym));
|
||||
push();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user