Fixed #8747 (Syntax error, AST broken (a = --*b))

This commit is contained in:
Daniel Marjamäki 2018-09-27 19:26:08 +02:00
parent b79d829cfc
commit 9dccc4037b
2 changed files with 4 additions and 0 deletions

View File

@ -650,6 +650,9 @@ static bool isPrefixUnary(const Token* tok, bool cpp)
&& (tok->previous()->tokType() != Token::eIncDecOp || tok->tokType() == Token::eIncDecOp)))
return true;
if (tok->str() == "*" && tok->previous()->tokType() == Token::eIncDecOp && isPrefixUnary(tok->previous(), cpp))
return true;
return tok->strAt(-1) == ")" && iscast(tok->linkAt(-1));
}

View File

@ -8466,6 +8466,7 @@ private:
ASSERT_EQUALS("xreturn", testAst("return x;"));
ASSERT_EQUALS("x(throw", testAst(";throw x();"));
ASSERT_EQUALS("a*bc:?return", testAst("return *a ? b : c;"));
ASSERT_EQUALS("xy*--=", testAst("x = -- * y;"));
// Unary :: operator
ASSERT_EQUALS("abcd::12,(e/:?=", testAst("a = b ? c : ::d(1,2) / e;"));