[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:
eileencodes 2023-12-05 11:34:20 -05:00 committed by git
parent 82883dc8f2
commit a33632e1ca
3 changed files with 24 additions and 9 deletions

View file

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