summaryrefslogtreecommitdiffstats
path: root/qmake/library/qmakeparser.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <[email protected]>2015-02-18 10:54:24 +0100
committerOswald Buddenhagen <[email protected]>2015-02-25 13:54:53 +0000
commitbec885380a091dc0b37b372acf88cc3d17c80779 (patch)
tree56f26e57a283a15b66bdf2e63e289dc597fd983d /qmake/library/qmakeparser.cpp
parentbb26d1da0028d61e7f72fff3643af0c4601ab63e (diff)
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 <[email protected]>
Diffstat (limited to 'qmake/library/qmakeparser.cpp')
-rw-r--r--qmake/library/qmakeparser.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp
index 4d389b94927..8094e3a9a7f 100644
--- a/qmake/library/qmakeparser.cpp
+++ b/qmake/library/qmakeparser.cpp
@@ -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;
}
}