Fixed #5452 (AST: wrong handling of unary ::)
This commit is contained in:
parent
0747b55485
commit
8550289722
|
@ -531,7 +531,10 @@ static void compileScope(Token *&tok, std::stack<Token*> &op)
|
||||||
compileTerm(tok,op);
|
compileTerm(tok,op);
|
||||||
while (tok) {
|
while (tok) {
|
||||||
if (tok->str() == "::") {
|
if (tok->str() == "::") {
|
||||||
compileBinOp(tok, compileTerm, op);
|
if (tok->previous() && tok->previous()->isName())
|
||||||
|
compileBinOp(tok, compileTerm, op);
|
||||||
|
else
|
||||||
|
compileUnaryOp(tok, compileDot, op);
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10191,6 +10191,9 @@ private:
|
||||||
ASSERT_EQUALS("1a--+", testAst("1 + a--"));
|
ASSERT_EQUALS("1a--+", testAst("1 + a--"));
|
||||||
ASSERT_EQUALS("ab+!", testAst("!(a+b)"));
|
ASSERT_EQUALS("ab+!", testAst("!(a+b)"));
|
||||||
|
|
||||||
|
// Unary :: operator
|
||||||
|
ASSERT_EQUALS("abc?d12,(::e/:=",testAst("a = b ? c : ::d(1,2) / e;"));
|
||||||
|
|
||||||
// how is "--" handled here:
|
// how is "--" handled here:
|
||||||
ASSERT_EQUALS("ab4<<c--+?1:", testAst("a ? (b << 4) + --c : 1"));
|
ASSERT_EQUALS("ab4<<c--+?1:", testAst("a ? (b << 4) + --c : 1"));
|
||||||
ASSERT_EQUALS("ab4<<c--+?1:", testAst("a ? (b << 4) + c-- : 1"));
|
ASSERT_EQUALS("ab4<<c--+?1:", testAst("a ? (b << 4) + c-- : 1"));
|
||||||
|
|
Loading…
Reference in New Issue