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:
Eli Friedman
2012-06-07 19:50:18 +00:00
parent 7965dff03d
commit 64d67103fa
2 changed files with 6 additions and 5 deletions

View File

@@ -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);
}
//===----------------------------------------------------------------------===//