diff --git a/prism/config.yml b/prism/config.yml index 585d17a4c6..1c00ef145b 100644 --- a/prism/config.yml +++ b/prism/config.yml @@ -647,14 +647,16 @@ tokens: flags: - name: ArgumentsNodeFlags values: + - name: CONTAINS_FORWARDING + comment: "if the arguments contain forwarding" - name: CONTAINS_KEYWORDS - comment: "if arguments contain keywords" + comment: "if the arguments contain keywords" - name: CONTAINS_KEYWORD_SPLAT - comment: "if arguments contain keyword splat" + comment: "if the arguments contain a keyword splat" - name: CONTAINS_SPLAT - comment: "if arguments contain splat" + comment: "if the arguments contain a splat" - name: CONTAINS_MULTIPLE_SPLATS - comment: "if arguments contain multiple splats" + comment: "if the arguments contain multiple splats" comment: Flags for arguments nodes. - name: ArrayNodeFlags values: diff --git a/prism/prism.c b/prism/prism.c index 43ce5df371..0dcc4afe5d 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -14180,6 +14180,7 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for argument = (pm_node_t *) pm_forwarding_arguments_node_create(parser, &parser->previous); parse_arguments_append(parser, arguments, argument); + pm_node_flag_set((pm_node_t *) arguments->arguments, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_FORWARDING); arguments->has_forwarding = true; parsed_forwarding_arguments = true; break; diff --git a/test/prism/snapshots/methods.txt b/test/prism/snapshots/methods.txt index af2defcb97..0780999142 100644 --- a/test/prism/snapshots/methods.txt +++ b/test/prism/snapshots/methods.txt @@ -1086,7 +1086,7 @@ │ │ ├── opening_loc: (112,13)-(112,14) = "(" │ │ ├── arguments: │ │ │ @ ArgumentsNode (location: (112,14)-(112,17)) - │ │ │ ├── flags: ∅ + │ │ │ ├── flags: contains_forwarding │ │ │ └── arguments: (length: 1) │ │ │ └── @ ForwardingArgumentsNode (location: (112,14)-(112,17)) │ │ │ └── flags: ∅ @@ -1129,7 +1129,7 @@ │ │ ├── opening_loc: (114,13)-(114,14) = "(" │ │ ├── arguments: │ │ │ @ ArgumentsNode (location: (114,14)-(114,23)) - │ │ │ ├── flags: ∅ + │ │ │ ├── flags: contains_forwarding │ │ │ └── arguments: (length: 3) │ │ │ ├── @ IntegerNode (location: (114,14)-(114,15)) │ │ │ │ ├── flags: static_literal, decimal @@ -1382,7 +1382,7 @@ │ │ │ │ ├── opening_loc: (136,19)-(136,20) = "(" │ │ │ │ ├── arguments: │ │ │ │ │ @ ArgumentsNode (location: (136,20)-(136,23)) - │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── flags: contains_forwarding │ │ │ │ │ └── arguments: (length: 1) │ │ │ │ │ └── @ ForwardingArgumentsNode (location: (136,20)-(136,23)) │ │ │ │ │ └── flags: ∅ @@ -2095,7 +2095,7 @@ │ │ ├── opening_loc: (178,5)-(178,6) = "(" │ │ ├── arguments: │ │ │ @ ArgumentsNode (location: (178,6)-(178,9)) - │ │ │ ├── flags: ∅ + │ │ │ ├── flags: contains_forwarding │ │ │ └── arguments: (length: 1) │ │ │ └── @ ForwardingArgumentsNode (location: (178,6)-(178,9)) │ │ │ └── flags: ∅ diff --git a/test/prism/snapshots/seattlerb/defn_arg_forward_args.txt b/test/prism/snapshots/seattlerb/defn_arg_forward_args.txt index 905978bc2f..ababd94b11 100644 --- a/test/prism/snapshots/seattlerb/defn_arg_forward_args.txt +++ b/test/prism/snapshots/seattlerb/defn_arg_forward_args.txt @@ -38,7 +38,7 @@ │ ├── opening_loc: (1,16)-(1,17) = "(" │ ├── arguments: │ │ @ ArgumentsNode (location: (1,17)-(1,23)) - │ │ ├── flags: ∅ + │ │ ├── flags: contains_forwarding │ │ └── arguments: (length: 2) │ │ ├── @ LocalVariableReadNode (location: (1,17)-(1,18)) │ │ │ ├── flags: ∅ diff --git a/test/prism/snapshots/seattlerb/defn_args_forward_args.txt b/test/prism/snapshots/seattlerb/defn_args_forward_args.txt index ca03f79d57..d689049433 100644 --- a/test/prism/snapshots/seattlerb/defn_args_forward_args.txt +++ b/test/prism/snapshots/seattlerb/defn_args_forward_args.txt @@ -44,7 +44,7 @@ │ ├── opening_loc: (1,22)-(1,23) = "(" │ ├── arguments: │ │ @ ArgumentsNode (location: (1,23)-(1,35)) - │ │ ├── flags: ∅ + │ │ ├── flags: contains_forwarding │ │ └── arguments: (length: 3) │ │ ├── @ SymbolNode (location: (1,23)-(1,27)) │ │ │ ├── flags: static_literal, forced_us_ascii_encoding diff --git a/test/prism/snapshots/seattlerb/defn_forward_args.txt b/test/prism/snapshots/seattlerb/defn_forward_args.txt index 50fc32c047..58a97028c6 100644 --- a/test/prism/snapshots/seattlerb/defn_forward_args.txt +++ b/test/prism/snapshots/seattlerb/defn_forward_args.txt @@ -35,7 +35,7 @@ │ ├── opening_loc: (1,13)-(1,14) = "(" │ ├── arguments: │ │ @ ArgumentsNode (location: (1,14)-(1,17)) - │ │ ├── flags: ∅ + │ │ ├── flags: contains_forwarding │ │ └── arguments: (length: 1) │ │ └── @ ForwardingArgumentsNode (location: (1,14)-(1,17)) │ │ └── flags: ∅ diff --git a/test/prism/snapshots/seattlerb/defn_forward_args__no_parens.txt b/test/prism/snapshots/seattlerb/defn_forward_args__no_parens.txt index 8926f2cdf1..5d8e09f6c0 100644 --- a/test/prism/snapshots/seattlerb/defn_forward_args__no_parens.txt +++ b/test/prism/snapshots/seattlerb/defn_forward_args__no_parens.txt @@ -35,7 +35,7 @@ │ ├── opening_loc: (2,3)-(2,4) = "(" │ ├── arguments: │ │ @ ArgumentsNode (location: (2,4)-(2,7)) - │ │ ├── flags: ∅ + │ │ ├── flags: contains_forwarding │ │ └── arguments: (length: 1) │ │ └── @ ForwardingArgumentsNode (location: (2,4)-(2,7)) │ │ └── flags: ∅ diff --git a/test/prism/snapshots/whitequark/endless_method_forwarded_args_legacy.txt b/test/prism/snapshots/whitequark/endless_method_forwarded_args_legacy.txt index 5927016b26..eaa1061007 100644 --- a/test/prism/snapshots/whitequark/endless_method_forwarded_args_legacy.txt +++ b/test/prism/snapshots/whitequark/endless_method_forwarded_args_legacy.txt @@ -35,7 +35,7 @@ │ ├── opening_loc: (1,18)-(1,19) = "(" │ ├── arguments: │ │ @ ArgumentsNode (location: (1,19)-(1,22)) - │ │ ├── flags: ∅ + │ │ ├── flags: contains_forwarding │ │ └── arguments: (length: 1) │ │ └── @ ForwardingArgumentsNode (location: (1,19)-(1,22)) │ │ └── flags: ∅ diff --git a/test/prism/snapshots/whitequark/forward_arg.txt b/test/prism/snapshots/whitequark/forward_arg.txt index b8c22d08f2..3879314fa8 100644 --- a/test/prism/snapshots/whitequark/forward_arg.txt +++ b/test/prism/snapshots/whitequark/forward_arg.txt @@ -35,7 +35,7 @@ │ ├── opening_loc: (1,17)-(1,18) = "(" │ ├── arguments: │ │ @ ArgumentsNode (location: (1,18)-(1,21)) - │ │ ├── flags: ∅ + │ │ ├── flags: contains_forwarding │ │ └── arguments: (length: 1) │ │ └── @ ForwardingArgumentsNode (location: (1,18)-(1,21)) │ │ └── flags: ∅ diff --git a/test/prism/snapshots/whitequark/forward_arg_with_open_args.txt b/test/prism/snapshots/whitequark/forward_arg_with_open_args.txt index 20c8486276..ea36abae7e 100644 --- a/test/prism/snapshots/whitequark/forward_arg_with_open_args.txt +++ b/test/prism/snapshots/whitequark/forward_arg_with_open_args.txt @@ -41,7 +41,7 @@ │ │ │ ├── opening_loc: (2,5)-(2,6) = "(" │ │ │ ├── arguments: │ │ │ │ @ ArgumentsNode (location: (2,6)-(2,9)) - │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── flags: contains_forwarding │ │ │ │ └── arguments: (length: 1) │ │ │ │ └── @ ForwardingArgumentsNode (location: (2,6)-(2,9)) │ │ │ │ └── flags: ∅ @@ -92,7 +92,7 @@ │ │ │ ├── opening_loc: (5,17)-(5,18) = "(" │ │ │ ├── arguments: │ │ │ │ @ ArgumentsNode (location: (5,18)-(5,21)) - │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── flags: contains_forwarding │ │ │ │ └── arguments: (length: 1) │ │ │ │ └── @ ForwardingArgumentsNode (location: (5,18)-(5,21)) │ │ │ │ └── flags: ∅ @@ -162,7 +162,7 @@ │ │ ├── opening_loc: (10,16)-(10,17) = "(" │ │ ├── arguments: │ │ │ @ ArgumentsNode (location: (10,17)-(10,20)) - │ │ │ ├── flags: ∅ + │ │ │ ├── flags: contains_forwarding │ │ │ └── arguments: (length: 1) │ │ │ └── @ ForwardingArgumentsNode (location: (10,17)-(10,20)) │ │ │ └── flags: ∅ @@ -208,7 +208,7 @@ │ │ ├── opening_loc: (13,5)-(13,6) = "(" │ │ ├── arguments: │ │ │ @ ArgumentsNode (location: (13,6)-(13,9)) - │ │ │ ├── flags: ∅ + │ │ │ ├── flags: contains_forwarding │ │ │ └── arguments: (length: 1) │ │ │ └── @ ForwardingArgumentsNode (location: (13,6)-(13,9)) │ │ │ └── flags: ∅ @@ -254,7 +254,7 @@ │ │ ├── opening_loc: (16,19)-(16,20) = "(" │ │ ├── arguments: │ │ │ @ ArgumentsNode (location: (16,20)-(16,23)) - │ │ │ ├── flags: ∅ + │ │ │ ├── flags: contains_forwarding │ │ │ └── arguments: (length: 1) │ │ │ └── @ ForwardingArgumentsNode (location: (16,20)-(16,23)) │ │ │ └── flags: ∅ @@ -343,7 +343,7 @@ │ │ ├── opening_loc: (22,5)-(22,6) = "(" │ │ ├── arguments: │ │ │ @ ArgumentsNode (location: (22,6)-(22,9)) - │ │ │ ├── flags: ∅ + │ │ │ ├── flags: contains_forwarding │ │ │ └── arguments: (length: 1) │ │ │ └── @ ForwardingArgumentsNode (location: (22,6)-(22,9)) │ │ │ └── flags: ∅ @@ -395,7 +395,7 @@ │ │ ├── opening_loc: (25,23)-(25,24) = "(" │ │ ├── arguments: │ │ │ @ ArgumentsNode (location: (25,24)-(25,27)) - │ │ │ ├── flags: ∅ + │ │ │ ├── flags: contains_forwarding │ │ │ └── arguments: (length: 1) │ │ │ └── @ ForwardingArgumentsNode (location: (25,24)-(25,27)) │ │ │ └── flags: ∅ @@ -441,7 +441,7 @@ │ ├── opening_loc: (27,19)-(27,20) = "(" │ ├── arguments: │ │ @ ArgumentsNode (location: (27,20)-(27,23)) - │ │ ├── flags: ∅ + │ │ ├── flags: contains_forwarding │ │ └── arguments: (length: 1) │ │ └── @ ForwardingArgumentsNode (location: (27,20)-(27,23)) │ │ └── flags: ∅ diff --git a/test/prism/snapshots/whitequark/forward_args_legacy.txt b/test/prism/snapshots/whitequark/forward_args_legacy.txt index 6fd9c536e3..2fda9338f3 100644 --- a/test/prism/snapshots/whitequark/forward_args_legacy.txt +++ b/test/prism/snapshots/whitequark/forward_args_legacy.txt @@ -35,7 +35,7 @@ │ │ ├── opening_loc: (1,17)-(1,18) = "(" │ │ ├── arguments: │ │ │ @ ArgumentsNode (location: (1,18)-(1,21)) - │ │ │ ├── flags: ∅ + │ │ │ ├── flags: contains_forwarding │ │ │ └── arguments: (length: 1) │ │ │ └── @ ForwardingArgumentsNode (location: (1,18)-(1,21)) │ │ │ └── flags: ∅ @@ -100,7 +100,7 @@ │ ├── lparen_loc: (5,19)-(5,20) = "(" │ ├── arguments: │ │ @ ArgumentsNode (location: (5,20)-(5,23)) - │ │ ├── flags: ∅ + │ │ ├── flags: contains_forwarding │ │ └── arguments: (length: 1) │ │ └── @ ForwardingArgumentsNode (location: (5,20)-(5,23)) │ │ └── flags: ∅ diff --git a/test/prism/snapshots/whitequark/trailing_forward_arg.txt b/test/prism/snapshots/whitequark/trailing_forward_arg.txt index 3cb3f8ae08..75fce37a34 100644 --- a/test/prism/snapshots/whitequark/trailing_forward_arg.txt +++ b/test/prism/snapshots/whitequark/trailing_forward_arg.txt @@ -41,7 +41,7 @@ │ ├── opening_loc: (1,23)-(1,24) = "(" │ ├── arguments: │ │ @ ArgumentsNode (location: (1,24)-(1,34)) - │ │ ├── flags: ∅ + │ │ ├── flags: contains_forwarding │ │ └── arguments: (length: 3) │ │ ├── @ LocalVariableReadNode (location: (1,24)-(1,25)) │ │ │ ├── flags: ∅