зеркало из https://github.com/github/ruby.git
[ruby/prism] Disallow forwarding in blocks
https://github.com/ruby/prism/commit/2bbd35943c
This commit is contained in:
Родитель
03aa1092ad
Коммит
98e5ea9431
|
@ -11029,7 +11029,7 @@ parse_parameters(
|
|||
pm_binding_power_t binding_power,
|
||||
bool uses_parentheses,
|
||||
bool allows_trailing_comma,
|
||||
bool allows_forwarding_parameter
|
||||
bool allows_forwarding_parameters
|
||||
) {
|
||||
pm_parameters_node_t *params = pm_parameters_node_create(parser);
|
||||
bool looping = true;
|
||||
|
@ -11064,7 +11064,10 @@ parse_parameters(
|
|||
pm_parser_local_add_token(parser, &name);
|
||||
} else {
|
||||
name = not_provided(parser);
|
||||
pm_parser_local_add_token(parser, &operator);
|
||||
|
||||
if (allows_forwarding_parameters) {
|
||||
pm_parser_local_add_token(parser, &operator);
|
||||
}
|
||||
}
|
||||
|
||||
pm_block_parameter_node_t *param = pm_block_parameter_node_create(parser, &name, &operator);
|
||||
|
@ -11078,7 +11081,7 @@ parse_parameters(
|
|||
break;
|
||||
}
|
||||
case PM_TOKEN_UDOT_DOT_DOT: {
|
||||
if (!allows_forwarding_parameter) {
|
||||
if (!allows_forwarding_parameters) {
|
||||
pm_parser_err_current(parser, PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES);
|
||||
}
|
||||
|
||||
|
@ -11086,7 +11089,7 @@ parse_parameters(
|
|||
update_parameter_state(parser, &parser->current, &order);
|
||||
parser_lex(parser);
|
||||
|
||||
if (allows_forwarding_parameter) {
|
||||
if (allows_forwarding_parameters) {
|
||||
pm_parser_local_add_constant(parser, "*", 1);
|
||||
pm_parser_local_add_constant(parser, "&", 1);
|
||||
pm_parser_local_add_token(parser, &parser->previous);
|
||||
|
@ -11244,7 +11247,10 @@ parse_parameters(
|
|||
pm_parser_local_add_token(parser, &name);
|
||||
} else {
|
||||
name = not_provided(parser);
|
||||
pm_parser_local_add_token(parser, &operator);
|
||||
|
||||
if (allows_forwarding_parameters) {
|
||||
pm_parser_local_add_token(parser, &operator);
|
||||
}
|
||||
}
|
||||
|
||||
pm_rest_parameter_node_t *param = pm_rest_parameter_node_create(parser, &operator, &name);
|
||||
|
@ -11276,7 +11282,10 @@ parse_parameters(
|
|||
pm_parser_local_add_token(parser, &name);
|
||||
} else {
|
||||
name = not_provided(parser);
|
||||
pm_parser_local_add_token(parser, &operator);
|
||||
|
||||
if (allows_forwarding_parameters) {
|
||||
pm_parser_local_add_token(parser, &operator);
|
||||
}
|
||||
}
|
||||
|
||||
param = (pm_node_t *) pm_keyword_rest_parameter_node_create(parser, &operator, &name);
|
||||
|
|
|
@ -226,7 +226,7 @@
|
|||
│ ├── closing_loc: ∅
|
||||
│ ├── block:
|
||||
│ │ @ BlockNode (location: (17,4)-(19,1))
|
||||
│ │ ├── locals: [:a, :*]
|
||||
│ │ ├── locals: [:a]
|
||||
│ │ ├── parameters:
|
||||
│ │ │ @ BlockParametersNode (location: (17,6)-(17,12))
|
||||
│ │ │ ├── parameters:
|
||||
|
@ -488,7 +488,7 @@
|
|||
│ ├── closing_loc: ∅
|
||||
│ ├── block:
|
||||
│ │ @ BlockNode (location: (32,8)-(34,1))
|
||||
│ │ ├── locals: [:*]
|
||||
│ │ ├── locals: []
|
||||
│ │ ├── parameters:
|
||||
│ │ │ @ BlockParametersNode (location: (32,10)-(32,13))
|
||||
│ │ │ ├── parameters:
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
│ ├── closing_loc: ∅
|
||||
│ ├── block:
|
||||
│ │ @ BlockNode (location: (9,1)-(9,12))
|
||||
│ │ ├── locals: [:*, :b]
|
||||
│ │ ├── locals: [:b]
|
||||
│ │ ├── parameters:
|
||||
│ │ │ @ BlockParametersNode (location: (9,3)-(9,10))
|
||||
│ │ │ ├── parameters:
|
||||
|
@ -265,7 +265,7 @@
|
|||
│ ├── closing_loc: ∅
|
||||
│ ├── block:
|
||||
│ │ @ BlockNode (location: (17,1)-(17,8))
|
||||
│ │ ├── locals: [:*]
|
||||
│ │ ├── locals: []
|
||||
│ │ ├── parameters:
|
||||
│ │ │ @ BlockParametersNode (location: (17,3)-(17,6))
|
||||
│ │ │ ├── parameters:
|
||||
|
@ -379,7 +379,7 @@
|
|||
│ ├── closing_loc: ∅
|
||||
│ ├── block:
|
||||
│ │ @ BlockNode (location: (27,1)-(27,15))
|
||||
│ │ ├── locals: [:a, :*, :b]
|
||||
│ │ ├── locals: [:a, :b]
|
||||
│ │ ├── parameters:
|
||||
│ │ │ @ BlockParametersNode (location: (27,3)-(27,13))
|
||||
│ │ │ ├── parameters:
|
||||
|
@ -533,7 +533,7 @@
|
|||
│ ├── closing_loc: ∅
|
||||
│ ├── block:
|
||||
│ │ @ BlockNode (location: (35,1)-(35,11))
|
||||
│ │ ├── locals: [:a, :*]
|
||||
│ │ ├── locals: [:a]
|
||||
│ │ ├── parameters:
|
||||
│ │ │ @ BlockParametersNode (location: (35,3)-(35,9))
|
||||
│ │ │ ├── parameters:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
@ StatementsNode (location: (1,0)-(5,5))
|
||||
└── body: (length: 3)
|
||||
├── @ LambdaNode (location: (1,0)-(1,8))
|
||||
│ ├── locals: [:*]
|
||||
│ ├── locals: []
|
||||
│ ├── operator_loc: (1,0)-(1,2) = "->"
|
||||
│ ├── opening_loc: (1,5)-(1,6) = "{"
|
||||
│ ├── closing_loc: (1,7)-(1,8) = "}"
|
||||
|
|
Загрузка…
Ссылка в новой задаче