mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
+1
-2
@@ -286,8 +286,7 @@ genop_peep(codegen_scope *s, mrb_code i, int val)
|
||||
case OP_RANGE:
|
||||
case OP_AREF:
|
||||
case OP_GETUPVAR:
|
||||
s->iseq[s->pc-1] = MKOP_ABC(c0, 0, GETARG_B(i0), GETARG_C(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_SETIV:
|
||||
case OP_SETCV:
|
||||
|
||||
@@ -54,3 +54,19 @@ assert('Proc#call', '15.2.17.4.3') do
|
||||
assert_equal 1, a
|
||||
assert_equal 5, a2
|
||||
end
|
||||
|
||||
assert('Proc#return_does_not_break_self') do
|
||||
class TestClass
|
||||
attr_accessor :block
|
||||
def initialize
|
||||
end
|
||||
def register_block
|
||||
@block = Proc.new { self }
|
||||
return []
|
||||
end
|
||||
end
|
||||
|
||||
c = TestClass.new
|
||||
assert_equal [], c.register_block
|
||||
assert_equal c, c.block.call
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user