Fixed #9023 (AST: wrong lhs for a = b + foo(A::Hash{}("")))
This commit is contained in:
parent
9155f3a83a
commit
a350ed9bc2
|
@ -912,7 +912,8 @@ static void compilePrecedence2(Token *&tok, AST_state& state)
|
||||||
const std::size_t oldOpSize = state.op.size();
|
const std::size_t oldOpSize = state.op.size();
|
||||||
compileExpression(tok, state);
|
compileExpression(tok, state);
|
||||||
tok = tok2;
|
tok = tok2;
|
||||||
if ((tok->previous() && tok->previous()->isName() && (!Token::Match(tok->previous(), "return|case") && (!state.cpp || !Token::Match(tok->previous(), "throw|delete"))))
|
if (Token::Match(tok->previous(), "} (")
|
||||||
|
|| (tok->previous() && tok->previous()->isName() && !Token::Match(tok->previous(), "return|case") && (!state.cpp || !Token::Match(tok->previous(), "throw|delete")))
|
||||||
|| (tok->strAt(-1) == "]" && (!state.cpp || !Token::Match(tok->linkAt(-1)->previous(), "new|delete")))
|
|| (tok->strAt(-1) == "]" && (!state.cpp || !Token::Match(tok->linkAt(-1)->previous(), "new|delete")))
|
||||||
|| (tok->strAt(-1) == ">" && tok->linkAt(-1))
|
|| (tok->strAt(-1) == ">" && tok->linkAt(-1))
|
||||||
|| (tok->strAt(-1) == ")" && !iscast(tok->linkAt(-1))) // Don't treat brackets to clarify precedence as function calls
|
|| (tok->strAt(-1) == ")" && !iscast(tok->linkAt(-1))) // Don't treat brackets to clarify precedence as function calls
|
||||||
|
|
|
@ -7656,6 +7656,10 @@ private:
|
||||||
ASSERT_EQUALS("n0=", testAst("TrivialDefCtor{[2][2]}[1][1].n = 0;"));
|
ASSERT_EQUALS("n0=", testAst("TrivialDefCtor{[2][2]}[1][1].n = 0;"));
|
||||||
ASSERT_EQUALS("aT12,3,{1[=", testAst("a = T{1, 2, 3}[1];"));
|
ASSERT_EQUALS("aT12,3,{1[=", testAst("a = T{1, 2, 3}[1];"));
|
||||||
|
|
||||||
|
// Type{data}()
|
||||||
|
ASSERT_EQUALS("ab{(=", testAst("a=b{}();"));
|
||||||
|
ASSERT_EQUALS("abc{((=", testAst("a=b(c{}());"));
|
||||||
|
|
||||||
// ({..})
|
// ({..})
|
||||||
ASSERT_EQUALS("a{+d+ bc+", testAst("a+({b+c;})+d"));
|
ASSERT_EQUALS("a{+d+ bc+", testAst("a+({b+c;})+d"));
|
||||||
ASSERT_EQUALS("a{d*+ bc+", testAst("a+({b+c;})*d"));
|
ASSERT_EQUALS("a{d*+ bc+", testAst("a+({b+c;})*d"));
|
||||||
|
|
Loading…
Reference in New Issue