mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CSStep] Rework how orphaned constraints are handled by splitter/component steps
Orphaned constraints can be re-introduced to the system by `setup` of the component, and all of them could be returned back by `SplitterStep::resume` there so no need to use destructor for that. Also, orphan constraints have to be registered as regular constraints by components as well as marked as "orphaned".
This commit is contained in:
@@ -41,10 +41,6 @@ ComponentStep::Scope::Scope(ComponentStep &component)
|
||||
auto &workList = CS.InactiveConstraints;
|
||||
workList.splice(workList.end(), *component.Constraints);
|
||||
|
||||
auto &CG = CS.getConstraintGraph();
|
||||
if (component.OrphanedConstraint)
|
||||
CG.setOrphanedConstraint(component.OrphanedConstraint);
|
||||
|
||||
SolverScope = new ConstraintSystem::SolverScope(CS);
|
||||
PrevPartialScope = CS.solverState->PartialSolutionScope;
|
||||
CS.solverState->PartialSolutionScope = SolverScope;
|
||||
@@ -148,8 +144,14 @@ void SplitterStep::computeFollowupSteps(
|
||||
numComponents - CG.getOrphanedConstraints().size();
|
||||
{
|
||||
unsigned component = firstOrphanedConstraint;
|
||||
for (auto constraint : CG.getOrphanedConstraints())
|
||||
componentSteps[component++]->recordOrphan(constraint);
|
||||
for (auto *constraint : CG.getOrphanedConstraints()) {
|
||||
// Register this orphan constraint both as associated with
|
||||
// a given component as a regular constrant, as well as an
|
||||
// "orphan" constraint, so it can be proccessed correctly.
|
||||
constraintComponent[constraint] = component;
|
||||
componentSteps[component]->recordOrphan(constraint);
|
||||
++component;
|
||||
}
|
||||
}
|
||||
|
||||
// Transfer all of the constraints from the work list to
|
||||
|
||||
Reference in New Issue
Block a user