AST: Fix wrong handling for '{scope} (expr)'
This commit is contained in:
parent
becc275f2c
commit
ef26b55737
|
@ -934,7 +934,7 @@ 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 (Token::simpleMatch(tok->previous(), "} (")
|
if ((oldOpSize > 0 && Token::simpleMatch(tok->previous(), "} ("))
|
||||||
|| (tok->previous() && tok->previous()->isName() && !Token::Match(tok->previous(), "return|case") && (!state.cpp || !Token::Match(tok->previous(), "throw|delete")))
|
|| (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))
|
||||||
|
|
|
@ -7672,6 +7672,7 @@ private:
|
||||||
// Type{data}()
|
// Type{data}()
|
||||||
ASSERT_EQUALS("ab{(=", testAst("a=b{}();"));
|
ASSERT_EQUALS("ab{(=", testAst("a=b{}();"));
|
||||||
ASSERT_EQUALS("abc{((=", testAst("a=b(c{}());"));
|
ASSERT_EQUALS("abc{((=", testAst("a=b(c{}());"));
|
||||||
|
ASSERT_EQUALS("f( xNULL!=0(x(:?", testAst("void f() { {} ((x != NULL) ? (void)0 : x()); }"));
|
||||||
|
|
||||||
// ({..})
|
// ({..})
|
||||||
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