[AST] Break down IdentTypeRepr to different subtypes.

This makes memory allocation for it more efficient and it's more convenient to handle.

Swift SVN r12541
This commit is contained in:
Argyrios Kyrtzidis
2014-01-18 20:19:09 +00:00
parent 20af73f973
commit 84e20a0620
16 changed files with 413 additions and 261 deletions

View File

@@ -185,13 +185,11 @@ bool SemaAnnotator::walkToTypeReprPre(TypeRepr *T) {
if (isDone())
return false;
if (IdentTypeRepr *IdT = dyn_cast<IdentTypeRepr>(T)) {
for (auto &Comp : IdT->Components) {
if (ValueDecl *VD = Comp.getBoundDecl())
return passReference(VD, Comp.getIdLoc());
if (TypeDecl *TyD = getTypeDecl(Comp.getBoundType()))
return passReference(TyD, Comp.getIdLoc());
}
if (auto IdT = dyn_cast<ComponentIdentTypeRepr>(T)) {
if (ValueDecl *VD = IdT->getBoundDecl())
return passReference(VD, IdT->getIdLoc());
if (TypeDecl *TyD = getTypeDecl(IdT->getBoundType()))
return passReference(TyD, IdT->getIdLoc());
}
return true;
}

View File

@@ -294,14 +294,12 @@ bool ModelASTWalker::walkToTypeReprPre(TypeRepr *T) {
if (!handleAttrs(AttrT->getAttrs()))
return false;
} else if (auto IdT = dyn_cast<IdentTypeRepr>(T)) {
for (auto &comp : IdT->Components) {
if (!passNonTokenNode({ SyntaxNodeKind::TypeId,
CharSourceRange(comp.getIdLoc(),
comp.getIdentifier().getLength())
}))
return false;
}
} else if (auto IdT = dyn_cast<ComponentIdentTypeRepr>(T)) {
if (!passNonTokenNode({ SyntaxNodeKind::TypeId,
CharSourceRange(IdT->getIdLoc(),
IdT->getIdentifier().getLength())
}))
return false;
}
return true;
}