mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
One more small fix for constructor name lookup. Make the auto-generated element-wise constructor use the name "constructor".
Swift SVN r2165
This commit is contained in:
@@ -358,6 +358,7 @@ void Module::lookupValueConstructors(Type BaseType,
|
||||
|
||||
TypeDecl *D;
|
||||
Identifier Name;
|
||||
Identifier Constructor = Ctx.getIdentifier("constructor");
|
||||
ArrayRef<ValueDecl*> BaseMembers;
|
||||
SmallVector<ValueDecl*, 2> BaseMembersStorage;
|
||||
if (StructType *ST = BaseType->getAs<StructType>()) {
|
||||
@@ -386,7 +387,7 @@ void Module::lookupValueConstructors(Type BaseType,
|
||||
DeclContext *DC = D->getDeclContext();
|
||||
if (!DC->isModuleContext()) {
|
||||
for (ValueDecl *VD : BaseMembers) {
|
||||
if (VD->getName() == Name)
|
||||
if (VD->getName() == Name || VD->getName() == Constructor)
|
||||
Result.push_back(VD);
|
||||
}
|
||||
return;
|
||||
@@ -394,9 +395,8 @@ void Module::lookupValueConstructors(Type BaseType,
|
||||
|
||||
DoGlobalExtensionLookup(BaseType, Name, BaseMembers, this, cast<Module>(DC),
|
||||
Result);
|
||||
Name = Ctx.getIdentifier("constructor");
|
||||
DoGlobalExtensionLookup(BaseType, Name, BaseMembers, this, cast<Module>(DC),
|
||||
Result);
|
||||
DoGlobalExtensionLookup(BaseType, Constructor, BaseMembers, this,
|
||||
cast<Module>(DC), Result);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Reference in New Issue
Block a user