Skip to content

Commit

Permalink
[Refactoring] Rename local variables
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Feb 26, 2013
1 parent 709d575 commit 8a5b7d7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 29 deletions.
31 changes: 14 additions & 17 deletions src/func.c
Expand Up @@ -2225,26 +2225,23 @@ int FuncDeclaration::findVtblIndex(Dsymbols *vtbl, int dim)

int FuncDeclaration::overloadInsert(Dsymbol *s)
{
FuncDeclaration *f;
AliasDeclaration *a;

//printf("FuncDeclaration::overloadInsert(s = %s) this = %s\n", s->toChars(), toChars());
a = s->isAliasDeclaration();
if (a)
AliasDeclaration *ad = s->isAliasDeclaration();
if (ad)
{
if (overnext)
return overnext->overloadInsert(a);
if (!a->aliassym && a->type->ty != Tident && a->type->ty != Tinstance)
return overnext->overloadInsert(ad);
if (!ad->aliassym && ad->type->ty != Tident && ad->type->ty != Tinstance)
{
//printf("\ta = '%s'\n", a->type->toChars());
//printf("\tad = '%s'\n", ad->type->toChars());
return FALSE;
}
overnext = a;
overnext = ad;
//printf("\ttrue: no conflict\n");
return TRUE;
}
f = s->isFuncDeclaration();
if (!f)
FuncDeclaration *fd = s->isFuncDeclaration();
if (!fd)
return FALSE;

#if 0
Expand All @@ -2255,11 +2252,11 @@ int FuncDeclaration::overloadInsert(Dsymbol *s)
*/
if (type)
{ printf("type = %s\n", type->toChars());
printf("f->type = %s\n", f->type->toChars());
printf("fd->type = %s\n", fd->type->toChars());
}
if (type && f->type && // can be NULL for overloaded constructors
f->type->covariant(type) &&
f->type->mod == type->mod &&
if (type && fd->type && // can be NULL for overloaded constructors
fd->type->covariant(type) &&
fd->type->mod == type->mod &&
!isFuncAliasDeclaration())
{
//printf("\tfalse: conflict %s\n", kind());
Expand All @@ -2268,8 +2265,8 @@ int FuncDeclaration::overloadInsert(Dsymbol *s)
#endif

if (overnext)
return overnext->overloadInsert(f);
overnext = f;
return overnext->overloadInsert(fd);
overnext = fd;
//printf("\ttrue: no conflict\n");
return TRUE;
}
Expand Down
23 changes: 11 additions & 12 deletions src/template.c
Expand Up @@ -591,29 +591,28 @@ const char *TemplateDeclaration::kind()

int TemplateDeclaration::overloadInsert(Dsymbol *s)
{
TemplateDeclaration **pf;
TemplateDeclaration *f;

#if LOG
printf("TemplateDeclaration::overloadInsert('%s')\n", s->toChars());
#endif
f = s->isTemplateDeclaration();
if (!f)
TemplateDeclaration *td = s->isTemplateDeclaration();
if (!td)
return FALSE;

TemplateDeclaration *pthis = this;
for (pf = &pthis; *pf; pf = &(*pf)->overnext)
TemplateDeclaration **ptd;
for (ptd = &pthis; *ptd; ptd = &(*ptd)->overnext)
{
#if 0
// Conflict if TemplateParameter's match
// Will get caught anyway later with TemplateInstance, but
// should check it now.
TemplateDeclaration *f2 = *pf;
TemplateDeclaration *f2 = *ptd;

if (f->parameters->dim != f2->parameters->dim)
if (td->parameters->dim != f2->parameters->dim)
goto Lcontinue;

for (size_t i = 0; i < f->parameters->dim; i++)
{ TemplateParameter *p1 = (*f->parameters)[i];
for (size_t i = 0; i < td->parameters->dim; i++)
{ TemplateParameter *p1 = (*td->parameters)[i];
TemplateParameter *p2 = (*f2->parameters)[i];

if (!p1->overloadMatch(p2))
Expand All @@ -630,8 +629,8 @@ int TemplateDeclaration::overloadInsert(Dsymbol *s)
#endif
}

f->overroot = this;
*pf = f;
td->overroot = this;
*ptd = td;
#if LOG
printf("\ttrue: no conflict\n");
#endif
Expand Down

0 comments on commit 8a5b7d7

Please sign in to comment.