mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Parsable interface and type reconstruction support for opaque types.
When printing a swiftinterface, represent opaque result types using an attribute that refers to the mangled name of the defining decl for the opaque type. To turn this back into a reference to the right decl's implicit OpaqueTypeDecl, use type reconstruction. Since type reconstruction doesn't normally concern itself with non-type decls, set up a lookup table in SourceFiles and ModuleFiles to let us handle the mapping from mangled name to opaque type decl in type reconstruction. (Since we're invoking type reconstruction during type checking, when the module hasn't yet been fully validated, we need to plumb a LazyResolver into the ASTBuilder in an unsightly way. Maybe there's a better way to do this... Longer term, at least, this surface design gives space for doing things more the right way--a more request-ified decl validator ought to be able to naturally lazily service this request without the LazyResolver reference, and if type reconstruction in the future learns how to reconstruct non-type decls, then the lookup tables can go away.)
This commit is contained in:
@@ -222,6 +222,9 @@ public:
|
||||
SmallVectorImpl<ValueDecl*> &results) const override;
|
||||
|
||||
virtual TypeDecl *lookupLocalType(StringRef MangledName) const override;
|
||||
|
||||
virtual OpaqueTypeDecl *
|
||||
lookupOpaqueResultType(StringRef MangledName, LazyResolver *resolver) override;
|
||||
|
||||
virtual TypeDecl *
|
||||
lookupNestedType(Identifier name,
|
||||
@@ -269,6 +272,8 @@ public:
|
||||
|
||||
virtual void
|
||||
getLocalTypeDecls(SmallVectorImpl<TypeDecl*> &results) const override;
|
||||
virtual void
|
||||
getOpaqueReturnTypeDecls(SmallVectorImpl<OpaqueTypeDecl*> &results) const override;
|
||||
|
||||
virtual void getDisplayDecls(SmallVectorImpl<Decl*> &results) const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user