Move the DeclContext base class from FuncExpr to FuncDecl

FuncDecl still has a FuncExpr because capture list is stored in FuncExpr
(which is a CapturingExpr).


Swift SVN r8179
This commit is contained in:
Dmitri Hrybenko
2013-09-13 01:40:41 +00:00
parent 63ecd5c9d1
commit 0d6d9a0ffb
27 changed files with 208 additions and 201 deletions

View File

@@ -587,12 +587,12 @@ DeclContext *ModuleFile::getDeclContext(DeclID DID) {
return ND;
if (auto ED = dyn_cast<ExtensionDecl>(D))
return ED;
if (auto FD = dyn_cast<FuncDecl>(D))
return FD;
if (auto CD = dyn_cast<ConstructorDecl>(D))
return CD;
if (auto DD = dyn_cast<DestructorDecl>(D))
return DD;
if (auto FD = dyn_cast<FuncDecl>(D))
return FD->getFuncExpr();
llvm_unreachable("unknown DeclContext kind");
}
@@ -963,7 +963,7 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext,
if (genericParams)
for (auto &genericParam : *fn->getGenericParams())
genericParam.getAsTypeParam()->setDeclContext(body);
genericParam.getAsTypeParam()->setDeclContext(fn);
fn->setOverriddenDecl(cast_or_null<FuncDecl>(getDecl(overriddenID)));