зеркало из https://github.com/github/ruby.git
[Prism] Implement defined? for PM_RETRY_NODE
Ruby code: ```ruby defined?(retry) ``` Instructions: ``` "********* Ruby *************" == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,15)> 0000 putobject "expression" ( 59)[Li] 0002 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,15)> 0000 putobject "expression" ( 58)[Li] 0002 leave ``` Related: ruby/prism#2188
This commit is contained in:
Родитель
8774abad55
Коммит
338aa465c0
|
@ -2480,6 +2480,7 @@ pm_compile_defined_expr0(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *co
|
|||
case PM_RANGE_NODE:
|
||||
case PM_REDO_NODE:
|
||||
case PM_REGULAR_EXPRESSION_NODE:
|
||||
case PM_RETRY_NODE:
|
||||
case PM_RETURN_NODE:
|
||||
case PM_SOURCE_ENCODING_NODE:
|
||||
case PM_SOURCE_FILE_NODE:
|
||||
|
|
|
@ -223,6 +223,8 @@ module Prism
|
|||
assert_prism_eval("defined?(break)")
|
||||
assert_prism_eval("defined?(redo)")
|
||||
assert_prism_eval("defined?(return)")
|
||||
assert_prism_eval("defined?(retry)")
|
||||
|
||||
assert_prism_eval("defined?(defined?(a))")
|
||||
assert_prism_eval('defined?(:"#{1}")')
|
||||
assert_prism_eval("defined?(`echo #{1}`)")
|
||||
|
|
Загрузка…
Ссылка в новой задаче