75 references to IsNull
Microsoft.CodeAnalysis (7)
CodeGen\SwitchIntegralJumpTableEmitter.SwitchBucket.cs (1)
265
&& !constant.
IsNull
CodeGen\SwitchStringJumpTableEmitter.cs (2)
175
(stringConstant.IsString || stringConstant.
IsNull
));
193
Debug.Assert(stringConstant.
IsNull
|| stringConstant.IsString);
Operations\ControlFlowGraphBuilder.cs (1)
3298
ConstantValue? constantValue = operand.GetConstantValue() is {
IsNull
: var isNull }
SwitchConstantValueHelper.cs (3)
58
if (first.
IsNull
)
63
return second.
IsNull
? 0 : -1;
65
else if (second.
IsNull
)
Microsoft.CodeAnalysis.CSharp (60)
Binder\Binder_Conversions.cs (1)
1626
return sourceConstantValue.
IsNull
? sourceConstantValue : null;
Binder\Binder_Invocation.cs (1)
1412
else if (defaultConstantValue.
IsNull
)
Binder\Binder_Operators.cs (9)
1924
bool leftIsNull = leftConstant.
IsNull
;
1925
bool rightIsNull = rightConstant.
IsNull
;
1951
if (valueLeft.
IsNull
) return valueRight.
IsNull
;
1952
if (valueRight.
IsNull
) return false;
1955
if (valueLeft.
IsNull
) return !valueRight.
IsNull
;
1956
if (valueRight.
IsNull
) return true;
3857
Debug.Assert(constantValue.
IsNull
);
Binder\Binder_Patterns.cs (1)
681
if (inputType.IsNullableType() && (convertedExpression.ConstantValueOpt == null || !convertedExpression.ConstantValueOpt.
IsNull
))
Binder\ForEachLoopBinder.cs (1)
1001
if (collectionExpr.ConstantValueOpt is {
IsNull
: true })
Binder\PatternExplainer.cs (2)
694
!(typeHasExactTypeLiteral(type) && !value.
IsNull
);
716
if (value.
IsNull
)
Binder\SwitchBinder.cs (1)
276
return constantValue.
IsNull
? s_nullKey : constantValue.Value;
BoundTree\BoundDecisionDag.cs (3)
179
return inputConstant.
IsNull
;
181
return !inputConstant.
IsNull
;
185
return inputConstant.
IsNull
? (bool?)false : null;
BoundTree\Formatting.cs (1)
39
get { return ConstantValueOpt?.
IsNull
== true ? MessageID.IDS_NULL.Localize() : base.Display; }
BoundTree\LengthBasedStringSwitchData.cs (2)
144
if (inputCase.value.
IsNull
)
154
foreach (var group in inputCases.Where(c => !c.value.
IsNull
).GroupBy(c => c.value.StringValue!.Length))
CodeGen\EmitExpression.cs (3)
400
if (receiverConstant?.
IsNull
== false)
1482
return !constVal.
IsNull
;
3258
if (((object)type != null) && (type.TypeKind == TypeKind.TypeParameter) && constantValue.
IsNull
)
Compilation\CSharpCompilation.cs (2)
2167
if (sourceConstantValue is {
IsNull
: true } && destination.IsReferenceType)
2178
if (result.IsReference && sourceConstantValue is {
IsNull
: true })
FlowAnalysis\AbstractFlowPass.cs (4)
982
case BoundConstantPattern { ConstantValue: {
IsNull
: false } }:
986
case BoundConstantPattern { ConstantValue: {
IsNull
: true } }:
2399
var isNullConstant = binary.Right.ConstantValueOpt?.
IsNull
== true;
2452
var isNullConstant = binary.Left.ConstantValueOpt?.
IsNull
== true;
FlowAnalysis\NullableWalker.cs (13)
2258
if (value.ConstantValueOpt?.
IsNull
== true && !useLegacyWarnings)
2759
isDefaultValue: parameter.ExplicitDefaultConstantValue?.
IsNull
== true);
4499
var isNullConstant = rightOperand.ConstantValueOpt?.
IsNull
== true;
4583
var isNullConstant = leftOperand.ConstantValueOpt?.
IsNull
== true;
4780
if (binary.Right.ConstantValueOpt?.
IsNull
== true)
4784
else if (binary.Left.ConstantValueOpt?.
IsNull
== true)
5298
if (receiver.ConstantValueOpt is {
IsNull
: false })
5855
if (left.ConstantValueOpt?.
IsNull
== true)
5861
else if (right.ConstantValueOpt?.
IsNull
== true)
5938
if (comparand.ConstantValueOpt?.
IsNull
== true)
7097
return expr.ConstantValueOpt == ConstantValue.NotAvailable || !expr.ConstantValueOpt.
IsNull
|| expr.IsSuppressed ? NullableAnnotation.NotAnnotated : NullableAnnotation.Annotated;
10675
SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.
IsNull
== true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull));
10779
if (node.Argument.ConstantValueOpt?.
IsNull
!= true
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (1)
740
if ((object)operand.Type == null && operand.ConstantValueOpt != null && operand.ConstantValueOpt.
IsNull
)
Lowering\DiagnosticsPass_Warnings.cs (2)
330
if (node.Left.Type.SpecialType == SpecialType.System_Object && !IsExplicitCast(node.Left) && !(node.Left.ConstantValueOpt != null && node.Left.ConstantValueOpt.
IsNull
) && ConvertedHasEqual(node.OperatorKind, node.Right, out t))
335
else if (node.Right.Type.SpecialType == SpecialType.System_Object && !IsExplicitCast(node.Right) && !(node.Right.ConstantValueOpt != null && node.Right.ConstantValueOpt.
IsNull
) && ConvertedHasEqual(node.OperatorKind, node.Left, out t))
Lowering\LocalRewriter\LocalRewriter_AsOperator.cs (1)
60
Debug.Assert(constantValue.
IsNull
);
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (2)
2011
return MakeLiteral(syntax, ConstantValue.Create(rewrittenExpr.ConstantValueOpt.
IsNull
, ConstantValueTypeDiscriminator.Boolean), boolType);
2013
return MakeLiteral(syntax, ConstantValue.Create(!rewrittenExpr.ConstantValueOpt.
IsNull
, ConstantValueTypeDiscriminator.Boolean), boolType);
Lowering\LocalRewriter\LocalRewriter_IsOperator.cs (1)
51
Debug.Assert(operandType is { } || rewrittenOperand.ConstantValueOpt!.
IsNull
);
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (1)
77
Debug.Assert(!rewrittenLeft.ConstantValueOpt.
IsNull
);
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (3)
52
Debug.Assert(loweredLeft.Type is { } && (loweredLeft.Type.IsStringType() || loweredLeft.Type.IsErrorType()) || loweredLeft.ConstantValueOpt?.
IsNull
== true);
53
Debug.Assert(loweredRight.Type is { } && (loweredRight.Type.IsStringType() || loweredRight.Type.IsErrorType()) || loweredRight.ConstantValueOpt?.
IsNull
== true);
394
else if (cv.
IsNull
)
Lowering\SyntheticBoundNodeFactory.cs (3)
1075
Debug.Assert(stringConst.IsString || stringConst.
IsNull
);
1639
return Literal(ConstantValue.Create(rewrittenExpr.ConstantValueOpt.
IsNull
, ConstantValueTypeDiscriminator.Boolean), boolType);
1641
return Literal(ConstantValue.Create(rewrittenExpr.ConstantValueOpt.
IsNull
, ConstantValueTypeDiscriminator.Boolean), boolType);
Symbols\ConstantValueUtils.cs (1)
111
!unconvertedConstantValue.
IsNull
&&
Utilities\ValueSetFactory.EnumeratedValueSetFactory.cs (1)
40
value.IsBad || value.
IsNull
? EnumeratedValueSet<T, TTC>.AllValues : this.Related(relation, default(TTC).FromConstantValue(value));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (3)
Semantics\StructConstructorTests.cs (3)
3555
Assert.True(g1.Parameters[0].ExplicitDefaultConstantValue.
IsNull
);
3560
Assert.True(g2.Parameters[0].ExplicitDefaultConstantValue.
IsNull
);
3582
Assert.False(g1.Parameters[0].ExplicitDefaultConstantValue.
IsNull
);
Microsoft.CodeAnalysis.VisualBasic (5)
Binding\Binder_Invocation.vb (2)
1105
If argumentConstantValue.
IsNull
Then
1145
If constantValue.
IsNull
Then
CodeGen\EmitExpression.vb (1)
1590
If ((type IsNot Nothing) AndAlso (type.TypeKind = TypeKind.TypeParameter) AndAlso constantValue.
IsNull
) Then
Lowering\SyntheticBoundNodeFactory.vb (1)
764
Debug.Assert(value.IsString OrElse value.
IsNull
)
Symbols\ConstantValueUtils.vb (1)
15
Debug.Assert((value Is Nothing) OrElse value.
IsNull
OrElse (type IsNot Nothing))