More null checks (#517)

same as #513, just for a few more constructs. The switch statement already had the same thing in
This commit is contained in:
Jan Jurzitza 2017-08-13 19:06:23 +02:00 committed by Basile Burg
parent c98fa77f95
commit 8d53f8887e
1 changed files with 20 additions and 10 deletions

View File

@ -90,18 +90,26 @@ class UnusedVariableCheck : BaseAnalyzer
}
override void visit(const WhileStatement whileStatement)
{
if (whileStatement.expression !is null)
{
interestDepth++;
whileStatement.expression.accept(this);
interestDepth--;
}
if (whileStatement.declarationOrStatement !is null)
whileStatement.declarationOrStatement.accept(this);
}
override void visit(const DoStatement doStatement)
{
if (doStatement.expression !is null)
{
interestDepth++;
doStatement.expression.accept(this);
interestDepth--;
}
if (doStatement.statementNoCaseNoDefault !is null)
doStatement.statementNoCaseNoDefault.accept(this);
}
@ -121,6 +129,7 @@ class UnusedVariableCheck : BaseAnalyzer
forStatement.increment.accept(this);
interestDepth--;
}
if (forStatement.declarationOrStatement !is null)
forStatement.declarationOrStatement.accept(this);
}
@ -157,6 +166,7 @@ class UnusedVariableCheck : BaseAnalyzer
override void visit(const AssignExpression assignExp)
{
if (assignExp.ternaryExpression !is null)
assignExp.ternaryExpression.accept(this);
if (assignExp.expression !is null)
{