ast: fixed trouble with 'ab=a+(b/(c))+d;' where the '(c)' could be mistaken for a cast
This commit is contained in:
parent
4f11086505
commit
04cb56e070
|
@ -370,7 +370,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() && tok2->next()->str() != "[");
|
||||
return Token::Match(tok2, ") %any%") && (!tok2->next()->isOp() && !Token::Match(tok2->next(), "[[])]"));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -10074,6 +10074,9 @@ private:
|
|||
|
||||
ASSERT_EQUALS("'X''a'>", testAst("('X' > 'a')"));
|
||||
ASSERT_EQUALS("'X''a'>", testAst("(L'X' > L'a')"));
|
||||
|
||||
ASSERT_EQUALS("a0>bc/?d:", testAst("(a>0) ? (b/(c)) : d;"));
|
||||
ASSERT_EQUALS("abc/+d+", testAst("a + (b/(c)) + d;"));
|
||||
}
|
||||
|
||||
void astpar() const { // parentheses
|
||||
|
|
Loading…
Reference in New Issue