[Prism] Implement defined? for PM_INTERPOLATED_SYMBOL_NODE

Ruby code:

```ruby
defined?(:"1 #{1 + 2} 1")
```

Instructions:

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,25)>
0000 putobject                              "expression"              (  59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,25)>
0000 putobject                              "expression"              (  58)[Li]
0002 leave
```

Related: ruby/prism#2188
This commit is contained in:
eileencodes 2024-01-16 15:31:24 -05:00 коммит произвёл Kevin Newton
Родитель 25f1a8e447
Коммит e0c90199c9
2 изменённых файлов: 2 добавлений и 0 удалений

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

@ -2470,6 +2470,7 @@ pm_compile_defined_expr0(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *co
case PM_INTEGER_NODE:
case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE:
case PM_INTERPOLATED_STRING_NODE:
case PM_INTERPOLATED_SYMBOL_NODE:
case PM_KEYWORD_HASH_NODE:
case PM_LAMBDA_NODE:
case PM_MATCH_PREDICATE_NODE:

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

@ -222,6 +222,7 @@ module Prism
assert_prism_eval("defined?(next)")
assert_prism_eval("defined?(break)")
assert_prism_eval("defined?(defined?(a))")
assert_prism_eval('defined?(:"#{1}")')
end
def test_GlobalVariableReadNode