AST: Improved handling when calling function through function pointer hidden within parantheses '(a.f)(1,2)'
This commit is contained in:
parent
3b11ee9e0e
commit
771dc2e1ad
|
@ -479,6 +479,14 @@ static void compileTerm(Token *& tok, std::stack<Token*> &op)
|
||||||
} else if (Token::Match(tok,"( {")) {
|
} else if (Token::Match(tok,"( {")) {
|
||||||
op.push(tok->next());
|
op.push(tok->next());
|
||||||
tok = tok->link()->next();
|
tok = tok->link()->next();
|
||||||
|
} else if (Token::simpleMatch(tok->link(),") (")) {
|
||||||
|
// Parenthesized sub-expression
|
||||||
|
Token *nextpar = tok->link()->next();
|
||||||
|
tok = tok->next();
|
||||||
|
compileExpression(tok,op);
|
||||||
|
tok = nextpar;
|
||||||
|
compileBinOp(tok, compileExpression, op);
|
||||||
|
tok = tok->next();
|
||||||
} else {
|
} else {
|
||||||
// Parenthesized sub-expression
|
// Parenthesized sub-expression
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
|
|
@ -10016,6 +10016,8 @@ private:
|
||||||
ASSERT_EQUALS("123+*4*", testAst("1*(2+3)*4"));
|
ASSERT_EQUALS("123+*4*", testAst("1*(2+3)*4"));
|
||||||
ASSERT_EQUALS("ifab.c&d==(", testAst("if((a.b&c)==d){}"));
|
ASSERT_EQUALS("ifab.c&d==(", testAst("if((a.b&c)==d){}"));
|
||||||
|
|
||||||
|
ASSERT_EQUALS("pf.pf.12,(&&", testAst("((p.f) && (p.f)(1,2))"));
|
||||||
|
|
||||||
// casts
|
// casts
|
||||||
ASSERT_EQUALS("a1(2(+=",testAst("a=(t)1+(t)2;"));
|
ASSERT_EQUALS("a1(2(+=",testAst("a=(t)1+(t)2;"));
|
||||||
ASSERT_EQUALS("a1(2+=",testAst("a=(t)1+2;"));
|
ASSERT_EQUALS("a1(2+=",testAst("a=(t)1+2;"));
|
||||||
|
|
Loading…
Reference in New Issue