AST: fixed hang for ',&x..'

This commit is contained in:
Daniel Marjamki 2013-11-03 15:05:58 +01:00
parent 8910bae801
commit 9959c2866c
2 changed files with 6 additions and 1 deletions

View File

@ -392,7 +392,11 @@ void TokenList::createAst() const
while (tok->next())
tok = tok->next();
for (; tok; tok = tok->previous()) {
if (tok->isOp() && (!tok->previous() || tok->previous()->isOp() || tok->previous()->type() == Token::eOther) &&
if (tok->isOp() &&
(!tok->previous() ||
tok->previous()->isOp() ||
tok->previous()->str() == "," ||
tok->previous()->type() == Token::eOther) &&
op.find(" "+tok->str()+" ")!=std::string::npos) {
tok->astOperand1(tok->next());
}

View File

@ -9985,6 +9985,7 @@ private:
ASSERT_EQUALS("1(f+2+", testAst("1+f()+2"));
ASSERT_EQUALS("12f+3+", testAst("1+f(2)+3"));
ASSERT_EQUALS("123,f+4+", testAst("1+f(2,3)+4"));
ASSERT_EQUALS("12a&,f+", testAst("1+f(2,&a)"));
}
void asttemplate() const { // uninstantiated templates will have <,>,etc.. how do we handle them?