From db0e5ce1cedd6f589d6f20f43914dfd38403ede6 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Thu, 1 Feb 2024 10:55:15 -0500 Subject: [PATCH] Only warn for unary + on spcarg --- src/prism.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/prism.c b/src/prism.c index a1049ceab54..aaa00351049 100644 --- a/src/prism.c +++ b/src/prism.c @@ -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))) {