AST: Fix ast for 'for ((..initexpr..);;)'
This commit is contained in:
parent
011c5e97f9
commit
7e65b561f0
|
@ -1387,6 +1387,18 @@ static Token * createAstAtToken(Token *tok, bool cpp)
|
|||
init1 = tok2;
|
||||
AST_state state1(cpp);
|
||||
compileExpression(tok2, state1);
|
||||
if (init1->str() == "(") {
|
||||
for (Token *tok3 = init1; tok3 != tok3->link(); tok3 = tok3->next()) {
|
||||
if (tok3->astParent()) {
|
||||
while (tok3->astParent())
|
||||
tok3 = tok3->astParent();
|
||||
init1 = tok3;
|
||||
break;
|
||||
}
|
||||
if (!Token::Match(tok3, "%op%|(|["))
|
||||
init1 = tok3;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while (tok2 && tok2 != endPar && tok2->str() != ";") {
|
||||
if (tok2->str() == "<" && tok2->link()) {
|
||||
|
|
|
@ -7677,6 +7677,8 @@ private:
|
|||
|
||||
ASSERT_EQUALS("pf.pf.12,(&&", testAst("((p.f) && (p.f)(1,2))"));
|
||||
|
||||
ASSERT_EQUALS("forresdirGetFirst.file&_T(,(=;;(", testAst("for ((res = dir.GetFirst(&file, _T("")));;) {}"));
|
||||
|
||||
// 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){}"));
|
||||
|
|
Loading…
Reference in New Issue