зеркало из https://github.com/github/ruby.git
[Prism] Implement defined? for PM_IF_NODE
Ruby code: ```ruby defined?(if true; 1; end) ``` Instructions: ``` "********* Ruby *************" == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,43)> 0000 putobject "expression" ( 59)[Li] 0002 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,43)> 0000 putobject "expression" ( 58)[Li] 0002 leave ``` Related: ruby/prism#2188
This commit is contained in:
Родитель
fb1eed3f70
Коммит
a2092ef207
|
@ -2544,6 +2544,7 @@ pm_compile_defined_expr0(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *co
|
|||
case PM_FLOAT_NODE:
|
||||
case PM_FOR_NODE:
|
||||
case PM_HASH_NODE:
|
||||
case PM_IF_NODE:
|
||||
case PM_IMAGINARY_NODE:
|
||||
case PM_INTEGER_NODE:
|
||||
case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE:
|
||||
|
|
|
@ -254,6 +254,7 @@ module Prism
|
|||
assert_prism_eval("defined?(class PrismClassA; end)")
|
||||
assert_prism_eval("defined?(def prism_test_def_node; end)")
|
||||
assert_prism_eval("defined?(for i in [1,2] do; i; end)")
|
||||
assert_prism_eval("defined?(if true; 1; end)")
|
||||
end
|
||||
|
||||
def test_GlobalVariableReadNode
|
||||
|
|
Загрузка…
Ссылка в новой задаче