AST: fixed ast for 'a(new (X), 5);'
This commit is contained in:
parent
c537c98751
commit
f96ea94048
|
@ -664,7 +664,7 @@ static void compilePrecedence3(Token *&tok, AST_state& state)
|
|||
tok = tok->link()->next();
|
||||
if (Token::Match(tok->link(), ") %type%"))
|
||||
tok = tok->link()->next();
|
||||
else if (Token::Match(tok, "( %type%") && Token::Match(tok->link(), ") [();]"))
|
||||
else if (Token::Match(tok, "( %type%") && Token::Match(tok->link(), ") [();,]"))
|
||||
tok = tok->next();
|
||||
else if (Token::Match(tok, "( &| %var%") && Token::simpleMatch(tok->link(), ") ("))
|
||||
tok = tok->next();
|
||||
|
@ -682,6 +682,8 @@ static void compilePrecedence3(Token *&tok, AST_state& state)
|
|||
} else if (tok->str() == "[" || tok->str() == "(")
|
||||
compilePrecedence2(tok, state);
|
||||
compileUnaryOp(newtok, state, nullptr);
|
||||
if (Token::simpleMatch(tok, ") ,"))
|
||||
tok = tok->next();
|
||||
} else if (state.cpp && Token::Match(tok, "delete %var%|*|&|::|(|[")) {
|
||||
Token* tok2 = tok;
|
||||
tok = tok->next();
|
||||
|
|
|
@ -8388,6 +8388,7 @@ private:
|
|||
ASSERT_EQUALS("aFoo(new=", testAst("a = new Foo<bar>();"));
|
||||
ASSERT_EQUALS("X12,3,(new", testAst("new (a,b,c) X(1,2,3);"));
|
||||
ASSERT_EQUALS("aXnew(", testAst("a (new (X));"));
|
||||
ASSERT_EQUALS("aXnew5,(", testAst("a (new (X), 5);"));
|
||||
ASSERT_EQUALS("adelete", testAst("delete a;"));
|
||||
ASSERT_EQUALS("adelete", testAst("delete (a);"));
|
||||
ASSERT_EQUALS("adelete", testAst("delete[] a;"));
|
||||
|
|
Loading…
Reference in New Issue