зеркало из https://github.com/github/ruby.git
[PRISM] Fix popped for Call{And,Or}WriteNode
This commit is contained in:
Родитель
5acced49c2
Коммит
d8bdb15a8b
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче