mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Make addImplicitConstructors a static method
This commit is contained in:
@@ -833,7 +833,7 @@ static bool areAllStoredPropertiesDefaultInitializable(NominalTypeDecl *decl) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void addImplicitConstructorsToStruct(StructDecl *decl, ASTContext &ctx) {
|
||||
static void addImplicitConstructorsToStruct(StructDecl *decl) {
|
||||
assert(!decl->hasClangNode() &&
|
||||
"ClangImporter is responsible for adding implicit constructors");
|
||||
assert(!decl->hasUnreferenceableStorage() &&
|
||||
@@ -884,6 +884,7 @@ static void addImplicitConstructorsToStruct(StructDecl *decl, ASTContext &ctx) {
|
||||
|
||||
if (FoundMemberwiseInitializedProperty) {
|
||||
// Create the implicit memberwise constructor.
|
||||
auto &ctx = decl->getASTContext();
|
||||
auto ctor = createImplicitConstructor(
|
||||
decl, ImplicitConstructorKind::Memberwise, ctx);
|
||||
decl->addMember(ctor);
|
||||
@@ -893,7 +894,7 @@ static void addImplicitConstructorsToStruct(StructDecl *decl, ASTContext &ctx) {
|
||||
TypeChecker::defineDefaultConstructor(decl);
|
||||
}
|
||||
|
||||
static void addImplicitConstructorsToClass(ClassDecl *decl, ASTContext &ctx) {
|
||||
static void addImplicitConstructorsToClass(ClassDecl *decl) {
|
||||
// Bail out if we're validating one of our constructors already;
|
||||
// we'll revisit the issue later.
|
||||
if (!decl->hasClangNode()) {
|
||||
@@ -911,6 +912,7 @@ static void addImplicitConstructorsToClass(ClassDecl *decl, ASTContext &ctx) {
|
||||
// variable.
|
||||
bool FoundDesignatedInit = false;
|
||||
|
||||
auto &ctx = decl->getASTContext();
|
||||
SmallVector<std::pair<ValueDecl *, Type>, 4> declaredInitializers;
|
||||
llvm::SmallPtrSet<ConstructorDecl *, 4> overriddenInits;
|
||||
if (decl->hasClangNode()) {
|
||||
@@ -1104,9 +1106,9 @@ void TypeChecker::addImplicitConstructors(NominalTypeDecl *decl) {
|
||||
}
|
||||
|
||||
if (auto *structDecl = dyn_cast<StructDecl>(decl))
|
||||
addImplicitConstructorsToStruct(structDecl, Context);
|
||||
addImplicitConstructorsToStruct(structDecl);
|
||||
if (auto *classDecl = dyn_cast<ClassDecl>(decl))
|
||||
addImplicitConstructorsToClass(classDecl, Context);
|
||||
addImplicitConstructorsToClass(classDecl);
|
||||
}
|
||||
|
||||
void TypeChecker::synthesizeMemberForLookup(NominalTypeDecl *target,
|
||||
|
||||
Reference in New Issue
Block a user