Skip to content

Commit

Permalink
Merge pull request #2332 from ruby/only-warn-on-spcarg
Browse files Browse the repository at this point in the history
Only warn for unary + on spcarg
  • Loading branch information
kddnewton authored Feb 1, 2024
2 parents 787a987 + db0e5ce commit 279cb3c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -9128,12 +9128,10 @@ parser_lex(pm_parser_t *parser) {
LEX(PM_TOKEN_PLUS_EQUAL);
}

bool spcarg = lex_state_spcarg_p(parser, space_seen);
if (spcarg) {
pm_parser_warn_token(parser, &parser->current, PM_WARN_AMBIGUOUS_FIRST_ARGUMENT_PLUS);
}

if (lex_state_beg_p(parser) || spcarg) {
if (
lex_state_beg_p(parser) ||
(lex_state_spcarg_p(parser, space_seen) ? (pm_parser_warn_token(parser, &parser->current, PM_WARN_AMBIGUOUS_FIRST_ARGUMENT_PLUS), true) : false)
) {
lex_state_set(parser, PM_LEX_STATE_BEG);

if (pm_char_is_decimal_digit(peek(parser))) {
Expand Down

0 comments on commit 279cb3c

Please sign in to comment.