зеркало из https://github.com/github/ruby.git
Fix segfault when using method reference operator without using result
Fixes [Bug #15985]
This commit is contained in:
Родитель
688cef2169
Коммит
f296c260ef
|
@ -8146,8 +8146,11 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
|
|||
break;
|
||||
}
|
||||
case NODE_METHREF:
|
||||
CHECK(COMPILE_(ret, "receiver", node->nd_recv, popped));
|
||||
CHECK(COMPILE(ret, "receiver", node->nd_recv));
|
||||
ADD_ELEM(ret, &new_insn_body(iseq, line, BIN(methodref), 1, ID2SYM(node->nd_mid))->link);
|
||||
if (popped) {
|
||||
ADD_INSN(ret, line, pop);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
UNKNOWN_NODE("iseq_compile_each", node, COMPILE_NG);
|
||||
|
|
|
@ -93,6 +93,13 @@ class TestSyntax < Test::Unit::TestCase
|
|||
assert_valid_syntax("tap (proc do end)", __FILE__, bug9726)
|
||||
end
|
||||
|
||||
def test_methodref_literal
|
||||
assert_separately [], <<-EOS
|
||||
eval 'nil.:|;1'
|
||||
1000.times{eval 'nil.:|;1'}
|
||||
EOS
|
||||
end
|
||||
|
||||
def test_normal_argument
|
||||
assert_valid_syntax('def foo(x) end')
|
||||
assert_syntax_error('def foo(X) end', /constant/)
|
||||
|
|
Загрузка…
Ссылка в новой задаче