mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user