Excise the global TranslationUnit from TypeChecker.

Now that TypeChecker is being used to check all sorts of things (not all
from a single TU), it's not really correct to have a single top-level TU
that gets used everywhere. Instead, we should be using the TU that's
appropriate for whatever's being checked. This is a small correctness win
for order-independent type-checking, but is critical for multi-file
translation units, which is needed for implicit visibility.

This basically involves passing around DeclContexts much more.

Caveat: we aren't smart about, say, filtering extensions based on the
current context, so we're still not 100% correct here.

Swift SVN r9006
This commit is contained in:
Jordan Rose
2013-10-07 23:47:55 +00:00
parent 348ace2211
commit c2b00fc2d4
24 changed files with 541 additions and 409 deletions

View File

@@ -434,7 +434,7 @@ class CodeCompletionCallbacksImpl : public CodeCompletionCallbacks,
/// \returns true on success, false on failure.
bool typecheckParsedType() {
assert(ParsedTypeLoc.getTypeRepr() && "should have a TypeRepr");
return !performTypeLocChecking(TU, ParsedTypeLoc, false);
return !performTypeLocChecking(TU, ParsedTypeLoc, CurDeclContext, false);
}
public: