Cache and reuse value
This commit is contained in:
parent
aece2254d7
commit
5885988b1f
|
@ -1245,11 +1245,12 @@ void CheckClass::operatorEq()
|
||||||
}
|
}
|
||||||
if (!returnSelfRef) {
|
if (!returnSelfRef) {
|
||||||
// make sure we really have a copy assignment operator
|
// make sure we really have a copy assignment operator
|
||||||
if (Token::Match(func->tokenDef->tokAt(2), "const| %name% &")) {
|
const Token *paramTok = func->tokenDef->tokAt(2);
|
||||||
if (func->tokenDef->strAt(2) == "const" &&
|
if (Token::Match(paramTok, "const| %name% &")) {
|
||||||
func->tokenDef->strAt(3) == scope->className)
|
if (paramTok->str() == "const" &&
|
||||||
|
paramTok->strAt(1) == scope->className)
|
||||||
operatorEqReturnError(func->retDef, scope->className);
|
operatorEqReturnError(func->retDef, scope->className);
|
||||||
else if (func->tokenDef->strAt(2) == scope->className)
|
else if (paramTok->str() == scope->className)
|
||||||
operatorEqReturnError(func->retDef, scope->className);
|
operatorEqReturnError(func->retDef, scope->className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue