From 465ea9d267c63adde23d36562b09840c7c78a818 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Tue, 18 Oct 2016 03:16:37 +0200 Subject: [PATCH] dastworx, prevent analysis of modules without module declaration --- dastworx/src/imports.d | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/dastworx/src/imports.d b/dastworx/src/imports.d index cc465d8d..ea430461 100644 --- a/dastworx/src/imports.d +++ b/dastworx/src/imports.d @@ -28,9 +28,13 @@ in body { mixin(logCall); - writeln('"', mod.moduleDeclaration.moduleName.identifiers - .map!(a => a.text).join("."), '"'); - construct!(ImportLister).visit(mod); + auto rng = mod.moduleDeclaration.moduleName.identifiers + .map!(a => a.text).join("."); + if (!rng.empty) + { + writeln('"', rng, '"'); + construct!(ImportLister).visit(mod); + } } /** @@ -54,10 +58,14 @@ void listFilesImports(string[] files) ubyte[] source = cast(ubyte[]) std.file.read(fname); Module mod = parseModule(getTokensForParser(source, config, &cache), fname, &allocator, &ignoreErrors); - writeln('"', mod.moduleDeclaration.moduleName.identifiers - .map!(a => a.text).join("."), '"'); - il.visit(mod); - stdout.flush; + auto rng = mod.moduleDeclaration.moduleName.identifiers + .map!(a => a.text).join("."); + if (!rng.empty) + { + writeln('"', rng, '"'); + il.visit(mod); + stdout.flush; + } } }