Skip to content

Commit

Permalink
Expand fix to reset nullability for all the Visit* methods
Browse files Browse the repository at this point in the history
  • Loading branch information
smitpatel committed Jun 28, 2019
1 parent c3d964f commit 62ca418
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ private SqlParameterExpression VisitSqlParameterExpression(SqlParameterExpressio

private SqlUnaryExpression VisitSqlUnaryExpression(SqlUnaryExpression sqlUnaryExpression)
{
_isNullable = false;
var newOperand = (SqlExpression)Visit(sqlUnaryExpression.Operand);

// IsNull/IsNotNull
// IsNull/IsNotNull
if (sqlUnaryExpression.OperatorType == ExpressionType.Equal
|| sqlUnaryExpression.OperatorType == ExpressionType.NotEqual)
{
Expand All @@ -103,6 +104,7 @@ private SqlUnaryExpression VisitSqlUnaryExpression(SqlUnaryExpression sqlUnaryEx

private LikeExpression VisitLikeExpression(LikeExpression likeExpression)
{
_isNullable = false;
var newMatch = (SqlExpression)Visit(likeExpression.Match);
var isNullable = _isNullable;
var newPattern = (SqlExpression)Visit(likeExpression.Pattern);
Expand Down Expand Up @@ -149,6 +151,7 @@ private SqlExpression VisitJoinPredicate(SqlBinaryExpression predicate)

private CaseExpression VisitCaseExpression(CaseExpression caseExpression)
{
_isNullable = false;
// if there is no 'else' there is a possibility of null, when none of the conditions are met
// otherwise the result is nullable if any of the WhenClause results OR ElseResult is nullable
var isNullable = caseExpression.ElseResult == null;
Expand Down Expand Up @@ -188,9 +191,11 @@ private SqlFunctionExpression VisitSqlFunctionExpression(SqlFunctionExpression s

private SqlBinaryExpression VisitSqlBinaryExpression(SqlBinaryExpression sqlBinaryExpression)
{
_isNullable = false;
var newLeft = (SqlExpression)Visit(sqlBinaryExpression.Left);
var leftNullable = _isNullable;

_isNullable = false;
var newRight = (SqlExpression)Visit(sqlBinaryExpression.Right);
var rightNullable = _isNullable;

Expand Down

0 comments on commit 62ca418

Please sign in to comment.