Mercurial > projects > ddmd
diff dmd/TemplateDeclaration.d @ 50:adf6f7f216ea
CondExp.toCBuffer
IsExp.toCBuffer
TemplateValueParameter.toCBuffer
Dsymbol.search
TemplateDeclaration.overloadInsert bug fixed
author | korDen |
---|---|
date | Sat, 21 Aug 2010 10:38:26 +0400 |
parents | 0aa7d1437ada |
children | b7d29f613539 |
line wrap: on
line diff
--- a/dmd/TemplateDeclaration.d Sat Aug 21 07:53:20 2010 +0400 +++ b/dmd/TemplateDeclaration.d Sat Aug 21 10:38:26 2010 +0400 @@ -252,48 +252,51 @@ */ bool overloadInsert(Dsymbol s) { + TemplateDeclaration *pf; TemplateDeclaration f; version (LOG) { - printf("TemplateDeclaration.overloadInsert('%s')\n", s.toChars()); + printf("TemplateDeclaration.overloadInsert('%.*s')\n", s.toChars()); } f = s.isTemplateDeclaration(); if (!f) return false; - for (TemplateDeclaration f2 = this; f2; f2 = f2.overnext) + TemplateDeclaration pthis = this; + for (pf = &pthis; *pf; pf = &(*pf).overnext) { - static if (false) { - // Conflict if TemplateParameter's match - // Will get caught anyway later with TemplateInstance, but - // should check it now. - if (f.parameters.dim != f2.parameters.dim) - goto Lcontinue; +static if (false) { + // Conflict if TemplateParameter's match + // Will get caught anyway later with TemplateInstance, but + // should check it now. + if (f.parameters.dim != f2.parameters.dim) + goto Lcontinue; - for (int i = 0; i < f.parameters.dim; i++) - { - TemplateParameter p1 = cast(TemplateParameter)f.parameters.data[i]; - TemplateParameter p2 = cast(TemplateParameter)f2.parameters.data[i]; + for (int i = 0; i < f.parameters.dim; i++) + { + TemplateParameter p1 = cast(TemplateParameter)f.parameters.data[i]; + TemplateParameter p2 = cast(TemplateParameter)f2.parameters.data[i]; - if (!p1.overloadMatch(p2)) - goto Lcontinue; - } + if (!p1.overloadMatch(p2)) + goto Lcontinue; + } - version (LOG) { - printf("\tfalse: conflict\n"); - } - return false; +version (LOG) { + printf("\tfalse: conflict\n"); +} + return false; - Lcontinue: +Lcontinue: ; - } +} } f.overroot = this; - ///*pf = f; + *pf = f; version (LOG) { printf("\ttrue: no conflict\n"); } + return true; } @@ -304,7 +307,9 @@ string kind() { - assert(false); + return (onemember && onemember.isAggregateDeclaration()) + ? onemember.kind() + : "template"; } string toChars() @@ -339,7 +344,7 @@ { assert(false); } - + // void toDocBuffer(OutBuffer *buf); /*************************************** @@ -359,7 +364,7 @@ int dedtypes_dim = dedtypes.dim; version (LOGM) { - printf("\n+TemplateDeclaration.matchWithInstance(this = %s, ti = %s, flag = %d)\n", toChars(), ti.toChars(), flag); + printf("\n+TemplateDeclaration.matchWithInstance(this = %.*s, ti = %.*s, flag = %d)\n", toChars(), ti.toChars(), flag); } static if (false) { @@ -376,9 +381,9 @@ if (ti.tiargs.dim > parameters_dim && !variadic) { version (LOGM) { - printf(" no match: more arguments than parameters\n"); + printf(" no match: more arguments than parameters\n"); } - return MATCHnomatch; + return MATCHnomatch; } assert(dedtypes_dim == parameters_dim);