ast: fixed syntax tree for 'a=(b)?1:0'. The parentheses should not be in the syntax tree
This commit is contained in:
parent
ad0269eeeb
commit
d6e3b3d3f3
|
@ -377,7 +377,7 @@ static bool iscast(const Token *tok)
|
|||
|
||||
for (const Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
|
||||
if (!Token::Match(tok2, "%var%|*|&|::"))
|
||||
return Token::Match(tok2, ") %any%") && (!tok2->next()->isOp() && !Token::Match(tok2->next(), "[[]);,]"));
|
||||
return Token::Match(tok2, ") %any%") && (!tok2->next()->isOp() && !Token::Match(tok2->next(), "[[]);,?:]"));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -10152,6 +10152,7 @@ private:
|
|||
ASSERT_EQUALS("a1(2+=",testAst("a=(t*)1+2;"));
|
||||
ASSERT_EQUALS("a1(2+=",testAst("a=(t&)1+2;"));
|
||||
ASSERT_EQUALS("ab::r&c(=", testAst("a::b& r = (a::b&)c;")); // #5261
|
||||
ASSERT_EQUALS("ab1?0:=", testAst("a=(b)?1:0;"));
|
||||
|
||||
// ({..})
|
||||
ASSERT_EQUALS("a{+d+ bc+", testAst("a+({b+c;})+d"));
|
||||
|
|
Loading…
Reference in New Issue