Merge pull request #353 from Dmitry-Me/breakLoopEarlyInsteadOfContinuingBitwiseAnd

Break the loop once the result can no longer change.
This commit is contained in:
Daniel Marjamäki 2014-07-03 06:54:00 +02:00
commit 51396e52aa
1 changed files with 4 additions and 1 deletions

View File

@ -81,7 +81,10 @@ void CheckAssert::assertWithSideEffects()
bool noReturnInScope = true;
for (std::vector<const Token*>::iterator rt = returnTokens.begin(); rt != returnTokens.end(); ++rt) {
noReturnInScope &= !inSameScope(*rt, tok2);
if (inSameScope(*rt, tok2)) {
noReturnInScope = false;
break;
}
}
if (noReturnInScope) continue;
bool isAssigned = checkVariableAssignment(tok2, false);