Skip to content

Commit

Permalink
[Refactoring] Add Module::isPackageFile
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Mar 14, 2014
1 parent cca9dd3 commit 849013a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/module.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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/
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/module.h
Expand Up @@ -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
Expand Down

0 comments on commit 849013a

Please sign in to comment.