diff --git a/DCD b/DCD index 1c60c54..a0441ba 160000 --- a/DCD +++ b/DCD @@ -1 +1 @@ -Subproject commit 1c60c5480f70db568279e4637a5033953c777406 +Subproject commit a0441ba8c5c7d841e481413a56a1ebe4f8364811 diff --git a/dub.json b/dub.json index 72cb269..739c83a 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ ], "dependencies": { "libdparse": ">=0.23.1 <0.26.0", - "dcd:dsymbol": ">=0.16.0-beta.2 <0.17.0", + "dcd:dsymbol": ">=0.16.2 <0.17.0", "inifiled": "~>1.3.1", "emsi_containers": "~>0.9.0", "libddoc": "~>0.8.0" diff --git a/dub.selections.json b/dub.selections.json index 7f41c15..d0cfbeb 100644 --- a/dub.selections.json +++ b/dub.selections.json @@ -1,12 +1,12 @@ { "fileVersion": 1, "versions": { - "dcd": "0.16.0-beta.2", + "dcd": "0.16.2", "dsymbol": "0.13.0", "emsi_containers": "0.9.0", "inifiled": "1.3.3", "libddoc": "0.8.0", - "libdparse": "0.25.0", + "libdparse": "0.25.1", "stdx-allocator": "2.77.5" } } diff --git a/libdparse b/libdparse index f8a6c28..6b348eb 160000 --- a/libdparse +++ b/libdparse @@ -1 +1 @@ -Subproject commit f8a6c28589aae180532fb460a1b22e92a0978292 +Subproject commit 6b348eb57922fc8fc77d7b6a02c1ab8afd180b8f diff --git a/src/dscanner/analysis/mismatched_args.d b/src/dscanner/analysis/mismatched_args.d index db75eb4..5cdbea1 100644 --- a/src/dscanner/analysis/mismatched_args.d +++ b/src/dscanner/analysis/mismatched_args.d @@ -1,12 +1,12 @@ module dscanner.analysis.mismatched_args; -import dscanner.analysis.base; -import dscanner.utils : safeAccess; -import dsymbol.scope_; -import dsymbol.symbol; import dparse.ast; import dparse.lexer : tok, Token; +import dscanner.analysis.base; +import dscanner.utils : safeAccess; import dsymbol.builtin.names; +import dsymbol.scope_; +import dsymbol.symbol; /// Checks for mismatched argument and parameter names final class MismatchedArgumentCheck : BaseAnalyzer @@ -22,8 +22,6 @@ final class MismatchedArgumentCheck : BaseAnalyzer override void visit(const FunctionCallExpression fce) { import std.typecons : scoped; - import std.algorithm.iteration : each, map; - import std.array : array; if (fce.arguments is null) return; @@ -53,7 +51,7 @@ final class MismatchedArgumentCheck : BaseAnalyzer { // The cast is a hack because .array() confuses the compiler's overload // resolution code. - const(istring)[] params = sym is null ? [] : sym.argNames[].map!(a => cast() a).array(); + const(istring)[] params = sym is null ? [] : sym.argNames; const ArgMismatch[] mismatches = compareArgsToParams(params, args); if (mismatches.length == 0) matched = true; @@ -251,8 +249,8 @@ unittest unittest { + import dscanner.analysis.config : Check, disabledConfig, StaticAnalysisConfig; import dscanner.analysis.helpers : assertAnalyzerWarnings; - import dscanner.analysis.config : StaticAnalysisConfig, Check, disabledConfig; import std.stdio : stderr; StaticAnalysisConfig sac = disabledConfig(); diff --git a/src/dscanner/analysis/unused.d b/src/dscanner/analysis/unused.d index 9089134..7afd6da 100644 --- a/src/dscanner/analysis/unused.d +++ b/src/dscanner/analysis/unused.d @@ -7,10 +7,10 @@ module dscanner.analysis.unused; import dparse.ast; import dparse.lexer; import dscanner.analysis.base; -import std.container; -import std.regex : Regex, regex, matchAll; import dsymbol.scope_ : Scope; import std.algorithm : all; +import std.container; +import std.regex : matchAll, regex, Regex; /** * Checks for unused variables. @@ -86,10 +86,10 @@ abstract class UnusedIdentifierCheck : BaseAnalyzer override void visit(const SwitchStatement switchStatement) { - if (switchStatement.expression !is null) + if (switchStatement.condition !is null && switchStatement.condition.expression !is null) { interestDepth++; - switchStatement.expression.accept(this); + switchStatement.condition.expression.accept(this); interestDepth--; } switchStatement.accept(this);