зеркало из https://github.com/github/ruby.git
[PRISM] Implement `PM_SOURCE_LINE_NODE` for `defined?`
Ruby code: ```ruby defined?(__LINE__) ``` Instructions: ``` "********* Ruby *************" == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,18)> 0000 putobject "expression" 0002 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,18)> 0000 putobject "expression" 0002 leave ```
This commit is contained in:
Родитель
d474239537
Коммит
02961fdbab
|
@ -1493,6 +1493,7 @@ pm_compile_defined_expr0(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *co
|
|||
case PM_REGULAR_EXPRESSION_NODE:
|
||||
case PM_SOURCE_ENCODING_NODE:
|
||||
case PM_SOURCE_FILE_NODE:
|
||||
case PM_SOURCE_LINE_NODE:
|
||||
case PM_STRING_NODE:
|
||||
case PM_SYMBOL_NODE:
|
||||
case PM_X_STRING_NODE:
|
||||
|
|
|
@ -112,6 +112,7 @@ module Prism
|
|||
assert_prism_eval("defined? a || b")
|
||||
assert_prism_eval("defined? __ENCODING__")
|
||||
assert_prism_eval("defined? __FILE__")
|
||||
assert_prism_eval("defined? __LINE__")
|
||||
|
||||
assert_prism_eval("defined? %[1,2,3]")
|
||||
assert_prism_eval("defined? %q[1,2,3]")
|
||||
|
|
Загрузка…
Ссылка в новой задаче