Merge pull request #584 from Dmitry-Me/betterVariableName3

Formatting cleanup, better variable name
This commit is contained in:
amai2012 2015-04-02 09:20:31 +02:00
commit 788da37e05
1 changed files with 7 additions and 6 deletions

View File

@ -108,17 +108,18 @@ void CheckAssert::assignmentInAssertError(const Token *tok, const std::string& v
// checks if side effects happen on the variable prior to tmp
void CheckAssert::checkVariableAssignment(const Token* assignTok)
{
const Variable* v = assignTok->previous()->variable();
if (!v) return;
const Variable* prevVar = assignTok->previous()->variable();
if (!prevVar)
return;
// assignment
if (assignTok->isAssignmentOp() || assignTok->type() == Token::eIncDecOp) {
if (prevVar->isConst())
return;
if (v->isConst()) return;
assignmentInAssertError(assignTok, v->name());
assignmentInAssertError(assignTok, prevVar->name());
}
// TODO: function calls on v
// TODO: function calls on prevVar
}
bool CheckAssert::inSameScope(const Token* returnTok, const Token* assignTok)