Extract repeating checks, break loop early

This commit is contained in:
Dmitry-Me 2017-09-05 00:04:48 +03:00
parent 79f74fc4d3
commit 7e823e6d8e
1 changed files with 7 additions and 3 deletions

View File

@ -402,11 +402,15 @@ bool CheckClass::canNotCopy(const Scope *scope)
for (func = scope->functionList.begin(); func != scope->functionList.end(); ++func) {
if (func->isConstructor())
constructor = true;
if ((func->type == Function::eCopyConstructor) &&
func->access == Public)
if (func->access != Public)
continue;
if (func->type == Function::eCopyConstructor) {
publicCopy = true;
else if (func->type == Function::eOperatorEqual && func->access == Public)
break;
} else if (func->type == Function::eOperatorEqual) {
publicAssign = true;
break;
}
}
return constructor && !(publicAssign || publicCopy);