AST: fixed ast for '++i;'
This commit is contained in:
parent
ff9a39d1f6
commit
72992c7973
|
@ -866,7 +866,7 @@ static Token * createAstAtToken(Token *tok, bool cpp)
|
|||
if (Token::Match(tok, "%type% <") && Token::Match(tok->linkAt(1), "> !!("))
|
||||
return tok->linkAt(1);
|
||||
|
||||
if (tok->str() == "return" || !tok->previous() || Token::Match(tok, "%var% %op%|(|[|.|::") || Token::Match(tok->previous(), "[;{}] %cop%|( !!{")) {
|
||||
if (tok->str() == "return" || !tok->previous() || Token::Match(tok, "%var% %op%|(|[|.|::") || Token::Match(tok->previous(), "[;{}] %cop%|++|--|( !!{")) {
|
||||
Token * const tok1 = tok;
|
||||
AST_state state(cpp);
|
||||
compileExpression(tok, state);
|
||||
|
|
|
@ -10649,6 +10649,7 @@ private:
|
|||
// how is "--" handled here:
|
||||
ASSERT_EQUALS("ab4<<c--+1:?", testAst("a ? (b << 4) + --c : 1"));
|
||||
ASSERT_EQUALS("ab4<<c--+1:?", testAst("a ? (b << 4) + c-- : 1"));
|
||||
ASSERT_EQUALS("ai[i= i--", testAst("a[i]=i; --i;"));
|
||||
}
|
||||
|
||||
void astfunction() const { // function calls
|
||||
|
|
Loading…
Reference in New Issue