diff options
| author | eileencodes <eileencodes@gmail.com> | 2023-12-04 15:01:51 -0500 |
|---|---|---|
| committer | Jemma Issroff <jemmaissroff@gmail.com> | 2023-12-04 16:45:18 -0500 |
| commit | c23b2e5353f08a7131c77567f89d3aae707bdd25 (patch) | |
| tree | 2c927c69111beb1f677e47d3498a91cb547665ab /test/ruby | |
| parent | 569750f624dbb4e9d5836d4e9c46816224f4b681 (diff) | |
[PRISM] Fix `PM_PARENTHESES_NODE`
In #9101 I only accounted for an empty paren. This change implements the
`PM_PARENTHESES_NODE` for when it's `nil` and when it's an expression.
Code:
```ruby
defined?(("a"))
```
```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,15)>
0000 putobject "expression"
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,15)>
0000 putobject "expression"
0002 leave
```
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 922640982e..b6b1274ea8 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -158,6 +158,7 @@ module Prism assert_prism_eval("if defined? A; end") assert_prism_eval("defined?(())") + assert_prism_eval("defined?(('1'))") end def test_GlobalVariableReadNode |
