AST: fixed ast for '++i;'

This commit is contained in:
Daniel Marjamäki 2014-06-26 17:31:57 +02:00
parent ff9a39d1f6
commit 72992c7973
2 changed files with 2 additions and 1 deletions

View File

@ -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);

View File

@ -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