Set DeclContext for argument parameter patterns

Fixes a crash in Serializer, when processing a function with a selector-style signature.

Also added an AST verifier check that all Decls have a non-null DeclContext.


Swift SVN r8621
This commit is contained in:
Dmitri Hrybenko
2013-09-25 01:47:27 +00:00
parent 5967115a00
commit 33aada4b16
2 changed files with 35 additions and 19 deletions

View File

@@ -193,7 +193,12 @@ namespace {
// Base cases for the various stages of verification.
void verifyParsed(Expr *E) {}
void verifyParsed(Stmt *S) {}
void verifyParsed(Decl *D) {}
void verifyParsed(Decl *D) {
if (!D->getDeclContext()) {
Out << "every Decl should have a DeclContext";
abort();
}
}
void verifyBound(Expr *E) {}
void verifyBound(Stmt *S) {}
void verifyBound(Decl *D) {}
@@ -765,6 +770,8 @@ namespace {
Out << "EnumElementDecl has wrong DeclContext";
abort();
}
return verifyParsed(cast<ValueDecl>(UED));
}
void verifyParsed(AbstractFunctionDecl *AFD) {
@@ -784,6 +791,8 @@ namespace {
abort();
}
}
return verifyParsed(cast<ValueDecl>(AFD));
}
void verifyParsed(ConstructorDecl *CD) {