Formatting cleanup, better variable name
This commit is contained in:
parent
72b4809da0
commit
7b69396223
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue