diff options
author | Kazuki Tsujimoto <kazuki@callcc.net> | 2020-06-14 09:24:36 +0900 |
---|---|---|
committer | Kazuki Tsujimoto <kazuki@callcc.net> | 2020-06-14 09:24:36 +0900 |
commit | ddded1157a90d21cb54b9f07de35ab9b4cc472e1 (patch) | |
tree | 315005f4eead6840846e6ce4bbd4dfa44c3bfce7 /ast.c | |
parent | f7906a7e31e6b1cfa135ecea69deb8827e8c8803 (diff) |
Introduce find pattern [Feature #16828]
Diffstat (limited to 'ast.c')
-rw-r--r-- | ast.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -599,6 +599,19 @@ node_children(rb_ast_t *ast, NODE *node) rest, NEW_CHILD(ast, apinfo->post_args)); } + case NODE_FNDPTN: + { + struct rb_fnd_pattern_info *fpinfo = node->nd_fpinfo; + VALUE pre_rest = NODE_NAMED_REST_P(fpinfo->pre_rest_arg) ? NEW_CHILD(ast, fpinfo->pre_rest_arg) : + ID2SYM(rb_intern("NODE_SPECIAL_NO_NAME_REST")); + VALUE post_rest = NODE_NAMED_REST_P(fpinfo->post_rest_arg) ? NEW_CHILD(ast, fpinfo->post_rest_arg) : + ID2SYM(rb_intern("NODE_SPECIAL_NO_NAME_REST")); + return rb_ary_new_from_args(4, + NEW_CHILD(ast, node->nd_pconst), + pre_rest, + NEW_CHILD(ast, fpinfo->args), + post_rest); + } case NODE_HSHPTN: { VALUE kwrest = node->nd_pkwrestarg == NODE_SPECIAL_NO_REST_KEYWORD ? ID2SYM(rb_intern("NODE_SPECIAL_NO_REST_KEYWORD")) : |