summaryrefslogtreecommitdiff
path: root/ast.c
diff options
context:
space:
mode:
authorKazuki Tsujimoto <kazuki@callcc.net>2020-06-14 09:24:36 +0900
committerKazuki Tsujimoto <kazuki@callcc.net>2020-06-14 09:24:36 +0900
commitddded1157a90d21cb54b9f07de35ab9b4cc472e1 (patch)
tree315005f4eead6840846e6ce4bbd4dfa44c3bfce7 /ast.c
parentf7906a7e31e6b1cfa135ecea69deb8827e8c8803 (diff)
downloadruby-ddded1157a90d21cb54b9f07de35ab9b4cc472e1.tar.gz
Introduce find pattern [Feature #16828]
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ast.c b/ast.c
index 18a97239ff..44fec1645c 100644
--- a/ast.c
+++ b/ast.c
@@ -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")) :