Skip to content

Commit

Permalink
Merge pull request #3019 from eileencodes/add-contains-splat-flag
Browse files Browse the repository at this point in the history
Add `contains_splat` flag
  • Loading branch information
kddnewton authored Aug 27, 2024
2 parents 54b3937 + 5be97a7 commit a9fdd90
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 34 deletions.
2 changes: 2 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,8 @@ flags:
comment: "if arguments contain keywords"
- name: CONTAINS_KEYWORD_SPLAT
comment: "if arguments contain keyword splat"
- name: CONTAINS_SPLAT
comment: "if arguments contain splat"
comment: Flags for arguments nodes.
- name: ArrayNodeFlags
values:
Expand Down
4 changes: 4 additions & 0 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,10 @@ pm_arguments_node_arguments_append(pm_arguments_node_t *node, pm_node_t *argumen

node->base.location.end = argument->location.end;
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);
}
}

/**
Expand Down
16 changes: 8 additions & 8 deletions test/prism/snapshots/arrays.txt

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

4 changes: 2 additions & 2 deletions test/prism/snapshots/constants.txt

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

6 changes: 3 additions & 3 deletions test/prism/snapshots/method_calls.txt

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

2 changes: 1 addition & 1 deletion test/prism/snapshots/methods.txt

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

2 changes: 1 addition & 1 deletion test/prism/snapshots/return.txt

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

4 changes: 2 additions & 2 deletions test/prism/snapshots/unparser/corpus/literal/assignment.txt

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

20 changes: 10 additions & 10 deletions 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.

2 changes: 1 addition & 1 deletion test/prism/snapshots/unparser/corpus/literal/since/32.txt

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

4 changes: 2 additions & 2 deletions test/prism/snapshots/whitequark/args_args_star.txt

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

4 changes: 2 additions & 2 deletions test/prism/snapshots/whitequark/args_star.txt

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

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

2 changes: 1 addition & 1 deletion test/prism/snapshots/whitequark/forwarded_restarg.txt

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

0 comments on commit a9fdd90

Please sign in to comment.