mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Plumb a 'context' parameter through to AbstractFunctionBody's body synthesizer
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user