Extract repeating checks, break loop early
This commit is contained in:
parent
79f74fc4d3
commit
7e823e6d8e
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue