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) {
|
for (func = scope->functionList.begin(); func != scope->functionList.end(); ++func) {
|
||||||
if (func->isConstructor())
|
if (func->isConstructor())
|
||||||
constructor = true;
|
constructor = true;
|
||||||
if ((func->type == Function::eCopyConstructor) &&
|
if (func->access != Public)
|
||||||
func->access == Public)
|
continue;
|
||||||
|
if (func->type == Function::eCopyConstructor) {
|
||||||
publicCopy = true;
|
publicCopy = true;
|
||||||
else if (func->type == Function::eOperatorEqual && func->access == Public)
|
break;
|
||||||
|
} else if (func->type == Function::eOperatorEqual) {
|
||||||
publicAssign = true;
|
publicAssign = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return constructor && !(publicAssign || publicCopy);
|
return constructor && !(publicAssign || publicCopy);
|
||||||
|
|
Loading…
Reference in New Issue