[ConstraintGraph] Track constraint graph and type variable belonging to the node

This commit is contained in:
Pavel Yaskevich
2021-02-04 15:03:21 -08:00
parent f9b58a79a3
commit 9372215012
2 changed files with 12 additions and 9 deletions

View File

@@ -59,7 +59,7 @@ ConstraintGraph::lookupNode(TypeVariableType *typeVar) {
}
// Allocate the new node.
auto nodePtr = new ConstraintGraphNode(CS, typeVar);
auto nodePtr = new ConstraintGraphNode(*this, typeVar);
unsigned index = TypeVariables.size();
impl.setGraphNode(nodePtr);
impl.setGraphIndex(index);
@@ -107,7 +107,6 @@ void ConstraintGraphNode::addConstraint(Constraint *constraint) {
assert(ConstraintIndex.count(constraint) == 0 && "Constraint re-insertion");
ConstraintIndex[constraint] = Constraints.size();
Constraints.push_back(constraint);
Bindings.infer(constraint);
}
void ConstraintGraphNode::removeConstraint(Constraint *constraint) {
@@ -119,8 +118,6 @@ void ConstraintGraphNode::removeConstraint(Constraint *constraint) {
ConstraintIndex.erase(pos);
assert(Constraints[index] == constraint && "Mismatched constraint");
Bindings.retract(constraint);
// If this is the last constraint, just pop it off the list and we're done.
unsigned lastIndex = Constraints.size()-1;
if (index == lastIndex) {