Formatting cleanup, better variable name

This commit is contained in:
Dmitry-Me 2015-04-01 18:23:51 +03:00
parent 72b4809da0
commit 7b69396223
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 // checks if side effects happen on the variable prior to tmp
void CheckAssert::checkVariableAssignment(const Token* assignTok) void CheckAssert::checkVariableAssignment(const Token* assignTok)
{ {
const Variable* v = assignTok->previous()->variable(); const Variable* prevVar = assignTok->previous()->variable();
if (!v) return; if (!prevVar)
return;
// assignment // assignment
if (assignTok->isAssignmentOp() || assignTok->type() == Token::eIncDecOp) { if (assignTok->isAssignmentOp() || assignTok->type() == Token::eIncDecOp) {
if (prevVar->isConst())
return;
if (v->isConst()) return; assignmentInAssertError(assignTok, prevVar->name());
assignmentInAssertError(assignTok, v->name());
} }
// TODO: function calls on v // TODO: function calls on prevVar
} }
bool CheckAssert::inSameScope(const Token* returnTok, const Token* assignTok) bool CheckAssert::inSameScope(const Token* returnTok, const Token* assignTok)