AST: Plumb a 'context' parameter through to AbstractFunctionBody's body synthesizer

This commit is contained in:
Slava Pestov
2018-12-06 18:30:21 -05:00
parent 16df43494c
commit 6f243d4ab3
7 changed files with 40 additions and 33 deletions

View File

@@ -29,7 +29,7 @@ using namespace swift;
/// Sets the body of the given function to `return nil`.
///
/// \param funcDecl The function whose body to set.
static void deriveNilReturn(AbstractFunctionDecl *funcDecl) {
static void deriveNilReturn(AbstractFunctionDecl *funcDecl, void *) {
auto *parentDC = funcDecl->getDeclContext();
auto &C = parentDC->getASTContext();
@@ -43,7 +43,7 @@ static void deriveNilReturn(AbstractFunctionDecl *funcDecl) {
/// Sets the body of the given function to `return self.rawValue`.
///
/// \param funcDecl The function whose body to set.
static void deriveRawValueReturn(AbstractFunctionDecl *funcDecl) {
static void deriveRawValueReturn(AbstractFunctionDecl *funcDecl, void *) {
auto *parentDC = funcDecl->getDeclContext();
auto &C = parentDC->getASTContext();
@@ -62,7 +62,7 @@ static void deriveRawValueReturn(AbstractFunctionDecl *funcDecl) {
/// the parameter of the given constructor.
///
/// \param initDecl The constructor whose body to set.
static void deriveRawValueInit(AbstractFunctionDecl *initDecl) {
static void deriveRawValueInit(AbstractFunctionDecl *initDecl, void *) {
auto *parentDC = initDecl->getDeclContext();
auto &C = parentDC->getASTContext();
@@ -190,7 +190,7 @@ static ValueDecl *deriveProperty(DerivedConformance &derived, Type type,
///
/// \param strValDecl The function whose body to set.
static void
deriveBodyCodingKey_enum_stringValue(AbstractFunctionDecl *strValDecl) {
deriveBodyCodingKey_enum_stringValue(AbstractFunctionDecl *strValDecl, void *) {
// enum SomeEnum {
// case A, B, C
// @derived var stringValue: String {
@@ -255,7 +255,7 @@ deriveBodyCodingKey_enum_stringValue(AbstractFunctionDecl *strValDecl) {
///
/// \param initDecl The function whose body to set.
static void
deriveBodyCodingKey_init_stringValue(AbstractFunctionDecl *initDecl) {
deriveBodyCodingKey_init_stringValue(AbstractFunctionDecl *initDecl, void *) {
// enum SomeEnum {
// case A, B, C
// @derived init?(stringValue: String) {
@@ -279,7 +279,7 @@ deriveBodyCodingKey_init_stringValue(AbstractFunctionDecl *initDecl) {
auto elements = enumDecl->getAllElements();
if (elements.empty() /* empty enum */) {
deriveNilReturn(initDecl);
deriveNilReturn(initDecl, nullptr);
return;
}