AST: fixed ast for 'for (*x=0;y;z)'
This commit is contained in:
parent
225fb96554
commit
484483bd5d
|
@ -717,7 +717,7 @@ static Token * createAstAtToken(Token *tok)
|
|||
tok2 = tok2->link();
|
||||
if (!tok2)
|
||||
break;
|
||||
} else if (Token::Match(tok2, "%var% %op%|(|[|.|=|:|::") || Token::Match(tok2->previous(), "[;{}] %cop%|(")) {
|
||||
} else if (Token::Match(tok2, "%var% %op%|(|[|.|=|:|::") || Token::Match(tok2->previous(), "[(;{}] %cop%|(")) {
|
||||
init1 = tok2;
|
||||
std::stack<Token *> operands;
|
||||
compileExpression(tok2, operands);
|
||||
|
|
|
@ -10291,6 +10291,7 @@ private:
|
|||
TODO_ASSERT_EQUALS("fori1=current0=,iNUM<=i++;;(", "fori1=current0=,i<NUM=i++;;(", testAst("for(i = (1), current = 0; i <= (NUM); ++i)"));
|
||||
ASSERT_EQUALS("foreachxy,((", testAst("for(each(x,y)){}")); // it's not well-defined what this ast should be
|
||||
ASSERT_EQUALS("forab:(", testAst("for (int a : b);"));
|
||||
ASSERT_EQUALS("forx*0=yz;;(", testAst("for(*x=0;y;z)"));
|
||||
|
||||
// problems with multiple expressions
|
||||
ASSERT_EQUALS("ax( whilex(", testAst("a(x) while (x)"));
|
||||
|
|
Loading…
Reference in New Issue