зеркало из https://github.com/github/ruby.git
Add defined array node
This commit is contained in:
Родитель
b05a7bc512
Коммит
d8a9245513
|
@ -1131,6 +1131,16 @@ pm_compile_defined_expr0(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *co
|
|||
case PM_FALSE_NODE:
|
||||
dtype = DEFINED_FALSE;
|
||||
break;
|
||||
case PM_ARRAY_NODE: {
|
||||
pm_array_node_t *array_node = (pm_array_node_t *) node;
|
||||
for (size_t index = 0; index < array_node->elements.size; index++) {
|
||||
pm_compile_defined_expr0(iseq, array_node->elements.nodes[index], ret, src, popped, scope_node, dummy_line_node, lineno, true, lfinish);
|
||||
if (!lfinish[1]) {
|
||||
lfinish[1] = NEW_LABEL(lineno);
|
||||
}
|
||||
ADD_INSNL(ret, &dummy_line_node, branchunless, lfinish[1]);
|
||||
}
|
||||
}
|
||||
case PM_STRING_NODE:
|
||||
case PM_AND_NODE:
|
||||
case PM_OR_NODE:
|
||||
|
|
|
@ -93,6 +93,7 @@ module Prism
|
|||
assert_prism_eval("defined? self")
|
||||
assert_prism_eval("defined? true")
|
||||
assert_prism_eval("defined? false")
|
||||
assert_prism_eval("defined? [A, B, C]")
|
||||
assert_prism_eval("defined? 'str'")
|
||||
assert_prism_eval("defined? a && b")
|
||||
assert_prism_eval("defined? a || b")
|
||||
|
|
Загрузка…
Ссылка в новой задаче