ast: fixed hang when checking beid
This commit is contained in:
parent
2ed3b40937
commit
6ac9e180e0
|
@ -447,9 +447,6 @@ static void compileTerm(Token *& tok, std::stack<Token*> &op)
|
||||||
} else if (!Token::Match(tok->next(), "(|[") && !templatefunc) {
|
} else if (!Token::Match(tok->next(), "(|[") && !templatefunc) {
|
||||||
op.push(tok);
|
op.push(tok);
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
} else if (Token::Match(tok, "%type% ( {")) {
|
|
||||||
op.push(tok);
|
|
||||||
tok = tok->linkAt(2);
|
|
||||||
} else {
|
} else {
|
||||||
Token *name = tok;
|
Token *name = tok;
|
||||||
Token *par = templatefunc ? tok->linkAt(1)->next() : tok->next();
|
Token *par = templatefunc ? tok->linkAt(1)->next() : tok->next();
|
||||||
|
@ -508,9 +505,6 @@ static void compileTerm(Token *& tok, std::stack<Token*> &op)
|
||||||
op.pop();
|
op.pop();
|
||||||
}
|
}
|
||||||
op.push(unaryop);
|
op.push(unaryop);
|
||||||
} else if (Token::Match(tok,"( {")) {
|
|
||||||
op.push(tok->next());
|
|
||||||
tok = tok->link()->next();
|
|
||||||
} else if (Token::simpleMatch(tok->link(),") (")) {
|
} else if (Token::simpleMatch(tok->link(),") (")) {
|
||||||
// Parenthesized sub-expression
|
// Parenthesized sub-expression
|
||||||
Token *nextpar = tok->link()->next();
|
Token *nextpar = tok->link()->next();
|
||||||
|
@ -525,6 +519,9 @@ static void compileTerm(Token *& tok, std::stack<Token*> &op)
|
||||||
compileExpression(tok,op);
|
compileExpression(tok,op);
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
}
|
}
|
||||||
|
} else if (tok->str() == "{") {
|
||||||
|
op.push(tok);
|
||||||
|
tok = tok->link()->next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10157,9 +10157,12 @@ private:
|
||||||
// ({..})
|
// ({..})
|
||||||
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"));
|
||||||
ASSERT_EQUALS("xa(= bc( yd(= ef(", testAst("x=(int)(a({b(c);}));"
|
ASSERT_EQUALS("xa{((= bc( yd{((= ef(",
|
||||||
"y=(int)(d({e(f);}));"));
|
testAst("x=(int)(a({b(c);}));" // don't hang
|
||||||
|
"y=(int)(d({e(f);}));"));
|
||||||
|
ASSERT_EQUALS("QT_WA{{,( QT_WA{{,( x1=",
|
||||||
|
testAst("QT_WA({},{x=0;});" // don't hang
|
||||||
|
"QT_WA({x=1;},{x=2;});"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void astbrackets() const { // []
|
void astbrackets() const { // []
|
||||||
|
|
Loading…
Reference in New Issue