70 references to IsNull
Microsoft.CodeAnalysis (7)
CodeGen\SwitchIntegralJumpTableEmitter.SwitchBucket.cs (1)
265
&& !constant.
IsNull
CodeGen\SwitchStringJumpTableEmitter.cs (2)
183
(stringConstant.IsString || stringConstant.
IsNull
));
201
Debug.Assert(stringConstant.
IsNull
|| stringConstant.IsString);
Operations\ControlFlowGraphBuilder.cs (1)
3315
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)
3203
return sourceConstantValue.
IsNull
? sourceConstantValue : null;
Binder\Binder_Invocation.cs (1)
1721
else if (defaultConstantValue.
IsNull
)
Binder\Binder_Operators.cs (9)
2803
bool leftIsNull = leftConstant.
IsNull
;
2804
bool rightIsNull = rightConstant.
IsNull
;
2830
if (valueLeft.
IsNull
) return valueRight.
IsNull
;
2831
if (valueRight.
IsNull
) return false;
2834
if (valueLeft.
IsNull
) return !valueRight.
IsNull
;
2835
if (valueRight.
IsNull
) return true;
5356
Debug.Assert(constantValue.
IsNull
);
Binder\Binder_Patterns.cs (1)
691
if (inputType.IsNullableType() && (convertedExpression.ConstantValueOpt == null || !convertedExpression.ConstantValueOpt.
IsNull
))
Binder\ForEachLoopBinder.cs (1)
1205
if (collectionExpr.ConstantValueOpt is {
IsNull
: true })
Binder\PatternExplainer.cs (2)
694
!(typeHasExactTypeLiteral(type) && !value.
IsNull
);
716
if (value.
IsNull
)
Binder\SwitchBinder.cs (1)
280
return constantValue.
IsNull
? s_nullKey : constantValue.Value;
BoundTree\BoundDecisionDag.cs (3)
185
return inputConstant.
IsNull
;
187
return !inputConstant.
IsNull
;
191
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)
415
if (receiverConstant?.
IsNull
== false)
1522
return !constVal.
IsNull
;
3512
if (type is { TypeKind: TypeKind.TypeParameter } && constantValue.
IsNull
)
CodeGen\EmitOperators.cs (1)
376
constant.
IsNull
)
Compilation\CSharpCompilation.cs (2)
2369
if (sourceConstantValue is {
IsNull
: true } && destination.IsReferenceType)
2380
if (result.IsReference && sourceConstantValue is {
IsNull
: true })
FlowAnalysis\AbstractFlowPass.cs (4)
988
case BoundConstantPattern { ConstantValue: {
IsNull
: false } }:
992
case BoundConstantPattern { ConstantValue: {
IsNull
: true } }:
2620
var isNullConstant = binary.Right.ConstantValueOpt?.
IsNull
== true;
2675
var isNullConstant = binary.Left.ConstantValueOpt?.
IsNull
== true;
FlowAnalysis\NullableWalker.cs (13)
2429
if (value.ConstantValueOpt?.
IsNull
== true && !useLegacyWarnings)
3000
isDefaultValue: parameter.ExplicitDefaultConstantValue?.
IsNull
== true);
5150
var isNullConstant = rightOperand.ConstantValueOpt?.
IsNull
== true;
5234
var isNullConstant = leftOperand.ConstantValueOpt?.
IsNull
== true;
5507
if (binary.Right.ConstantValueOpt?.
IsNull
== true)
5511
else if (binary.Left.ConstantValueOpt?.
IsNull
== true)
6040
if (receiver.ConstantValueOpt is {
IsNull
: false })
6868
if (left.ConstantValueOpt?.
IsNull
== true)
6874
else if (right.ConstantValueOpt?.
IsNull
== true)
6951
if (comparand.ConstantValueOpt?.
IsNull
== true)
8362
return expr.ConstantValueOpt == ConstantValue.NotAvailable || !expr.ConstantValueOpt.
IsNull
|| expr.IsSuppressed ? NullableAnnotation.NotAnnotated : NullableAnnotation.Annotated;
12411
SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.
IsNull
== true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull));
12515
if (node.Argument.ConstantValueOpt?.
IsNull
!= true
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (1)
819
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)
2109
return MakeLiteral(syntax, ConstantValue.Create(rewrittenExpr.ConstantValueOpt.
IsNull
, ConstantValueTypeDiscriminator.Boolean), boolType);
2111
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)
75
Debug.Assert(!rewrittenLeft.ConstantValueOpt.
IsNull
);
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (2)
314
case {
IsNull
: true } or { IsString: true, RopeValue.IsEmpty: true }:
598
else if (cv.
IsNull
)
Lowering\SyntheticBoundNodeFactory.cs (3)
1156
Debug.Assert(stringConst.IsString || stringConst.
IsNull
);
1781
return Literal(ConstantValue.Create(rewrittenExpr.ConstantValueOpt.
IsNull
, ConstantValueTypeDiscriminator.Boolean), boolType);
1783
return Literal(ConstantValue.Create(rewrittenExpr.ConstantValueOpt.
IsNull
, ConstantValueTypeDiscriminator.Boolean), boolType);
Symbols\ConstantValueUtils.cs (1)
110
!unconvertedConstantValue.
IsNull
&&
Utilities\ValueSetFactory.EnumeratedValueSetFactory.cs (1)
39
value.IsBad || value.
IsNull
? EnumeratedValueSet<T>.AllValues(_tc) : this.Related(relation, _tc.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
);