Skip to content

Commit

Permalink
Fix bugs in RecursiveStatementVisitor (#824)
Browse files Browse the repository at this point in the history
`AtRootRule.query` and `Declaration.value` can be null, so this should be checked before passing them on to `visitInterpolation` and `visitExpression`.
  • Loading branch information
jathak authored and nex3 committed Sep 23, 2019
1 parent 42ac7a8 commit 553cf9a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/visitor/recursive_statement.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import 'interface/statement.dart';
/// The default implementation of the visit methods all return `null`.
abstract class RecursiveStatementVisitor<T> implements StatementVisitor<T> {
T visitAtRootRule(AtRootRule node) {
visitInterpolation(node.query);
if (node.query != null) visitInterpolation(node.query);
return visitChildren(node);
}

Expand All @@ -47,7 +47,7 @@ abstract class RecursiveStatementVisitor<T> implements StatementVisitor<T> {

T visitDeclaration(Declaration node) {
visitInterpolation(node.name);
visitExpression(node.value);
if (node.value != null) visitExpression(node.value);
return node.children == null ? null : visitChildren(node);
}

Expand Down

0 comments on commit 553cf9a

Please sign in to comment.