diff --git a/src/module.c b/src/module.c index 332e2855e3b5..1c623d968354 100644 --- a/src/module.c +++ b/src/module.c @@ -57,6 +57,7 @@ Module::Module(const char *filename, Identifier *ident, int doDocComment, int do numlines = 0; members = NULL; isDocFile = 0; + isPackageFile = false; needmoduleinfo = 0; selfimports = 0; insearch = 0; @@ -331,6 +332,8 @@ void Module::parse() char *srcname = srcfile->name->toChars(); //printf("Module::parse(srcname = '%s')\n", srcname); + isPackageFile = (strcmp(srcfile->name->name(), "package.d") == 0); + utf8_t *buf = (utf8_t *)srcfile->buffer; size_t buflen = srcfile->len; @@ -557,8 +560,7 @@ void Module::parse() // Insert module into the symbol table Dsymbol *s = this; - bool isPackageMod = strcmp(srcfile->name->name(), "package.d") == 0; - if (isPackageMod) + if (isPackageFile) { /* If the source tree is as follows: * pkg/ @@ -602,7 +604,7 @@ void Module::parse() } else if (Package *pkg = prev->isPackage()) { - if (pkg->isPkgMod == PKGunknown && isPackageMod) + if (pkg->isPkgMod == PKGunknown && isPackageFile) { /* If the previous inserted Package is not yet determined as package.d, * link it to the actual module. diff --git a/src/module.h b/src/module.h index e04513e24781..9cb7a6144d48 100644 --- a/src/module.h +++ b/src/module.h @@ -83,6 +83,7 @@ class Module : public Package unsigned errors; // if any errors in file unsigned numlines; // number of lines in source file int isDocFile; // if it is a documentation input file, not D source + bool isPackageFile; // if it is a package.d int needmoduleinfo; int selfimports; // 0: don't know, 1: does not, 2: does