diff --git a/dastworx/src/imports.d b/dastworx/src/imports.d index 5b3d5463..3b9f1186 100644 --- a/dastworx/src/imports.d +++ b/dastworx/src/imports.d @@ -80,8 +80,14 @@ private final class ImportLister: ASTVisitor override void visit(const ConditionalDeclaration decl) { - const VersionCondition ver = decl.compileCondition.versionCondition; - if (ver is null || ver.token.text !in badVersions) + bool acc = true; + if (decl.compileCondition) + { + const ver = decl.compileCondition.versionCondition; + if (ver && ver.token.text in badVersions) + acc = false; + } + if (acc) decl.accept(this); } diff --git a/dastworx/src/mainfun.d b/dastworx/src/mainfun.d index 8319807a..05a7897d 100644 --- a/dastworx/src/mainfun.d +++ b/dastworx/src/mainfun.d @@ -35,8 +35,14 @@ private final class MainFunctionDetector: ASTVisitor override void visit(const ConditionalDeclaration decl) { - const VersionCondition ver = decl.compileCondition.versionCondition; - if (ver is null || ver.token.text !in badVersions) + bool acc = true; + if (decl.compileCondition) + { + const ver = decl.compileCondition.versionCondition; + if (ver && ver.token.text in badVersions) + acc = false; + } + if (acc) decl.accept(this); }