summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--prism_compile.c8
-rw-r--r--test/ruby/test_compile_prism.rb3
2 files changed, 9 insertions, 2 deletions
@@ -3994,9 +3994,11 @@ pm_compile_defined_expr0(rb_iseq_t *iseq, const pm_node_t *node, const pm_node_l
return;
}
case PM_CALL_NODE: {
const pm_call_node_t *cast = ((const pm_call_node_t *) node);
- if (cast->block != NULL && PM_NODE_TYPE_P(cast->block, PM_BLOCK_NODE)) {
dtype = DEFINED_EXPR;
break;
}
@@ -4016,7 +4018,7 @@ pm_compile_defined_expr0(rb_iseq_t *iseq, const pm_node_t *node, const pm_node_l
if (cast->receiver) {
pm_compile_defined_expr0(iseq, cast->receiver, node_location, ret, popped, scope_node, true, lfinish, true);
- if (PM_NODE_TYPE_P(cast->receiver, PM_CALL_NODE)) {
PUSH_INSNL(ret, location, branchunless, lfinish[2]);
const pm_call_node_t *receiver = (const pm_call_node_t *) cast->receiver;
@@ -4038,6 +4040,8 @@ pm_compile_defined_expr0(rb_iseq_t *iseq, const pm_node_t *node, const pm_node_l
}
return;
}
case PM_YIELD_NODE:
PUSH_INSN(ret, location, putnil);
@@ -207,6 +207,9 @@ 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