diff --git a/prism_compile.c b/prism_compile.c index 865cbfc116..290d5e686d 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -770,7 +770,7 @@ pm_compile_call_and_or_write_node(bool and_node, pm_node_t *receiver, pm_node_t flag = VM_CALL_FCALL; } - PM_COMPILE(receiver); + PM_COMPILE_NOT_POPPED(receiver); ID write_name_id = pm_constant_id_lookup(scope_node, write_name); ID read_name_id = pm_constant_id_lookup(scope_node, read_name); @@ -790,7 +790,7 @@ pm_compile_call_and_or_write_node(bool and_node, pm_node_t *receiver, pm_node_t PM_POP_UNLESS_POPPED; - PM_COMPILE(value); + PM_COMPILE_NOT_POPPED(value); if (!popped) { PM_SWAP; ADD_INSN1(ret, &dummy_line_node, topn, INT2FIX(1)); diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 8cf84a7c94..bc05214ffa 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -699,21 +699,21 @@ module Prism end def test_CallAndWriteNode -=begin assert_prism_eval(<<-CODE - def Subclass.test_call_and_write_node; end; - Subclass.test_call_and_write_node &&= 1 + class PrismTestSubclass; end + def PrismTestSubclass.test_call_and_write_node; end; + PrismTestSubclass.test_call_and_write_node &&= 1 CODE ) assert_prism_eval(<<-CODE - def Subclass.test_call_and_write_node + def PrismTestSubclass.test_call_and_write_node "str" end - def Subclass.test_call_and_write_node=(val) + def PrismTestSubclass.test_call_and_write_node=(val) val end - Subclass.test_call_and_write_node &&= 1 + PrismTestSubclass.test_call_and_write_node &&= 1 CODE ) @@ -733,25 +733,24 @@ module Prism self.test_call_and_write_node &&= 1 CODE ) -=end end def test_CallOrWriteNode -=begin assert_prism_eval(<<-CODE - def Subclass.test_call_or_write_node; end; - def Subclass.test_call_or_write_node=(val) + class PrismTestSubclass; end + def PrismTestSubclass.test_call_or_write_node; end; + def PrismTestSubclass.test_call_or_write_node=(val) val end - Subclass.test_call_or_write_node ||= 1 + PrismTestSubclass.test_call_or_write_node ||= 1 CODE ) assert_prism_eval(<<-CODE - def Subclass.test_call_or_write_node + def PrismTestSubclass.test_call_or_write_node "str" end - Subclass.test_call_or_write_node ||= 1 + PrismTestSubclass.test_call_or_write_node ||= 1 CODE ) @@ -771,19 +770,18 @@ module Prism self.test_call_or_write_node ||= 1 CODE ) -=end end def test_CallOperatorWriteNode =begin assert_prism_eval(<<-CODE - def Subclass.test_call_operator_write_node + def PrismTestSubclass.test_call_operator_write_node 2 end - def Subclass.test_call_operator_write_node=(val) + def PrismTestSubclass.test_call_operator_write_node=(val) val end - Subclass.test_call_operator_write_node += 1 + PrismTestSubclass.test_call_operator_write_node += 1 CODE ) =end