AST: Fixed handling of 'a = b.c[++(d.e)];'
This commit is contained in:
parent
ffa55bbaa0
commit
c34616a6ba
|
@ -499,9 +499,9 @@ static void compileTerm(Token *& tok, std::stack<Token*> &op, unsigned int depth
|
|||
}
|
||||
} else if (Token::Match(tok, "++|--")) {
|
||||
bool pre = false;
|
||||
if (tok->next() && tok->next()->isName())
|
||||
if (Token::Match(tok->next(), "%var%|("))
|
||||
pre = true;
|
||||
else if (!op.empty() && !op.top()->isOp())
|
||||
else if (!op.empty() && !Token::Match(tok->previous(), "(|[") && !op.top()->isOp())
|
||||
pre = false;
|
||||
else
|
||||
pre = true;
|
||||
|
|
|
@ -10332,6 +10332,9 @@ private:
|
|||
// problems with: if (x[y]==z)
|
||||
ASSERT_EQUALS("ifa(0[1==(", testAst("if(a()[0]==1){}"));
|
||||
ASSERT_EQUALS("ifbuff0[&(*1==(", testAst("if (*((DWORD*)&buff[0])==1){}"));
|
||||
ASSERT_EQUALS("ifp*0[1==(", testAst("if((*p)[0]==1)"));
|
||||
|
||||
// problems with: x=expr
|
||||
ASSERT_EQUALS("=\n"
|
||||
"|-x\n"
|
||||
"`-(\n"
|
||||
|
@ -10341,7 +10344,7 @@ private:
|
|||
" | `-i\n"
|
||||
" `-f\n",
|
||||
testAst("x = ((a[i]).f)();", true));
|
||||
ASSERT_EQUALS("ifp*0[1==(", testAst("if((*p)[0]==1)"));
|
||||
ASSERT_EQUALS("abcde.++[.=", testAst("a = b.c[++(d.e)];"));
|
||||
|
||||
// casts
|
||||
ASSERT_EQUALS("a1(2(+=",testAst("a=(t)1+(t)2;"));
|
||||
|
|
Loading…
Reference in New Issue