Mercurial > projects > ldc
diff dmd2/dsymbol.c @ 953:5fa3e0ea06e9
Merged a bunch recent dmd v1 frontend changes into the dmd v2 tree.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Fri, 13 Feb 2009 22:20:30 +0100 |
parents | 356e65836fb5 |
children | 638d16625da2 |
line wrap: on
line diff
--- a/dmd2/dsymbol.c Thu Feb 12 18:39:14 2009 +0100 +++ b/dmd2/dsymbol.c Fri Feb 13 22:20:30 2009 +0100 @@ -560,6 +560,34 @@ return NULL; } + +/********************************** + * Determine which Module a Dsymbol will be compiled in. + * This may be different from getModule for templates. + */ + +Module *Dsymbol::getCompilationModule() +{ + Module *m; + TemplateInstance *ti; + Dsymbol *s; + + //printf("Dsymbol::getModule()\n"); + s = this; + while (s) + { + //printf("\ts = '%s'\n", s->toChars()); + m = s->isModule(); + if (m) + return m; + ti = s->isTemplateInstance(); + if (ti && ti->tmodule) + return ti->tmodule; + s = s->parent; + } + return NULL; +} + /************************************* */