Use the list of extensions of a nominal type for name lookup into that type.

This replaces the obscure, inefficient lookup into extensions with
something more straightforward: walk all of the known extensions
(available as a simple list), then eliminate any declarations that
have been shadowed by other declarations. The shadowing rules still
need to consider the module re-export DAG, but we'll leave that for
later.

As part of this, keep track of the last time we loaded extensions for
a given nominal type. If the list of extensions is out-of-date with
respect to the global generation count (which tracks resolved module
imports), ask the modules to load any additional extensions. Only the
Clang module importer can currently load extensions in this manner.


Swift SVN r5223
This commit is contained in:
Doug Gregor
2013-05-20 18:06:51 +00:00
parent a4ce448280
commit 8114ce16f8
15 changed files with 287 additions and 84 deletions

View File

@@ -50,6 +50,16 @@ public:
/// emits a diagnostic and returns NULL.
virtual Module *
loadModule(SourceLoc importLoc, Module::AccessPathTy path) override;
/// \brief Load extensions to the given nominal type.
///
/// \param nominal The nominal type whose extensions should be loaded.
///
/// \param previousGeneration The previous generation number. The AST already
/// contains extensions loaded from any generation up to and including this
/// one.
virtual void loadExtensions(NominalTypeDecl *nominal,
unsigned previousGeneration) override;
};
}