зеркало из https://github.com/github/ruby.git
Родитель
d6b6e14c87
Коммит
0520e9675b
|
@ -2607,8 +2607,10 @@ pm_compile_defined_expr0(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *co
|
|||
pm_compile_defined_expr0(iseq, call_node->receiver, ret, src, popped, scope_node, dummy_line_node, lineno, true, lfinish, true);
|
||||
if (PM_NODE_TYPE_P(call_node->receiver, PM_CALL_NODE)) {
|
||||
ADD_INSNL(ret, &dummy_line_node, branchunless, lfinish[2]);
|
||||
ID method_id = pm_constant_id_lookup(scope_node, call_node->name);
|
||||
pm_compile_call(iseq, (const pm_call_node_t *)call_node->receiver, ret, src, popped, scope_node, method_id, NULL);
|
||||
|
||||
const pm_call_node_t *receiver = (const pm_call_node_t *)call_node->receiver;
|
||||
ID method_id = pm_constant_id_lookup(scope_node, receiver->name);
|
||||
pm_compile_call(iseq, receiver, ret, src, popped, scope_node, method_id, NULL);
|
||||
}
|
||||
else {
|
||||
ADD_INSNL(ret, &dummy_line_node, branchunless, lfinish[1]);
|
||||
|
|
|
@ -209,6 +209,15 @@ module Prism
|
|||
|
||||
assert_prism_eval("defined?(a(itself))")
|
||||
assert_prism_eval("defined?(itself(itself))")
|
||||
|
||||
# Method chain on a constant
|
||||
assert_prism_eval(<<~RUBY)
|
||||
class PrismDefinedNode
|
||||
def m1; end
|
||||
end
|
||||
|
||||
defined?(PrismDefinedNode.new.m1)
|
||||
RUBY
|
||||
end
|
||||
|
||||
def test_GlobalVariableReadNode
|
||||
|
|
Загрузка…
Ссылка в новой задаче