Merge pull request #570 from skandhas/pr-remove-redundant-LOOP_NORMAL-checkups

remove redundant LOOP_NORMAL checkups in function:codegen. and fix #561
This commit is contained in:
Yukihiro "Matz" Matsumoto
2012-11-23 02:50:34 -08:00
2 changed files with 30 additions and 2 deletions
+1 -1
View File
@@ -1501,7 +1501,7 @@ codegen(codegen_scope *s, node *tree, int val)
case NODE_RETURN:
codegen(s, tree, VAL);
pop();
if (s->loop && s->loop->type != LOOP_NORMAL) {
if (s->loop) {
genop(s, MKOP_AB(OP_RETURN, cursp(), OP_R_RETURN));
}
else {
+29 -1
View File
@@ -389,7 +389,7 @@ assert('BS Block [ruby-core:14395]') do
t.test_for_bug
end
assert("BS Block 32") do
assert("BS Block 33") do
module TestReturnFromNestedBlock
def self.test
1.times do
@@ -402,3 +402,31 @@ assert("BS Block 32") do
end
TestReturnFromNestedBlock.test == :ok
end
assert("BS Block 34") do
module TestReturnFromNestedBlock_BSBlock34
def self.test
1.times do
while true
return :ok
end
end
:bad
end
end
TestReturnFromNestedBlock_BSBlock34.test == :ok
end
assert("BS Block 35") do
module TestReturnFromNestedBlock_BSBlock35
def self.test
1.times do
until false
return :ok
end
end
:bad
end
end
TestReturnFromNestedBlock_BSBlock35.test == :ok
end