Issue #2097 - Implement logical assignment operators

Based-on: 1629106/1, 1684020
This commit is contained in:
Martok 2023-04-26 15:16:33 +02:00 committed by roytam1
commit 10951a169c
9 changed files with 302 additions and 6 deletions

View file

@ -1876,7 +1876,7 @@ TokenStream::getTokenInternal(TokenKind* ttp, Modifier modifier)
case '|':
if (matchChar('|'))
tp->type = TOK_OR;
tp->type = matchChar('=') ? TOK_ORASSIGN : TOK_OR;
else
tp->type = matchChar('=') ? TOK_BITORASSIGN : TOK_BITOR;
goto out;
@ -1887,7 +1887,7 @@ TokenStream::getTokenInternal(TokenKind* ttp, Modifier modifier)
case '&':
if (matchChar('&'))
tp->type = TOK_AND;
tp->type = matchChar('=') ? TOK_ANDASSIGN : TOK_AND;
else
tp->type = matchChar('=') ? TOK_BITANDASSIGN : TOK_BITAND;
goto out;
@ -1906,8 +1906,10 @@ TokenStream::getTokenInternal(TokenKind* ttp, Modifier modifier)
ungetCharIgnoreEOL(c);
tp->type = TOK_OPTCHAIN;
}
} else {
tp->type = matchChar('?') ? TOK_COALESCE : TOK_HOOK;
} else if (matchChar('?')) {
tp->type = matchChar('=') ? TOK_COALESCEASSIGN : TOK_COALESCE;
} else {
tp->type = TOK_HOOK;
}
goto out;