From 3db21d2d4c930b6199bd2eba7fa6ab2f017b8a89 Mon Sep 17 00:00:00 2001 From: Jemma Issroff Date: Tue, 21 Nov 2023 15:46:48 -0500 Subject: [PATCH] [PRISM] Rename flag to CONTAINS_KEYWORD_SPLAT We need to do this change first on ruby/ruby before merging to ruby/prism to avoid breaking ruby/ruby CI --- prism/config.yml | 2 +- prism/prism.c | 4 ++-- prism_compile.c | 2 +- test/prism/snapshots/constants.txt | 4 ++-- test/prism/snapshots/method_calls.txt | 6 +++--- test/prism/snapshots/methods.txt | 2 +- test/prism/snapshots/seattlerb/call_arg_assoc_kwsplat.txt | 2 +- test/prism/snapshots/seattlerb/call_arg_kwsplat.txt | 2 +- test/prism/snapshots/seattlerb/call_kwsplat.txt | 2 +- test/prism/snapshots/seattlerb/defn_kwarg_env.txt | 2 +- test/prism/snapshots/unparser/corpus/literal/send.txt | 4 ++-- test/prism/snapshots/unparser/corpus/literal/since/32.txt | 2 +- .../whitequark/forwarded_argument_with_kwrestarg.txt | 2 +- test/prism/snapshots/whitequark/forwarded_kwrestarg.txt | 2 +- .../forwarded_kwrestarg_with_additional_kwarg.txt | 2 +- .../kwoptarg_with_kwrestarg_and_forwarded_args.txt | 2 +- 16 files changed, 21 insertions(+), 21 deletions(-) diff --git a/prism/config.yml b/prism/config.yml index 6cd98b52a3..fc3b57193f 100644 --- a/prism/config.yml +++ b/prism/config.yml @@ -331,7 +331,7 @@ tokens: flags: - name: ArgumentsNodeFlags values: - - name: KEYWORD_SPLAT + - name: CONTAINS_KEYWORD_SPLAT comment: "if arguments contain keyword splat" comment: Flags for arguments nodes. - name: CallNodeFlags diff --git a/prism/prism.c b/prism/prism.c index b6be29832f..0f06a2f2f0 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -11144,7 +11144,7 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for parsed_bare_hash = true; parse_arguments_append(parser, arguments, argument); if (contains_keyword_splat) { - arguments->arguments->base.flags |= PM_ARGUMENTS_NODE_FLAGS_KEYWORD_SPLAT; + arguments->arguments->base.flags |= PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT; } break; } @@ -11258,7 +11258,7 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for parse_arguments_append(parser, arguments, argument); if (contains_keyword_splat) { - arguments->arguments->base.flags |= PM_ARGUMENTS_NODE_FLAGS_KEYWORD_SPLAT; + arguments->arguments->base.flags |= PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT; } break; } diff --git a/prism_compile.c b/prism_compile.c index bc54730bda..840f980253 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -1324,7 +1324,7 @@ pm_setup_args(pm_arguments_node_t *arguments_node, int *flags, struct rb_callinf else { pm_node_list_t arguments_node_list = arguments_node->arguments; - bool has_keyword_splat = (arguments_node->base.flags & PM_ARGUMENTS_NODE_FLAGS_KEYWORD_SPLAT); + bool has_keyword_splat = (arguments_node->base.flags & PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT); bool has_splat = false; // We count the number of elements post the splat node that are not keyword elements to diff --git a/test/prism/snapshots/constants.txt b/test/prism/snapshots/constants.txt index 5a31e16872..0e460b5c58 100644 --- a/test/prism/snapshots/constants.txt +++ b/test/prism/snapshots/constants.txt @@ -128,7 +128,7 @@ │ │ │ │ ├── flags: variable_call │ │ │ │ └── name: :bar │ │ │ └── operator_loc: (17,4)-(17,6) = "**" - │ │ └── flags: keyword_splat + │ │ └── flags: contains_keyword_splat │ ├── closing_loc: ∅ │ ├── block: ∅ │ ├── flags: ∅ @@ -209,7 +209,7 @@ │ │ │ │ ├── flags: variable_call │ │ │ │ └── name: :baz │ │ │ └── operator_loc: (23,9)-(23,11) = "**" - │ │ └── flags: keyword_splat + │ │ └── flags: contains_keyword_splat │ ├── closing_loc: ∅ │ ├── block: ∅ │ ├── flags: ∅ diff --git a/test/prism/snapshots/method_calls.txt b/test/prism/snapshots/method_calls.txt index 6b339f5151..b31291019f 100644 --- a/test/prism/snapshots/method_calls.txt +++ b/test/prism/snapshots/method_calls.txt @@ -318,7 +318,7 @@ │ │ │ │ ├── flags: variable_call │ │ │ │ └── name: :kwargs │ │ │ └── operator_loc: (27,2)-(27,4) = "**" - │ │ └── flags: keyword_splat + │ │ └── flags: contains_keyword_splat │ ├── closing_loc: (27,10)-(27,11) = ")" │ ├── block: ∅ │ ├── flags: ∅ @@ -1030,7 +1030,7 @@ │ │ │ │ ├── closing_loc: ∅ │ │ │ │ └── unescaped: "dog" │ │ │ └── operator_loc: ∅ - │ │ └── flags: keyword_splat + │ │ └── flags: contains_keyword_splat │ ├── closing_loc: ∅ │ ├── block: ∅ │ ├── flags: ∅ @@ -1080,7 +1080,7 @@ │ │ │ │ ├── closing_loc: ∅ │ │ │ │ └── unescaped: "dog" │ │ │ └── operator_loc: ∅ - │ │ └── flags: keyword_splat + │ │ └── flags: contains_keyword_splat │ ├── closing_loc: (70,40)-(70,41) = ")" │ ├── block: ∅ │ ├── flags: ∅ diff --git a/test/prism/snapshots/methods.txt b/test/prism/snapshots/methods.txt index 836b67db6a..4011499382 100644 --- a/test/prism/snapshots/methods.txt +++ b/test/prism/snapshots/methods.txt @@ -1285,7 +1285,7 @@ │ │ │ │ │ ├── flags: variable_call │ │ │ │ │ └── name: :qux │ │ │ │ └── operator_loc: (139,25)-(139,27) = "**" - │ │ │ └── flags: keyword_splat + │ │ │ └── flags: contains_keyword_splat │ │ ├── closing_loc: ∅ │ │ ├── block: ∅ │ │ ├── flags: ∅ diff --git a/test/prism/snapshots/seattlerb/call_arg_assoc_kwsplat.txt b/test/prism/snapshots/seattlerb/call_arg_assoc_kwsplat.txt index 3cd7e700f2..6255d346c1 100644 --- a/test/prism/snapshots/seattlerb/call_arg_assoc_kwsplat.txt +++ b/test/prism/snapshots/seattlerb/call_arg_assoc_kwsplat.txt @@ -31,7 +31,7 @@ │ │ │ @ IntegerNode (location: (1,14)-(1,15)) │ │ │ └── flags: decimal │ │ └── operator_loc: (1,12)-(1,14) = "**" - │ └── flags: keyword_splat + │ └── flags: contains_keyword_splat ├── closing_loc: (1,15)-(1,16) = ")" ├── block: ∅ ├── flags: ∅ diff --git a/test/prism/snapshots/seattlerb/call_arg_kwsplat.txt b/test/prism/snapshots/seattlerb/call_arg_kwsplat.txt index e9383acdf0..c774fb238f 100644 --- a/test/prism/snapshots/seattlerb/call_arg_kwsplat.txt +++ b/test/prism/snapshots/seattlerb/call_arg_kwsplat.txt @@ -28,7 +28,7 @@ │ │ │ @ IntegerNode (location: (1,7)-(1,8)) │ │ │ └── flags: decimal │ │ └── operator_loc: (1,5)-(1,7) = "**" - │ └── flags: keyword_splat + │ └── flags: contains_keyword_splat ├── closing_loc: (1,8)-(1,9) = ")" ├── block: ∅ ├── flags: ∅ diff --git a/test/prism/snapshots/seattlerb/call_kwsplat.txt b/test/prism/snapshots/seattlerb/call_kwsplat.txt index 6901d9ca0c..732cc87700 100644 --- a/test/prism/snapshots/seattlerb/call_kwsplat.txt +++ b/test/prism/snapshots/seattlerb/call_kwsplat.txt @@ -18,7 +18,7 @@ │ │ │ @ IntegerNode (location: (1,4)-(1,5)) │ │ │ └── flags: decimal │ │ └── operator_loc: (1,2)-(1,4) = "**" - │ └── flags: keyword_splat + │ └── flags: contains_keyword_splat ├── closing_loc: (1,5)-(1,6) = ")" ├── block: ∅ ├── flags: ∅ diff --git a/test/prism/snapshots/seattlerb/defn_kwarg_env.txt b/test/prism/snapshots/seattlerb/defn_kwarg_env.txt index 9839ec71cf..33d48faf54 100644 --- a/test/prism/snapshots/seattlerb/defn_kwarg_env.txt +++ b/test/prism/snapshots/seattlerb/defn_kwarg_env.txt @@ -39,7 +39,7 @@ │ │ │ │ ├── name: :testing │ │ │ │ └── depth: 0 │ │ │ └── operator_loc: (1,31)-(1,33) = "**" - │ │ └── flags: keyword_splat + │ │ └── flags: contains_keyword_splat │ ├── closing_loc: (1,40)-(1,41) = ")" │ ├── block: ∅ │ ├── flags: ∅ diff --git a/test/prism/snapshots/unparser/corpus/literal/send.txt b/test/prism/snapshots/unparser/corpus/literal/send.txt index 68a83b210a..d366ec25c0 100644 --- a/test/prism/snapshots/unparser/corpus/literal/send.txt +++ b/test/prism/snapshots/unparser/corpus/literal/send.txt @@ -1655,7 +1655,7 @@ │ │ │ │ ├── flags: variable_call │ │ │ │ └── name: :a │ │ │ └── operator_loc: (72,6)-(72,8) = "**" - │ │ └── flags: keyword_splat + │ │ └── flags: contains_keyword_splat │ ├── closing_loc: (72,9)-(72,10) = ")" │ ├── block: ∅ │ ├── flags: ∅ @@ -2070,7 +2070,7 @@ │ │ │ │ ├── flags: variable_call │ │ │ │ └── name: :foo │ │ │ └── operator_loc: (81,2)-(81,4) = "**" - │ │ └── flags: keyword_splat + │ │ └── flags: contains_keyword_splat │ ├── closing_loc: (81,7)-(81,8) = ")" │ ├── block: ∅ │ ├── flags: ∅ diff --git a/test/prism/snapshots/unparser/corpus/literal/since/32.txt b/test/prism/snapshots/unparser/corpus/literal/since/32.txt index 4db42e5de1..77b09ba0de 100644 --- a/test/prism/snapshots/unparser/corpus/literal/since/32.txt +++ b/test/prism/snapshots/unparser/corpus/literal/since/32.txt @@ -41,7 +41,7 @@ │ │ │ │ └── @ AssocSplatNode (location: (2,16)-(2,18)) │ │ │ │ ├── value: ∅ │ │ │ │ └── operator_loc: (2,16)-(2,18) = "**" - │ │ │ └── flags: keyword_splat + │ │ │ └── flags: contains_keyword_splat │ │ ├── closing_loc: (2,18)-(2,19) = ")" │ │ ├── block: ∅ │ │ ├── flags: ∅ diff --git a/test/prism/snapshots/whitequark/forwarded_argument_with_kwrestarg.txt b/test/prism/snapshots/whitequark/forwarded_argument_with_kwrestarg.txt index 92635f0b8b..53b3d90dd5 100644 --- a/test/prism/snapshots/whitequark/forwarded_argument_with_kwrestarg.txt +++ b/test/prism/snapshots/whitequark/forwarded_argument_with_kwrestarg.txt @@ -41,7 +41,7 @@ │ │ │ └── @ AssocSplatNode (location: (1,37)-(1,39)) │ │ │ ├── value: ∅ │ │ │ └── operator_loc: (1,37)-(1,39) = "**" - │ │ └── flags: keyword_splat + │ │ └── flags: contains_keyword_splat │ ├── closing_loc: (1,39)-(1,40) = ")" │ ├── block: ∅ │ ├── flags: ∅ diff --git a/test/prism/snapshots/whitequark/forwarded_kwrestarg.txt b/test/prism/snapshots/whitequark/forwarded_kwrestarg.txt index c1bc2b7069..f6ae042763 100644 --- a/test/prism/snapshots/whitequark/forwarded_kwrestarg.txt +++ b/test/prism/snapshots/whitequark/forwarded_kwrestarg.txt @@ -36,7 +36,7 @@ │ │ │ └── @ AssocSplatNode (location: (1,17)-(1,19)) │ │ │ ├── value: ∅ │ │ │ └── operator_loc: (1,17)-(1,19) = "**" - │ │ └── flags: keyword_splat + │ │ └── flags: contains_keyword_splat │ ├── closing_loc: (1,19)-(1,20) = ")" │ ├── block: ∅ │ ├── flags: ∅ diff --git a/test/prism/snapshots/whitequark/forwarded_kwrestarg_with_additional_kwarg.txt b/test/prism/snapshots/whitequark/forwarded_kwrestarg_with_additional_kwarg.txt index 29ba99b164..32f05cdf17 100644 --- a/test/prism/snapshots/whitequark/forwarded_kwrestarg_with_additional_kwarg.txt +++ b/test/prism/snapshots/whitequark/forwarded_kwrestarg_with_additional_kwarg.txt @@ -46,7 +46,7 @@ │ │ │ ├── value: │ │ │ │ @ TrueNode (location: (1,31)-(1,35)) │ │ │ └── operator_loc: ∅ - │ │ └── flags: keyword_splat + │ │ └── flags: contains_keyword_splat │ ├── closing_loc: (1,35)-(1,36) = ")" │ ├── block: ∅ │ ├── flags: ∅ diff --git a/test/prism/snapshots/whitequark/kwoptarg_with_kwrestarg_and_forwarded_args.txt b/test/prism/snapshots/whitequark/kwoptarg_with_kwrestarg_and_forwarded_args.txt index 675c6f9300..58d3928db2 100644 --- a/test/prism/snapshots/whitequark/kwoptarg_with_kwrestarg_and_forwarded_args.txt +++ b/test/prism/snapshots/whitequark/kwoptarg_with_kwrestarg_and_forwarded_args.txt @@ -41,7 +41,7 @@ │ │ │ └── @ AssocSplatNode (location: (1,21)-(1,23)) │ │ │ ├── value: ∅ │ │ │ └── operator_loc: (1,21)-(1,23) = "**" - │ │ └── flags: keyword_splat + │ │ └── flags: contains_keyword_splat │ ├── closing_loc: (1,23)-(1,24) = ")" │ ├── block: ∅ │ ├── flags: ∅