diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2024-02-01 10:55:15 -0500 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-02-01 16:13:46 +0000 |
| commit | 6ad585bd68af55cbf111ea9b2b44244c8a75e1cd (patch) | |
| tree | ebce9b14e9fb77b1e6a34f39f44ed181d2c41d4e | |
| parent | 1f226b41f04a88062952dcd11c6a97381fa7e510 (diff) | |
[ruby/prism] Only warn for unary + on spcarg
https://github.com/ruby/prism/commit/db0e5ce1ce
| -rw-r--r-- | prism/prism.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/prism/prism.c b/prism/prism.c index a1049ceab5..aaa0035104 100644 --- a/prism/prism.c +++ b/prism/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))) { |
