Skip to content

Commit

Permalink
Merge pull request #3021 from ruby/multi-splat
Browse files Browse the repository at this point in the history
Multi-splat flag for arguments
  • Loading branch information
kddnewton authored Aug 28, 2024
2 parents 163a265 + 21cb9b7 commit 0299f89
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,8 @@ flags:
comment: "if arguments contain keyword splat"
- name: CONTAINS_SPLAT
comment: "if arguments contain splat"
- name: CONTAINS_MULTIPLE_SPLATS
comment: "if arguments contain multiple splats"
comment: Flags for arguments nodes.
- name: ArrayNodeFlags
values:
Expand Down
6 changes: 5 additions & 1 deletion src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -2065,7 +2065,11 @@ pm_arguments_node_arguments_append(pm_arguments_node_t *node, pm_node_t *argumen
pm_node_list_append(&node->arguments, argument);

if (PM_NODE_TYPE_P(argument, PM_SPLAT_NODE)) {
pm_node_flag_set((pm_node_t *) node, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT);
if (PM_NODE_FLAG_P(node, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT)) {
pm_node_flag_set((pm_node_t *) node, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_MULTIPLE_SPLATS);
} else {
pm_node_flag_set((pm_node_t *) node, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/prism/snapshots/unparser/corpus/literal/send.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0299f89

Please sign in to comment.