mirror of https://gitlab.com/basile.b/dexed.git
dastworx, prevent analysis of modules without module declaration
This commit is contained in:
parent
4ceca1b9eb
commit
465ea9d267
|
@ -28,10 +28,14 @@ in
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
mixin(logCall);
|
mixin(logCall);
|
||||||
writeln('"', mod.moduleDeclaration.moduleName.identifiers
|
auto rng = mod.moduleDeclaration.moduleName.identifiers
|
||||||
.map!(a => a.text).join("."), '"');
|
.map!(a => a.text).join(".");
|
||||||
|
if (!rng.empty)
|
||||||
|
{
|
||||||
|
writeln('"', rng, '"');
|
||||||
construct!(ImportLister).visit(mod);
|
construct!(ImportLister).visit(mod);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists the modules imported by several modules
|
* Lists the modules imported by several modules
|
||||||
|
@ -54,12 +58,16 @@ 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);
|
||||||
writeln('"', mod.moduleDeclaration.moduleName.identifiers
|
auto rng = mod.moduleDeclaration.moduleName.identifiers
|
||||||
.map!(a => a.text).join("."), '"');
|
.map!(a => a.text).join(".");
|
||||||
|
if (!rng.empty)
|
||||||
|
{
|
||||||
|
writeln('"', rng, '"');
|
||||||
il.visit(mod);
|
il.visit(mod);
|
||||||
stdout.flush;
|
stdout.flush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private final class ImportLister: ASTVisitor
|
private final class ImportLister: ASTVisitor
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue