Skip to content

Commit b75cf83

Browse files
kddnewtonmatzbot
authored andcommitted
[ruby/prism] Revert "Reject p(p a, &block => value) and similar"
ruby/prism@fef2c20777
1 parent 8d73a18 commit b75cf83

File tree

3 files changed

+1
-67
lines changed

3 files changed

+1
-67
lines changed

prism/prism.c

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14244,25 +14244,6 @@ parse_assocs(pm_parser_t *parser, pm_static_literals_t *literals, pm_node_t *nod
1424414244
return contains_keyword_splat;
1424514245
}
1424614246

14247-
static inline bool
14248-
argument_allowed_for_bare_hash(pm_parser_t *parser, pm_node_t *argument) {
14249-
if (pm_symbol_node_label_p(argument)) {
14250-
return true;
14251-
}
14252-
14253-
switch (PM_NODE_TYPE(argument)) {
14254-
case PM_CALL_NODE: {
14255-
pm_call_node_t *cast = (pm_call_node_t *) argument;
14256-
if (cast->opening_loc.start == NULL && cast->arguments != NULL) {
14257-
return false;
14258-
}
14259-
break;
14260-
}
14261-
default: break;
14262-
}
14263-
return accept1(parser, PM_TOKEN_EQUAL_GREATER);
14264-
}
14265-
1426614247
/**
1426714248
* Append an argument to a list of arguments.
1426814249
*/
@@ -14420,7 +14401,7 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for
1442014401
bool contains_keywords = false;
1442114402
bool contains_keyword_splat = false;
1442214403

14423-
if (argument_allowed_for_bare_hash(parser, argument)){
14404+
if (pm_symbol_node_label_p(argument) || accept1(parser, PM_TOKEN_EQUAL_GREATER)) {
1442414405
if (parsed_bare_hash) {
1442514406
pm_parser_err_previous(parser, PM_ERR_ARGUMENT_BARE_HASH);
1442614407
}

test/prism/errors/command_calls_35.txt

Lines changed: 0 additions & 41 deletions
This file was deleted.

test/prism/fixtures/command_method_call.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,3 @@ def foo = bar 1
3939
!foo 1 or !bar 2
4040

4141
not !foo 1
42-
43-
foo(bar baz, key => value)
44-
45-
foo(bar baz, KEY => value)
46-
47-
foo(bar baz, :key => value)

0 commit comments

Comments
 (0)