Merge pull request #742 from Dmitry-Me/reduceScopeBetterName
Reduce variable scope, better name
This commit is contained in:
commit
e8b2b5e934
|
@ -1876,11 +1876,12 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
|
||||||
if (lhs->astParent()->strAt(1) != "const")
|
if (lhs->astParent()->strAt(1) != "const")
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
const Variable* v2 = lhs->previous()->variable();
|
if (lhs->tokType() == Token::eAssignmentOp) {
|
||||||
if (lhs->tokType() == Token::eAssignmentOp && v2)
|
const Variable* lhsVar = lhs->previous()->variable();
|
||||||
if (!v2->isConst() && v2->isReference() && lhs == v2->nameToken()->next())
|
if (lhsVar && !lhsVar->isConst() && lhsVar->isReference() && lhs == lhsVar->nameToken()->next())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const Token* jumpBackToken = nullptr;
|
const Token* jumpBackToken = nullptr;
|
||||||
const Token *lastVarTok = tok1;
|
const Token *lastVarTok = tok1;
|
||||||
|
|
Loading…
Reference in New Issue