def statement and define_method now return symbol a la Ruby2.1

This commit is contained in:
Yukihiro "Matz" Matsumoto
2013-08-09 22:25:45 +09:00
parent 3d3ca985b0
commit 53f750dbed
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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
View File
@@ -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();
}
}