Skip to content

Commit

Permalink
Merge pull request #1694 from ruby/super-blockarg
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton authored Oct 17, 2023
2 parents 6621158 + 0ea19ed commit fbd101d
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 13 deletions.
6 changes: 5 additions & 1 deletion src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -13158,7 +13158,11 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power) {
pm_arguments_t arguments = PM_EMPTY_ARGUMENTS;
parse_arguments_list(parser, &arguments, true);

if (arguments.opening_loc.start == NULL && arguments.arguments == NULL) {
if (
arguments.opening_loc.start == NULL &&
arguments.arguments == NULL &&
((arguments.block == NULL) || PM_NODE_TYPE_P(arguments.block, PM_BLOCK_NODE))
) {
return (pm_node_t *) pm_forwarding_super_node_create(parser, &keyword, &arguments);
}

Expand Down
10 changes: 10 additions & 0 deletions test/prism/fixtures/super.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ super()
super(1)

super(1, 2, 3)

super &:foo

super(&:foo)

super {}

super(1, 2, 3) {}

super(1, 2, 3, &:foo)
102 changes: 90 additions & 12 deletions test/prism/snapshots/super.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fbd101d

Please sign in to comment.