canBeNull function
Returns true
if expression
could be null
.
Implementation
bool canBeNull(ast.AST expression) {
if (expression is ast.LiteralPrimitive ||
expression is ast.EmptyExpr ||
expression is ast.Interpolation) {
return false;
}
if (expression is ast.IfNull) {
if (!canBeNull(expression.condition)) return false;
return canBeNull(expression.nullExp);
}
return true;
}