Commit 815177af authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #883 from masamitsu-murase/modify_node_rescue_handling

Adjust stack position of NODE_RESCUE.
parents bbd50cca efa18038
......@@ -1083,6 +1083,7 @@ codegen(codegen_scope *s, node *tree, int val)
}
if (n3->cdr->cdr->car) {
codegen(s, n3->cdr->cdr->car, val);
if (val) pop();
}
tmp = new_label(s);
genop(s, MKOP_sBx(OP_JMP, exend));
......@@ -1102,6 +1103,9 @@ codegen(codegen_scope *s, node *tree, int val)
if (tree->car) {
codegen(s, tree->car, val);
}
else if (val) {
push();
}
dispatch_linked(s, exend);
loop_pop(s, NOVAL);
}
......
......@@ -287,6 +287,34 @@ assert('Exception 16') do
end
end
assert('Exception 17') do
begin
raise "a" # StandardError
rescue ArgumentError
1
rescue StandardError
2
else
3
ensure
4
end == 2
end
assert('Exception 18') do
begin
0
rescue ArgumentError
1
rescue StandardError
2
else
3
ensure
4
end == 3
end
assert('Exception#inspect without message') do
Exception.new.inspect
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment