зеркало из https://github.com/github/ruby.git
[PRISM] Implement `PM_MATCH_PREDICATE_NODE` for `defined?`
Ruby code: ```ruby defined? 1 in 1 ``` Instructions: ``` "********* Ruby *************" == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,16)> 0000 putobject "expression" 0002 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,16)> 0000 putobject "expression" 0002 leave ```
This commit is contained in:
Родитель
4547108448
Коммит
da1519b223
|
@ -1491,6 +1491,7 @@ pm_compile_defined_expr0(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *co
|
|||
case PM_INTERPOLATED_STRING_NODE:
|
||||
case PM_KEYWORD_HASH_NODE:
|
||||
case PM_LAMBDA_NODE:
|
||||
case PM_MATCH_PREDICATE_NODE:
|
||||
case PM_OR_NODE:
|
||||
case PM_RANGE_NODE:
|
||||
case PM_REGULAR_EXPRESSION_NODE:
|
||||
|
|
|
@ -128,6 +128,7 @@ module Prism
|
|||
assert_prism_eval("defined? [*b]")
|
||||
assert_prism_eval("defined? [[*1..2], 3, *4..5]")
|
||||
assert_prism_eval("defined? [a: [:b, :c]]")
|
||||
assert_prism_eval("defined? 1 in 1")
|
||||
|
||||
assert_prism_eval("defined? @a")
|
||||
assert_prism_eval("defined? $a")
|
||||
|
|
Загрузка…
Ссылка в новой задаче