AST: Fixed handling of 'a=b(c**)+1'

This commit is contained in:
Daniel Marjamäki 2014-04-26 13:32:08 +02:00
parent c34616a6ba
commit 11856b51aa
2 changed files with 5 additions and 1 deletions

View File

@ -596,8 +596,11 @@ static void compileMulDiv(Token *&tok, std::stack<Token*> &op, unsigned int dept
compileDot(tok,op, depth);
while (tok) {
if (Token::Match(tok, "[*/%]")) {
if (Token::Match(tok, "* [,)]"))
if (Token::Match(tok, "* [*,)]")) {
while (tok->next() && tok->str() == "*")
tok = tok->next();
break;
}
compileBinOp(tok, compileDot, op, depth);
} else break;
}

View File

@ -10345,6 +10345,7 @@ private:
" `-f\n",
testAst("x = ((a[i]).f)();", true));
ASSERT_EQUALS("abcde.++[.=", testAst("a = b.c[++(d.e)];"));
ASSERT_EQUALS("abc(1+=", testAst("a = b(c**)+1;"));
// casts
ASSERT_EQUALS("a1(2(+=",testAst("a=(t)1+(t)2;"));