diff --git a/src/dscanner/analysis/base.d b/src/dscanner/analysis/base.d index 300ce05..daa0736 100644 --- a/src/dscanner/analysis/base.d +++ b/src/dscanner/analysis/base.d @@ -525,12 +525,14 @@ public: mixin ScopedVisit!BlockStatement; mixin ScopedVisit!ForeachStatement; mixin ScopedVisit!ForStatement; - mixin ScopedVisit!IfStatement; mixin ScopedVisit!Module; mixin ScopedVisit!StructBody; mixin ScopedVisit!TemplateDeclaration; mixin ScopedVisit!WithStatement; mixin ScopedVisit!WhileStatement; + mixin ScopedVisit!DoStatement; + // mixin ScopedVisit!SpecifiedFunctionBody; // covered by BlockStatement + mixin ScopedVisit!ShortenedFunctionBody; override void visit(const SwitchStatement switchStatement) { @@ -540,6 +542,23 @@ public: switchStatement.accept(this); } + override void visit(const IfStatement ifStatement) + { + pushScopeImpl(); + if (ifStatement.condition) + ifStatement.condition.accept(this); + if (ifStatement.thenStatement) + ifStatement.thenStatement.accept(this); + popScopeImpl(); + + if (ifStatement.elseStatement) + { + pushScopeImpl(); + ifStatement.elseStatement.accept(this); + popScopeImpl(); + } + } + static foreach (T; AliasSeq!(CaseStatement, DefaultStatement, CaseRangeStatement)) override void visit(const T stmt) {