[PRISM] Implement `PM_INTERPOLATED_STRING_NODE`

Implements `PM_INTERPOLATED_STRING_NODE` for `defined?`

Code:

```ruby
defined?("#{expr}")
```

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,19)>
0000 putobject                              "expression"
0002 leave

"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,19)>
0000 putobject                              "expression"
0002 leave
```
This commit is contained in:
eileencodes 2023-12-04 15:10:12 -05:00 коммит произвёл Jemma Issroff
Родитель c23b2e5353
Коммит 33bc22efe5
2 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -1478,6 +1478,7 @@ pm_compile_defined_expr0(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *co
case PM_FLOAT_NODE:
case PM_HASH_NODE:
case PM_INTEGER_NODE:
case PM_INTERPOLATED_STRING_NODE:
case PM_LAMBDA_NODE:
case PM_OR_NODE:
case PM_RANGE_NODE:

Просмотреть файл

@ -102,6 +102,7 @@ module Prism
assert_prism_eval("defined? [1, 2, 3]")
assert_prism_eval("defined?({ a: 1 })")
assert_prism_eval("defined? 'str'")
assert_prism_eval('defined?("#{expr}")')
assert_prism_eval("defined? :sym")
assert_prism_eval("defined? /foo/")
assert_prism_eval("defined? -> { 1 + 1 }")