Fixed #8747 (Syntax error, AST broken (a = --*b))
This commit is contained in:
parent
b79d829cfc
commit
9dccc4037b
|
@ -650,6 +650,9 @@ static bool isPrefixUnary(const Token* tok, bool cpp)
|
||||||
&& (tok->previous()->tokType() != Token::eIncDecOp || tok->tokType() == Token::eIncDecOp)))
|
&& (tok->previous()->tokType() != Token::eIncDecOp || tok->tokType() == Token::eIncDecOp)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (tok->str() == "*" && tok->previous()->tokType() == Token::eIncDecOp && isPrefixUnary(tok->previous(), cpp))
|
||||||
|
return true;
|
||||||
|
|
||||||
return tok->strAt(-1) == ")" && iscast(tok->linkAt(-1));
|
return tok->strAt(-1) == ")" && iscast(tok->linkAt(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8466,6 +8466,7 @@ private:
|
||||||
ASSERT_EQUALS("xreturn", testAst("return x;"));
|
ASSERT_EQUALS("xreturn", testAst("return x;"));
|
||||||
ASSERT_EQUALS("x(throw", testAst(";throw x();"));
|
ASSERT_EQUALS("x(throw", testAst(";throw x();"));
|
||||||
ASSERT_EQUALS("a*bc:?return", testAst("return *a ? b : c;"));
|
ASSERT_EQUALS("a*bc:?return", testAst("return *a ? b : c;"));
|
||||||
|
ASSERT_EQUALS("xy*--=", testAst("x = -- * y;"));
|
||||||
|
|
||||||
// Unary :: operator
|
// Unary :: operator
|
||||||
ASSERT_EQUALS("abcd::12,(e/:?=", testAst("a = b ? c : ::d(1,2) / e;"));
|
ASSERT_EQUALS("abcd::12,(e/:?=", testAst("a = b ? c : ::d(1,2) / e;"));
|
||||||
|
|
Loading…
Reference in New Issue