mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-10-22 02:37:26 +02:00
Merge v2.056
This commit is contained in:
+49
-10
@@ -970,7 +970,10 @@ int ClassDeclaration::isFuncHidden(FuncDeclaration *fd)
|
||||
{
|
||||
FuncDeclaration *fdstart = s->isFuncDeclaration();
|
||||
//printf("%s fdstart = %p\n", s->kind(), fdstart);
|
||||
return !overloadApply(fdstart, &isf, fd);
|
||||
if (overloadApply(fdstart, &isf, fd))
|
||||
return 0;
|
||||
|
||||
return !fd->parent->isTemplateMixin();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -983,6 +986,8 @@ int ClassDeclaration::isFuncHidden(FuncDeclaration *fd)
|
||||
FuncDeclaration *ClassDeclaration::findFunc(Identifier *ident, TypeFunction *tf)
|
||||
{
|
||||
//printf("ClassDeclaration::findFunc(%s, %s) %s\n", ident->toChars(), tf->toChars(), toChars());
|
||||
FuncDeclaration *fdmatch = NULL;
|
||||
FuncDeclaration *fdambig = NULL;
|
||||
|
||||
ClassDeclaration *cd = this;
|
||||
Dsymbols *vtbl = &cd->vtbl;
|
||||
@@ -996,11 +1001,43 @@ FuncDeclaration *ClassDeclaration::findFunc(Identifier *ident, TypeFunction *tf)
|
||||
|
||||
//printf("\t[%d] = %s\n", i, fd->toChars());
|
||||
if (ident == fd->ident &&
|
||||
//tf->equals(fd->type)
|
||||
fd->type->covariant(tf) == 1
|
||||
)
|
||||
{ //printf("\t\tfound\n");
|
||||
return fd;
|
||||
fd->type->covariant(tf) == 1)
|
||||
{ //printf("fd->parent->isClassDeclaration() = %p", fd->parent->isClassDeclaration());
|
||||
if (!fdmatch)
|
||||
goto Lfd;
|
||||
|
||||
{
|
||||
// Function type matcing: exact > covariant
|
||||
int m1 = tf->equals(fd ->type) ? MATCHexact : MATCHnomatch;
|
||||
int m2 = tf->equals(fdmatch->type) ? MATCHexact : MATCHnomatch;
|
||||
if (m1 > m2)
|
||||
goto Lfd;
|
||||
else if (m1 < m2)
|
||||
goto Lfdmatch;
|
||||
}
|
||||
|
||||
{
|
||||
// The way of definition: non-mixin > mixin
|
||||
int m1 = fd ->parent->isClassDeclaration() ? MATCHexact : MATCHnomatch;
|
||||
int m2 = fdmatch->parent->isClassDeclaration() ? MATCHexact : MATCHnomatch;
|
||||
if (m1 > m2)
|
||||
goto Lfd;
|
||||
else if (m1 < m2)
|
||||
goto Lfdmatch;
|
||||
}
|
||||
|
||||
Lambig:
|
||||
fdambig = fd;
|
||||
//printf("Lambig fdambig = %s %s [%s]\n", fdambig->toChars(), fdambig->type->toChars(), fdambig->loc.toChars());
|
||||
continue;
|
||||
|
||||
Lfd:
|
||||
fdmatch = fd, fdambig = NULL;
|
||||
//printf("Lfd fdmatch = %s %s [%s]\n", fdmatch->toChars(), fdmatch->type->toChars(), fdmatch->loc.toChars());
|
||||
continue;
|
||||
|
||||
Lfdmatch:
|
||||
continue;
|
||||
}
|
||||
//else printf("\t\t%d\n", fd->type->covariant(tf));
|
||||
}
|
||||
@@ -1010,7 +1047,9 @@ FuncDeclaration *ClassDeclaration::findFunc(Identifier *ident, TypeFunction *tf)
|
||||
cd = cd->baseClass;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
if (fdambig)
|
||||
error("ambiguous virtual function %s", fdambig->toChars());
|
||||
return fdmatch;
|
||||
}
|
||||
|
||||
void ClassDeclaration::interfaceSemantic(Scope *sc)
|
||||
@@ -1302,15 +1341,15 @@ void InterfaceDeclaration::semantic(Scope *sc)
|
||||
}
|
||||
|
||||
sc = sc->push(this);
|
||||
sc->stc &= ~(STCfinal | STCauto | STCscope | STCstatic |
|
||||
STCabstract | STCdeprecated | STC_TYPECTOR | STCtls | STCgshared);
|
||||
sc->stc |= storage_class & STC_TYPECTOR;
|
||||
sc->stc &= STCsafe | STCtrusted | STCsystem;
|
||||
sc->parent = this;
|
||||
if (isCOMinterface())
|
||||
sc->linkage = LINKwindows;
|
||||
else if (isCPPinterface())
|
||||
sc->linkage = LINKcpp;
|
||||
sc->structalign = 8;
|
||||
sc->protection = PROTpublic;
|
||||
sc->explicitProtection = 0;
|
||||
structalign = sc->structalign;
|
||||
sc->offset = PTRSIZE * 2;
|
||||
inuse++;
|
||||
|
||||
Reference in New Issue
Block a user