Break the loop once the result can no longer change.

This commit is contained in:
Dmitry-Me 2014-07-01 17:16:45 +04:00
parent b7d7633b97
commit 454dd0a736
1 changed files with 4 additions and 1 deletions

View File

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