[ruby/prism] Add a flag for arguments that contain forwarding

https://github.com/ruby/prism/commit/ebd2889bee
This commit is contained in:
Kevin Newton 2024-09-11 12:29:13 -04:00 коммит произвёл git
Родитель 886fc69b1c
Коммит 1be9a99837
12 изменённых файлов: 28 добавлений и 25 удалений

Просмотреть файл

@ -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:

Просмотреть файл

@ -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;

Просмотреть файл

@ -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: ∅

Просмотреть файл

@ -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: ∅

Просмотреть файл

@ -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

Просмотреть файл

@ -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: ∅

Просмотреть файл

@ -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: ∅

Просмотреть файл

@ -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: ∅

Просмотреть файл

@ -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: ∅

Просмотреть файл

@ -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: ∅

Просмотреть файл

@ -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: ∅

Просмотреть файл

@ -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: ∅