mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 05:55:46 +02:00
[ruby/prism] Fix defined with new line
It's possible to write the following and have it be valid Ruby:
```
defined?("foo"
)
```
But Prism wasn't taking the new line into account. This adds an
`accept1` for a `PM_TOKEN_NEWLINE` to account for this. I've also
updated the fixtures and snapshots to test this.
b87f8eedc6
This commit is contained in:
parent
82883dc8f2
commit
a33632e1ca
3 changed files with 24 additions and 9 deletions
|
@ -14900,6 +14900,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
|
|||
if (parser->recovering) {
|
||||
rparen = not_provided(parser);
|
||||
} else {
|
||||
accept1(parser, PM_TOKEN_NEWLINE);
|
||||
expect1(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_ERR_EXPECT_RPAREN);
|
||||
rparen = parser->previous;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue