summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorMatt Valentine-House <[email protected]>2023-11-02 22:37:30 +0000
committerMatt Valentine-House <[email protected]>2023-11-03 07:28:05 +0000
commitdcb9ded6c9148a31361ba2318ed7d57fd0c41431 (patch)
tree7605059182e7dac9e06e06d1d6c537a9fbe70723 /test/ruby
parent5cff4c5aa375787924e2df5c0b981dd922b95a8c (diff)
[PRISM] Fix CallNode with arguments when popped
Previously emitting a call node with an argument followed by another node would cause the argument to be mistakenly omitted from the argument list causing a stack underflow. ``` PRISM: ************************************************** -- raw disasm-------- 0000 putself ( 0) 0001 send <calldata:puts, 1>, nil ( 0) * 0004 pop ( 0) 0005 putobject 1 ( 0) 0007 leave ( 0) --------------------- ```
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_compile_prism.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb
index eb6a4f8b9a..494b8c87d2 100644
--- a/test/ruby/test_compile_prism.rb
+++ b/test/ruby/test_compile_prism.rb
@@ -694,6 +694,12 @@ module Prism
def test_CallNode
assert_prism_eval("to_s")
+
+ # with arguments
+ assert_prism_eval("eval '1'")
+
+ # with arguments and popped
+ assert_prism_eval("eval '1'; 1")
end
def test_CallAndWriteNode