don't write pointless TokAnd at start of control scopes

a colon after else/for is non-AND-ing, i.e., it's no logical operator,
but "punctuation". therefore, putting an operator into the token stream
is bogus. it didn't hurt execution, so it went unnoticed, but it still
wasted some bytes and cpu cycles.

Change-Id: If5578074257feed299bda1630bf0dfe72eb395ae
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Oswald Buddenhagen 2015-02-18 10:54:24 +01:00
parent bb26d1da00
commit bec885380a

View File

@ -910,8 +910,14 @@ void QMakeParser::flushCond(ushort *&tokPtr)
void QMakeParser::putOperator(ushort *&tokPtr)
{
if (m_operator != NoOperator) {
putTok(tokPtr, (m_operator == AndOperator) ? TokAnd : TokOr);
if (m_operator== AndOperator) {
// A colon must be used after else and for() if no brace is used,
// but in this case it is obviously not a binary operator.
if (m_state == StCond)
putTok(tokPtr, TokAnd);
m_operator = NoOperator;
} else if (m_operator == OrOperator) {
putTok(tokPtr, TokOr);
m_operator = NoOperator;
}
}