AST printing: take more care to only escape 'Self' when needed.

Cleans up AST printing somewhat as well as providing slightly better
type-to-declaration mappings for annotated AST printing and indexing.

Swift SVN r32420
This commit is contained in:
Doug Gregor
2015-10-03 05:13:52 +00:00
parent 9809dbc478
commit 6af6048c0c
15 changed files with 91 additions and 22 deletions

View File

@@ -2049,6 +2049,14 @@ SourceRange GenericTypeParamDecl::getSourceRange() const {
return SourceRange(getNameLoc(), endLoc);
}
bool GenericTypeParamDecl::isProtocolSelf() const {
if (!isImplicit()) return false;
auto dc = getDeclContext();
if (!dc->isProtocolOrProtocolExtensionContext()) return false;
return dc->getProtocolSelf() == this;
}
AssociatedTypeDecl::AssociatedTypeDecl(DeclContext *dc, SourceLoc keywordLoc,
Identifier name, SourceLoc nameLoc,
TypeLoc defaultDefinition)