Refactorization: Avoid stringification of second branch if first branch was empty in CheckOther::checkDuplicateBranch()
This commit is contained in:
parent
3edc641545
commit
a3fbc5aee5
|
@ -2024,11 +2024,14 @@ void CheckOther::checkDuplicateBranch()
|
||||||
// save if branch code
|
// save if branch code
|
||||||
std::string branch1 = scope->classStart->next()->stringifyList(scope->classEnd);
|
std::string branch1 = scope->classStart->next()->stringifyList(scope->classEnd);
|
||||||
|
|
||||||
|
if (branch1.empty())
|
||||||
|
continue;
|
||||||
|
|
||||||
// save else branch code
|
// save else branch code
|
||||||
std::string branch2 = scope->classEnd->tokAt(3)->stringifyList(scope->classEnd->linkAt(2));
|
std::string branch2 = scope->classEnd->tokAt(3)->stringifyList(scope->classEnd->linkAt(2));
|
||||||
|
|
||||||
// check for duplicates
|
// check for duplicates
|
||||||
if (!branch1.empty() && branch1 == branch2)
|
if (branch1 == branch2)
|
||||||
duplicateBranchError(scope->classDef, scope->classEnd->next());
|
duplicateBranchError(scope->classDef, scope->classEnd->next());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue