AST: Remove GenericEnvironment::OwningDC

This commit is contained in:
Slava Pestov
2019-09-05 00:27:02 -04:00
parent 97dd1aa5cc
commit e9bcd00bc2
6 changed files with 2 additions and 59 deletions

View File

@@ -55,35 +55,6 @@ GenericEnvironment::GenericEnvironment(GenericSignature *signature,
Type());
}
void GenericEnvironment::setOwningDeclContext(DeclContext *newOwningDC) {
if (!OwningDC) {
OwningDC = newOwningDC;
return;
}
if (!newOwningDC || OwningDC == newOwningDC)
return;
// Find the least common ancestor context to be the owner.
unsigned oldDepth = OwningDC->getSyntacticDepth();
unsigned newDepth = newOwningDC->getSyntacticDepth();
while (oldDepth > newDepth) {
OwningDC = OwningDC->getParent();
--oldDepth;
}
while (newDepth > oldDepth) {
newOwningDC = newOwningDC->getParent();
--newDepth;
}
while (OwningDC != newOwningDC) {
OwningDC = OwningDC->getParent();
newOwningDC = newOwningDC->getParent();
}
}
void GenericEnvironment::addMapping(GenericParamKey key,
Type contextType) {
// Find the index into the parallel arrays of generic parameters and