summaryrefslogtreecommitdiffhomepage
path: root/src/codegen.c
diff options
context:
space:
mode:
authorKeita Obo <[email protected]>2013-09-18 00:57:23 +0900
committerKeita Obo <[email protected]>2013-09-18 00:57:23 +0900
commitc4e5a8b1675a187afaf04fb54b09d6a35c83e045 (patch)
treefdf45ef6151de836f7e9a2669674903dc5db8bb7 /src/codegen.c
parent0bce3a36d2b6b0d4bccdbf3b75b279a13fbb22e4 (diff)
downloadmruby-c4e5a8b1675a187afaf04fb54b09d6a35c83e045.tar.gz
mruby-c4e5a8b1675a187afaf04fb54b09d6a35c83e045.zip
Fix self value in a block is changed with return value for Fixnum, nil, instance variable.
Fix #1504
Diffstat (limited to 'src/codegen.c')
-rw-r--r--src/codegen.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/codegen.c b/src/codegen.c
index 7e5a7fa50..cb25c61b6 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -278,8 +278,7 @@ genop_peep(codegen_scope *s, mrb_code i, int val)
s->iseq[s->pc-1] = MKOP_AB(OP_RETURN, GETARG_B(i0), OP_R_NORMAL);
return;
case OP_LOADI:
- s->iseq[s->pc-1] = MKOP_AsBx(OP_LOADI, 0, GETARG_sBx(i0));
- genop(s, MKOP_AB(OP_RETURN, 0, OP_R_NORMAL));
+ genop(s, MKOP_AB(OP_RETURN, GETARG_A(i0), OP_R_NORMAL));
return;
case OP_ARRAY:
case OP_HASH:
@@ -307,8 +306,8 @@ genop_peep(codegen_scope *s, mrb_code i, int val)
case OP_GETSPECIAL:
case OP_LOADL:
case OP_STRING:
- s->iseq[s->pc-1] = MKOP_ABx(c0, 0, GETARG_Bx(i0));
- genop(s, MKOP_AB(OP_RETURN, 0, OP_R_NORMAL));
+ s->iseq[s->pc-1] = MKOP_ABx(c0, GETARG_A(i0), GETARG_Bx(i0));
+ genop(s, MKOP_AB(OP_RETURN, GETARG_A(i0), OP_R_NORMAL));
return;
case OP_SCLASS:
s->iseq[s->pc-1] = MKOP_AB(c0, GETARG_A(i), GETARG_B(i0));
@@ -319,8 +318,7 @@ genop_peep(codegen_scope *s, mrb_code i, int val)
case OP_LOADT:
case OP_LOADF:
case OP_OCLASS:
- s->iseq[s->pc-1] = MKOP_A(c0, 0);
- genop(s, MKOP_AB(OP_RETURN, 0, OP_R_NORMAL));
+ genop(s, MKOP_AB(OP_RETURN, GETARG_A(i0), OP_R_NORMAL));
return;
#if 0
case OP_SEND: