diff --git a/config.yml b/config.yml index dc19295c3e7..b7c673813b4 100644 --- a/config.yml +++ b/config.yml @@ -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: diff --git a/src/prism.c b/src/prism.c index 28bd8d0d439..4edb57adc06 100644 --- a/src/prism.c +++ b/src/prism.c @@ -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); + } } } diff --git a/test/prism/snapshots/unparser/corpus/literal/send.txt b/test/prism/snapshots/unparser/corpus/literal/send.txt index 9f9eeb13eee..4800b4e2e65 100644 --- a/test/prism/snapshots/unparser/corpus/literal/send.txt +++ b/test/prism/snapshots/unparser/corpus/literal/send.txt @@ -1123,7 +1123,7 @@ │ ├── opening_loc: (59,7)-(59,8) = "(" │ ├── arguments: │ │ @ ArgumentsNode (location: (59,8)-(59,25)) - │ │ ├── flags: contains_splat + │ │ ├── flags: contains_splat, contains_multiple_splats │ │ └── arguments: (length: 3) │ │ ├── @ SplatNode (location: (59,8)-(59,13)) │ │ │ ├── flags: ∅