mirror of https://gitlab.com/basile.b/dexed.git
dastworx, imports ana, fix AV when no moduleDeclaration
This commit is contained in:
parent
465ea9d267
commit
4cb04ac073
|
@ -12,7 +12,7 @@ import
|
||||||
/**
|
/**
|
||||||
* Lists the modules imported by a module
|
* Lists the modules imported by a module
|
||||||
*
|
*
|
||||||
* On the first line writes the module name between double quotes then
|
* On the first line writes the module name or # between double quotes then
|
||||||
* each import is written in a new line. Import detection is not accurate,
|
* each import is written in a new line. Import detection is not accurate,
|
||||||
* the imports injected by a mixin template or by a string variable are not detected,
|
* the imports injected by a mixin template or by a string variable are not detected,
|
||||||
* the imports deactivated by a static condition neither.
|
* the imports deactivated by a static condition neither.
|
||||||
|
@ -28,20 +28,20 @@ in
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
mixin(logCall);
|
mixin(logCall);
|
||||||
auto rng = mod.moduleDeclaration.moduleName.identifiers
|
if (mod.moduleDeclaration)
|
||||||
.map!(a => a.text).join(".");
|
writeln('"', mod.moduleDeclaration.moduleName.identifiers
|
||||||
if (!rng.empty)
|
.map!(a => a.text).join("."), '"');
|
||||||
{
|
else
|
||||||
writeln('"', rng, '"');
|
writeln("\"#\"");
|
||||||
construct!(ImportLister).visit(mod);
|
construct!(ImportLister).visit(mod);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists the modules imported by several modules
|
* Lists the modules imported by several modules
|
||||||
*
|
*
|
||||||
* The output consists of several consecutive lists, as formated for
|
* The output consists of several consecutive lists, as formated for
|
||||||
* listImports.
|
* listImports. When no moduleDeclaration is available, the first line of
|
||||||
|
* a list matches the filename.
|
||||||
*
|
*
|
||||||
* The results are used by to detect which are the static libraries used by a
|
* The results are used by to detect which are the static libraries used by a
|
||||||
* runnable module.
|
* runnable module.
|
||||||
|
@ -58,14 +58,13 @@ void listFilesImports(string[] files)
|
||||||
ubyte[] source = cast(ubyte[]) std.file.read(fname);
|
ubyte[] source = cast(ubyte[]) std.file.read(fname);
|
||||||
Module mod = parseModule(getTokensForParser(source, config, &cache),
|
Module mod = parseModule(getTokensForParser(source, config, &cache),
|
||||||
fname, &allocator, &ignoreErrors);
|
fname, &allocator, &ignoreErrors);
|
||||||
auto rng = mod.moduleDeclaration.moduleName.identifiers
|
if (mod.moduleDeclaration)
|
||||||
.map!(a => a.text).join(".");
|
writeln('"', mod.moduleDeclaration.moduleName.identifiers
|
||||||
if (!rng.empty)
|
.map!(a => a.text).join("."), '"');
|
||||||
{
|
else
|
||||||
writeln('"', rng, '"');
|
writeln('"', fname, '"');
|
||||||
il.visit(mod);
|
il.visit(mod);
|
||||||
stdout.flush;
|
stdout.flush;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue