зеркало из https://github.com/github/ruby.git
[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:
Родитель
c23b2e5353
Коммит
33bc22efe5
|
@ -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 }")
|
||||
|
|
Загрузка…
Ссылка в новой задаче