From 9812a8c8ae2ba46663e0603a5dd8e63808fa0291 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Thu, 30 Apr 2009 23:16:21 +0200 Subject: [PATCH] Commit workaround for TypeFunction comparing issue. --- dmd/func.c | 2 +- dmd/mtype.c | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/dmd/func.c b/dmd/func.c index ee34052d..a63a2681 100644 --- a/dmd/func.c +++ b/dmd/func.c @@ -2084,7 +2084,7 @@ int FuncDeclaration::isNested() //if (!toParent()) //printf("FuncDeclaration::isNested('%s') parent=%p\n", toChars(), parent); //printf("\ttoParent() = '%s'\n", toParent()->toChars()); - return ((storage_class & STCstatic) == 0) && + return ((storage_class & STCstatic) == 0) && toParent2() && (toParent2()->isFuncDeclaration() != NULL); } diff --git a/dmd/mtype.c b/dmd/mtype.c index f0e1bb30..67045a82 100644 --- a/dmd/mtype.c +++ b/dmd/mtype.c @@ -2810,11 +2810,25 @@ void TypeFunction::toDecoBuffer(OutBuffer *buf, bool mangle) // type to prevent merging different member function if (!mangle && funcdecl) { - if (AggregateDeclaration* ad = funcdecl->isMember()) - { - buf->writeByte('M'); - ad->type->toDecoBuffer(buf, false); - } + if (funcdecl->needThis()) + { + AggregateDeclaration* ad = funcdecl->isMember2(); + buf->writeByte('M'); + ad->type->toDecoBuffer(buf, false); + } + /* BUG This causes problems with delegate types + On the other hand, the llvm type for nested functions *is* different + so not doing anything here may be lead to bugs! + A sane solution would be DtoType(Dsymbol)... + if (funcdecl->isNested()) + { + buf->writeByte('M'); + if (funcdecl->toParent2() && funcdecl->toParent2()->isFuncDeclaration()) + { + FuncDeclaration* fd = funcdecl->toParent2()->isFuncDeclaration(); + fd->type->toDecoBuffer(buf, false); + } + }*/ } // Write argument types