15 overrides of ConstantValueOpt
Microsoft.CodeAnalysis.CSharp (15)
BoundTree\BoundExpression.cs (3)
239public override ConstantValue? ConstantValueOpt 404public override ConstantValue? ConstantValueOpt => Data?.ConstantValue; 591public override ConstantValue? ConstantValueOpt
Generated\BoundNodes.xml.Generated.cs (12)
1201public override ConstantValue? ConstantValueOpt { get; } 1984public override ConstantValue? ConstantValueOpt { get; } 2027public override ConstantValue? ConstantValueOpt { get; } 2828public override ConstantValue? ConstantValueOpt { get; } 2932public override ConstantValue? ConstantValueOpt { get; } 2974public override ConstantValue? ConstantValueOpt { get; } 4312public override ConstantValue? ConstantValueOpt { get; } 4534public override ConstantValue? ConstantValueOpt { get; } 6371public override ConstantValue? ConstantValueOpt { get; } 7275public override ConstantValue? ConstantValueOpt { get; } 7757public override ConstantValue ConstantValueOpt { get; } 7787public override ConstantValue? ConstantValueOpt { get; }
286 references to ConstantValueOpt
Microsoft.CodeAnalysis.CSharp (286)
Binder\Binder.ValueChecks.cs (5)
726if ((expr.ConstantValueOpt != null) || (expr.Type.GetSpecialTypeSafe() == SpecialType.System_Void)) 3359if (expr.ConstantValueOpt != null) 3675if (expr.ConstantValueOpt != null) 4056if (expr.ConstantValueOpt != null) 4748if (expr.ConstantValueOpt != null)
Binder\Binder_Attributes.cs (1)
849ConstantValue? constantValue = node.ConstantValueOpt;
Binder\Binder_Expressions.cs (11)
2901if (underlyingExpr.ConstantValueOpt != null && 4663var constantValue = expression.ConstantValueOpt; 4682var constantValue = expression.ConstantValueOpt; 7874if ((boundLeft is BoundDefaultLiteral || boundLeft is BoundDefaultExpression) && boundLeft.ConstantValueOpt == ConstantValue.Null && 8655constantValueOpt: expr.ConstantValueOpt, 9154if (convertedIndex.ConstantValueOpt is { SpecialType: SpecialType.System_Int32, Int32Value: int constIndex }) 9235if (hatExpression.Operand.ConstantValueOpt is { SpecialType: SpecialType.System_Int32, Int32Value: int constIndex }) 9241else if (convertedIndex is BoundConversion { Operand: { ConstantValueOpt: { SpecialType: SpecialType.System_Int32, Int32Value: int constIndex } } operand }) 9248arguments[0] is { ConstantValueOpt: { SpecialType: SpecialType.System_Int32, Int32Value: int constIndex1 } } index && 9249arguments[1] is { ConstantValueOpt: { SpecialType: SpecialType.System_Boolean, BooleanValue: bool isFromEnd } }) 9354ConstantValue constant = index.ConstantValueOpt;
Binder\Binder_InterpolatedString.cs (10)
102var alignmentConstant = alignment.ConstantValueOpt; 142value.ConstantValueOpt == null || 144!(value.ConstantValueOpt is { IsString: true, IsBad: false })) 150? value.ConstantValueOpt 151: FoldStringConcatenation(BinaryOperatorKind.StringConcatenation, resultConstant, value.ConstantValueOpt); 324p is BoundStringInsert { Alignment.ConstantValueOpt: null or { IsBad: true } } or 387Debug.Assert(fillin.Alignment.ConstantValueOpt is { }); 388stringBuilder.Append(',').Append(fillin.Alignment.ConstantValueOpt.Int64Value); 407Debug.Assert(part is BoundLiteral && part.ConstantValueOpt?.StringValue != null); 410escapeAndAppendInterpolatedStringLiteral(stringBuilder, part.ConstantValueOpt.StringValue);
Binder\Binder_Operators.cs (11)
1805var valueLeft = left.ConstantValueOpt; 1806var valueRight = right.ConstantValueOpt; 1950ConstantValue? leftConstant = leftConv.Operand.ConstantValueOpt; 1951ConstantValue? rightConstant = rightConv.Operand.ConstantValueOpt; 2857var value = operand.ConstantValueOpt; 3288if (operand.ConstantValueOpt == ConstantValue.Null || 3330ReportIsOperatorDiagnostics(node, diagnostics, operandType, targetType, conversion.Kind, operand.ConstantValueOpt); 3826bool hasErrors = ReportAsOperatorConversionDiagnostics(node, diagnostics, this.Compilation, operandType, targetType, conversion.Kind, operand.ConstantValueOpt); 4403ConstantValue trueValue = trueExpr.ConstantValueOpt; 4409ConstantValue falseValue = falseExpr.ConstantValueOpt; 4415ConstantValue conditionValue = condition.ConstantValueOpt;
Binder\Binder_Patterns.cs (9)
96else if (expression.ConstantValueOpt != null) 604if (!hasErrors && expression.ConstantValueOpt is object) 607if (expression.ConstantValueOpt == ConstantValue.Null) 670constantValue = convertedExpression.ConstantValueOpt; 690if (inputType.IsNullableType() && (convertedExpression.ConstantValueOpt == null || !convertedExpression.ConstantValueOpt.IsNull)) 697&& operand.ConstantValueOpt != null && convertedExpression.ConstantValueOpt == null) 714constantValue = convertedExpression.ConstantValueOpt;
Binder\Binder_Statements.cs (4)
2435GenerateImplicitConversionError(diagnostics, this.Compilation, syntax, conversion, sourceType, targetType, operand.ConstantValueOpt); 2685if (assignment.Right.Kind == BoundKind.Literal && assignment.Right.ConstantValueOpt.Discriminator == ConstantValueTypeDiscriminator.Boolean) 3353if (boundFilter.ConstantValueOpt != ConstantValue.NotAvailable) 3357var errorCode = boundFilter.ConstantValueOpt.BooleanValue
Binder\DecisionDagBuilder.cs (1)
2012public bool IsFullyMatched => RemainingTests is Tests.True && (WhenClause is null || WhenClause.ConstantValueOpt == ConstantValue.True);
Binder\ForEachLoopBinder.cs (1)
1176if (collectionExpr.ConstantValueOpt is { IsNull: true })
Binder\LockBinder.cs (1)
46if (expr.ConstantValueOpt != ConstantValue.Null || Compilation.FeatureStrictEnabled) // Dev10 allows the null literal.
Binder\Semantics\Conversions\ConversionsBase.cs (2)
1351var constantValue = source.ConstantValueOpt; 1460var sourceConstantValue = source.ConstantValueOpt;
Binder\Semantics\Operators\BinaryOperatorEasyOut.cs (2)
340if (left.ConstantValueOpt == null && right.ConstantValueOpt == null)
BoundTree\BoundDecisionDag.cs (2)
146if (input.ConstantValueOpt == null) 152ConstantValue inputConstant = input.ConstantValueOpt;
BoundTree\BoundExpression.cs (1)
243Debug.Assert(Expression.ConstantValueOpt == null);
BoundTree\BoundExpressionExtensions.cs (2)
83return node is { Kind: BoundKind.Literal, ConstantValueOpt: { Discriminator: ConstantValueTypeDiscriminator.Null } }; 114var constValue = node.ConstantValueOpt;
CodeGen\EmitArrayInitializer.cs (11)
108return includeConstants || init.ConstantValueOpt == null; 218ConstantValue initConstantValueOpt = init.ConstantValueOpt; 319if (init.ConstantValueOpt != null) 490if (initializers.Any(static init => init.ConstantValueOpt == null)) 521if (start.ConstantValueOpt?.IsDefaultValue != true || start.ConstantValueOpt.Discriminator != ConstantValueTypeDiscriminator.Int32) 528if (length.ConstantValueOpt?.Discriminator != ConstantValueTypeDiscriminator.Int32) 533lengthForConstructor = length.ConstantValueOpt.Int32Value; 695Debug.Assert(initializers.All(static init => init.ConstantValueOpt != null)); 816Debug.Assert(initializers.All(static init => init.ConstantValueOpt != null)); 822init.ConstantValueOpt!.Serialize(writer);
CodeGen\EmitConversion.cs (1)
203if (conversion.Operand.ConstantValueOpt == null)
CodeGen\EmitExpression.cs (7)
43var constantValue = expression.ConstantValueOpt; 414var receiverConstant = receiver.ConstantValueOpt; 1518var constVal = receiver.ConstantValueOpt; 2123if (current.ConstantValueOpt != null) 2603if (rightType.IsReferenceType || (right.ConstantValueOpt != null && rightType.SpecialType != SpecialType.System_Decimal)) 3747expr.Consequence.ConstantValueOpt?.IsIntegralValueZeroOrOne(out bool isConsequenceOne) == true && 3748expr.Alternative.ConstantValueOpt?.IsIntegralValueZeroOrOne(out bool isAlternativeOne) == true &&
CodeGen\EmitOperators.cs (6)
94if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 118if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 360var constant = binOp.Left.ConstantValueOpt; 365constant = comparand.ConstantValueOpt; 498var constantValue = condition.ConstantValueOpt; 533if (condition.ConstantValueOpt is { } constantValue)
CodeGen\EmitStackAllocInitializer.cs (2)
175if (init.ConstantValueOpt != null) 188if (includeConstants || init.ConstantValueOpt == null)
CodeGen\EmitStatement.cs (7)
236BoundExpression constOp = (condition.Left.ConstantValueOpt != null) ? condition.Left : null; 244constOp = (condition.Right.ConstantValueOpt != null) ? condition.Right : null; 259bool isZero = constOp.ConstantValueOpt.IsDefaultValue; 399if (condition.ConstantValueOpt != null) 401bool taken = condition.ConstantValueOpt.IsDefaultValue != sense; 443else if (top.condition.ConstantValueOpt is null && 1254Debug.Assert(expression.ConstantValueOpt == null);
CodeGen\Optimizer.cs (6)
469var result = node.ConstantValueOpt == null ? 1477if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 1493if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 2053if (asExpression != null && asExpression.ConstantValueOpt != null) 2071if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 2087if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null)
Compilation\MemberSemanticModel.cs (1)
1263ConstantValue constantValue = boundExpr.ConstantValueOpt;
FlowAnalysis\AbstractFlowPass.cs (10)
678return node.ConstantValueOpt == ConstantValue.True; 683return node.ConstantValueOpt == ConstantValue.False; 688return node.ConstantValueOpt == ConstantValue.Null; 1668if (node.ConstantValueOpt is { IsBoolean: true, BooleanValue: bool booleanValue } 2630return expr.ConstantValueOpt is object 2644var isNullConstant = binary.Left.ConstantValueOpt?.IsNull == true; 2652else if (IsConditionalState && binary.Right.ConstantValueOpt is { IsBoolean: true } rightConstant) 2664else if (binary.Left.ConstantValueOpt is { IsBoolean: true } leftConstant) 2950if (node.LeftOperand.ConstantValueOpt != null) 3050if (node.Receiver.ConstantValueOpt != null && !IsConstantNull(node.Receiver))
FlowAnalysis\AbstractFlowPass_Switch.cs (2)
52label == node.DefaultLabel && node.Expression.ConstantValueOpt == null && IsTraditionalSwitch(node)) 75(node.DefaultLabel == null && node.Expression.ConstantValueOpt == null && IsTraditionalSwitch(node)))
FlowAnalysis\DefiniteAssignment.cs (3)
908return value.ConstantValueOpt != ConstantValue.Null; 921if (value is { ConstantValueOpt: not null, Kind: not BoundKind.InterpolatedString }) return false; 1595(elementAccess.Argument.ConstantValueOpt is { SpecialType: SpecialType.System_Int32, Int32Value: 0 } ||
FlowAnalysis\NullableWalker.cs (20)
1003if (returnStatement.ExpressionOpt is { ConstantValueOpt: { IsBoolean: true, BooleanValue: bool value } }) 1161if (returnStatement.ExpressionOpt is { ConstantValueOpt: { IsBoolean: true, BooleanValue: bool value } }) 1182else if (returnStatement.ExpressionOpt is { ConstantValueOpt: { IsBoolean: true, BooleanValue: bool value } }) 2325if (value.ConstantValueOpt?.IsNull == true && !useLegacyWarnings) 4926var isNullConstant = rightOperand.ConstantValueOpt?.IsNull == true; 4968|| expr.ConstantValueOpt is object; 4978else if (isEquals(binary) && otherOperand.ConstantValueOpt is { IsBoolean: true, BooleanValue: var boolValue }) 5010var isNullConstant = leftOperand.ConstantValueOpt?.IsNull == true; 5226if (binary.Right.ConstantValueOpt?.IsNull == true) 5230else if (binary.Left.ConstantValueOpt?.IsNull == true) 5435if (expression.ConstantValueOpt != null) 5604bool leftIsConstant = leftOperand.ConstantValueOpt != null; 5759if (receiver.ConstantValueOpt is { IsNull: false }) 6445if (left.ConstantValueOpt?.IsNull == true) 6451else if (right.ConstantValueOpt?.IsNull == true) 6528if (comparand.ConstantValueOpt?.IsNull == true) 7898return expr.ConstantValueOpt == ConstantValue.NotAvailable || !expr.ConstantValueOpt.IsNull || expr.IsSuppressed ? NullableAnnotation.NotAnnotated : NullableAnnotation.Annotated; 8125if (value.Type is null || value.Type.IsDynamic() || value.ConstantValueOpt != null) 11695if (node.Argument.ConstantValueOpt?.IsNull != true
FlowAnalysis\NullableWalker.DebugVerifier.cs (1)
372if (node.WhenClause?.ConstantValueOpt != ConstantValue.True)
FlowAnalysis\NullableWalker_Patterns.cs (2)
167bool isExplicitNullCheck = cp.Value.ConstantValueOpt == ConstantValue.Null; 705if (w.WhenExpression != null && w.WhenExpression.ConstantValueOpt != ConstantValue.True)
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (2)
819if ((object)operand.Type == null && operand.ConstantValueOpt != null && operand.ConstantValueOpt.IsNull)
Lowering\DiagnosticsPass_Warnings.cs (12)
317if (node.Left.ConstantValueOpt != null && node.Right.ConstantValueOpt == null && node.Right.Kind == BoundKind.Conversion) 319CheckVacuousComparisons(node, node.Left.ConstantValueOpt, node.Right); 322if (node.Right.ConstantValueOpt != null && node.Left.ConstantValueOpt == null && node.Left.Kind == BoundKind.Conversion) 324CheckVacuousComparisons(node, node.Right.ConstantValueOpt, node.Left); 330if (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)) 335else 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)) 528if (node.ConstantValueOpt != null) 586ConstantValue constVal = operand.ConstantValueOpt;
Lowering\Extensions.cs (1)
80if ((object)expr.Type == null && expr.ConstantValueOpt == ConstantValue.Null)
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.cs (1)
186var valueExpression = (condition.ConstantValueOpt == null) ?
Lowering\LocalRewriter\LocalRewriter.cs (2)
256ConstantValue? constantValue = node.ConstantValueOpt; 1013if (expr.ConstantValueOpt != null)
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (3)
144if (node is BoundExpression { ConstantValueOpt: { } }) 1009if (whenExpression is not null && whenExpression.ConstantValueOpt != ConstantValue.True) 1161if (whenClause.WhenExpression != null && whenClause.WhenExpression.ConstantValueOpt != ConstantValue.True)
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (1)
516.Any(static node => node is BoundWhenDecisionDagNode { WhenExpression: { ConstantValueOpt: null } });
Lowering\LocalRewriter\LocalRewriter_AsOperator.cs (2)
51ConstantValue constantValue = Binder.GetAsOperatorConstantResult(rewrittenOperand.Type, rewrittenType, conversion.Kind, rewrittenOperand.ConstantValueOpt); 63if (rewrittenOperand.ConstantValueOpt != null)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (41)
280if (loweredRight.ConstantValueOpt == ConstantValue.True) return loweredLeft; 281if (loweredLeft.ConstantValueOpt == ConstantValue.True) return loweredRight; 282if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredLeft; 292if (loweredRight.ConstantValueOpt == ConstantValue.False) return loweredLeft; 293if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredRight; 294if (loweredLeft.ConstantValueOpt == ConstantValue.True) return loweredLeft; 304if (loweredRight.ConstantValueOpt == ConstantValue.True) return loweredLeft; 305if (loweredLeft.ConstantValueOpt == ConstantValue.True) return loweredRight; 325if (loweredRight.ConstantValueOpt == ConstantValue.False) return loweredLeft; 326if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredRight; 330if (loweredLeft.ConstantValueOpt == ConstantValue.True) return loweredRight; 331if (loweredRight.ConstantValueOpt == ConstantValue.True) return loweredLeft; 335if (loweredLeft.ConstantValueOpt == ConstantValue.False) 338if (loweredRight.ConstantValueOpt == ConstantValue.False) 344if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredRight; 345if (loweredRight.ConstantValueOpt == ConstantValue.False) return loweredLeft; 349if (loweredLeft.ConstantValueOpt == ConstantValue.True) 352if (loweredRight.ConstantValueOpt == ConstantValue.True) 358if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredRight; 359if (loweredRight.ConstantValueOpt == ConstantValue.False) return loweredLeft; 363if (loweredLeft.ConstantValueOpt == ConstantValue.True) 366if (loweredRight.ConstantValueOpt == ConstantValue.True) 471if (loweredLeft.ConstantValueOpt?.UInt64Value == 1) 475if (loweredRight.ConstantValueOpt?.UInt64Value == 1) 625ConstantValue? constantLeft = loweredLeft.ConstantValueOpt ?? UnboxConstant(loweredLeft); 718return conversion.Operand.ConstantValueOpt; 1002if (canNotBeEqualToDefaultValue(xNonNull?.ConstantValueOpt)) 1015if (canNotBeEqualToDefaultValue(yNonNull?.ConstantValueOpt)) 1389if (sideEffect.ConstantValueOpt != null) 1608if (nonNullRight != null && nonNullRight.ConstantValueOpt != null && left.Kind == BoundKind.Sequence) 1997if (oldNode != null && (loweredLeft.ConstantValueOpt == ConstantValue.Null || loweredRight.ConstantValueOpt == ConstantValue.Null)) 2086if (rewrittenExpr.ConstantValueOpt != null) 2091return MakeLiteral(syntax, ConstantValue.Create(rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType); 2093return MakeLiteral(syntax, ConstantValue.Create(!rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType); 2136ConstantValue? rightConstantValue = loweredRight.ConstantValueOpt; 2208ConstantValue? rightConstantValue = loweredRight.ConstantValueOpt; 2308if (numericOperand.ConstantValueOpt?.UInt64Value == 1) 2319if (sizeOfExpression.ConstantValueOpt?.Int32Value == 1) 2340var constVal = numericOperand.ConstantValueOpt; 2351var constVal = numericOperand.ConstantValueOpt;
Lowering\LocalRewriter\LocalRewriter_Call.cs (1)
546if (current.ConstantValueOpt != null)
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (1)
515node.Elements.All(e => ((BoundExpression)e).ConstantValueOpt is { });
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (4)
735return MakeEventAccess(eventAccess.Syntax, receiverOpt, eventAccess.EventSymbol, eventAccess.ConstantValueOpt, eventAccess.ResultKind, eventAccess.Type); 773constantValueOpt: rewrittenReceiver.ConstantValueOpt); 831if (expression.ConstantValueOpt != null) 872if (expression.ConstantValueOpt != null)
Lowering\LocalRewriter\LocalRewriter_ConditionalOperator.cs (2)
27if (rewrittenCondition.ConstantValueOpt == null) 51ConstantValue? conditionConstantValue = rewrittenCondition.ConstantValueOpt;
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (1)
221if (rewrittenNode.ConstantValueOpt != null)
Lowering\LocalRewriter\LocalRewriter_Event.cs (1)
216return MakeEventAccess(node.Syntax, rewrittenReceiver, node.EventSymbol, node.ConstantValueOpt, node.ResultKind, node.Type);
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (16)
278if (startExpr.ConstantValueOpt is { SpecialType: SpecialType.System_Int32, Int32Value: 0 } && 279rangeSizeExpr.ConstantValueOpt is { SpecialType: SpecialType.System_Int32, Int32Value: >= 0 and int rangeSizeConst } && 309makeOffsetInput is { ConstantValueOpt.Int32Value: var offset }) 345if (index.ConstantValueOpt is { SpecialType: SpecialType.System_Int32, Int32Value: int constIndex }) 387Debug.Assert(index.ConstantValueOpt is null); // Binder should have reported an error due to index out of bounds, or should have handled by code above. 539if (makeOffsetInput.ConstantValueOpt is null && lengthAccess.Kind is not BoundKind.ArrayLength) 661if (loweredExpr.ConstantValueOpt?.Int32Value == 0) 731arguments[0] is { Type.SpecialType: SpecialType.System_Int32, ConstantValueOpt.Value: int _ and >= 0 } index && 732arguments[1] is { Type.SpecialType: SpecialType.System_Boolean, ConstantValueOpt.Value: bool fromEnd }) 924if (startMakeOffsetInput.ConstantValueOpt is null) 935if (endMakeOffsetInput.ConstantValueOpt is null) 1002if (startExpr.ConstantValueOpt?.Int32Value == 0) 1006else if (startExpr.ConstantValueOpt is { Int32Value: var startConst } && endExpr.ConstantValueOpt is { Int32Value: var endConst }) 1012if (startExpr.ConstantValueOpt is null && 1035if (lengthAccess.ConstantValueOpt is null)
Lowering\LocalRewriter\LocalRewriter_IsOperator.cs (2)
51Debug.Assert(operandType is { } || rewrittenOperand.ConstantValueOpt!.IsNull); 58ConstantValue constantValue = Binder.GetIsOperatorConstantResult(operandType, targetType, conversionKind, rewrittenOperand.ConstantValueOpt);
Lowering\LocalRewriter\LocalRewriter_LockStatement.cs (3)
35Debug.Assert(rewrittenArgument.ConstantValueOpt == ConstantValue.Null); 39rewrittenArgument.ConstantValueOpt, 96constantValueOpt: rewrittenArgument.ConstantValueOpt);
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (4)
73if (rewrittenLeft.ConstantValueOpt != null) 75Debug.Assert(!rewrittenLeft.ConstantValueOpt.IsNull); 146if (unwrappedRight is { ConstantValueOpt: not null } or BoundLocal { LocalSymbol.IsRef: false } or BoundParameter { ParameterSymbol.RefKind: RefKind.None } && 179Debug.Assert(conditionalExpression.ConstantValueOpt == null); // we shouldn't have hit this else case otherwise
Lowering\LocalRewriter\LocalRewriter_PatternSwitchStatement.cs (1)
82if (loweredSwitchGoverningExpression.ConstantValueOpt == null)
Lowering\LocalRewriter\LocalRewriter_StackAlloc.cs (3)
31if (rewrittenCount.ConstantValueOpt?.Int32Value == 0) 119var sizeConst = sizeOfExpression.ConstantValueOpt; 126var countConst = countExpression.ConstantValueOpt;
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (10)
53Debug.Assert(loweredLeft.Type is { } && (loweredLeft.Type.IsStringType() || loweredLeft.Type.IsErrorType()) || loweredLeft.ConstantValueOpt?.IsNull == true); 54Debug.Assert(loweredRight.Type is { } && (loweredRight.Type.IsStringType() || loweredRight.Type.IsErrorType()) || loweredRight.ConstantValueOpt?.IsNull == true); 208var rightConstant = boundCoalesce.RightOperand.ConstantValueOpt; 288var leftConst = loweredLeft.ConstantValueOpt; 289var rightConst = loweredRight.ConstantValueOpt; 322return (operand.ConstantValueOpt != null && string.IsNullOrEmpty(operand.ConstantValueOpt.StringValue)) || 626if (expr is BoundCall { Type.SpecialType: SpecialType.System_String, Method: { Name: "ToString" } method, ReceiverOpt: { Type: NamedTypeSymbol { SpecialType: SpecialType.System_Char } charType, ConstantValueOpt.IsChar: true } } call && 636if (expr is { ConstantValueOpt: { } cv }) 703expr.ConstantValueOpt != null ||
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (3)
177Debug.Assert(part is BoundLiteral && part.ConstantValueOpt?.StringValue is not null); 178part = _factory.StringLiteral(part.ConstantValueOpt.StringValue); 191if (length == 1 && result is not ({ Kind: BoundKind.InterpolatedString } or { ConstantValueOpt.IsString: true }))
Lowering\LocalRewriter\LocalRewriter_TryStatement.cs (1)
80if (node.ExceptionFilterOpt?.ConstantValueOpt?.BooleanValue == false)
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (3)
188case { ConstantValueOpt: { } }: 318if (rightHasValue.ConstantValueOpt == ConstantValue.False) 326if (leftHasValue.ConstantValueOpt == ConstantValue.False)
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (3)
128if (rewrittenExpression.ConstantValueOpt == ConstantValue.Null) 174constantValueOpt: rewrittenExpression.ConstantValueOpt); 221BoundLocal boundLocal = new BoundLocal(declarationSyntax, localSymbol, localDeclaration.InitializerOpt.ConstantValueOpt, localType);
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (1)
858if (boundArgument.ConstantValueOpt != null)
Lowering\SpillSequenceSpiller.cs (1)
524call.Arguments[1].ConstantValueOpt is { } ? call.Arguments[1] : Spill(builder, call.Arguments[1])));
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (1)
651if (expr.ConstantValueOpt != null)
Lowering\SyntheticBoundNodeFactory.cs (3)
1758if (rewrittenExpr.ConstantValueOpt != null) 1763return Literal(ConstantValue.Create(rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType); 1765return Literal(ConstantValue.Create(rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType);
Operations\CSharpOperationFactory.cs (9)
307ConstantValue? constantValue = (boundNode as BoundExpression)?.ConstantValueOpt; 445ConstantValue? constantValue = boundCall.ConstantValueOpt; 516var objectCreationOperation = new ObjectCreationOperation(boundAttribute.Constructor.GetPublicSymbol(), initializer, DeriveArguments(boundAttribute), _semanticModel, boundAttribute.Syntax, boundAttribute.GetPublicTypeSymbol(), boundAttribute.ConstantValueOpt, isImplicit: true); 930ConstantValue? constantValue = boundCollectionElementInitializer.ConstantValueOpt; 1296ConstantValue? constantValue = ((BoundExpression)boundDefaultExpression).ConstantValueOpt; 1339ConstantValue? constantValue = boundAssignmentOperator.ConstantValueOpt; 1492ConstantValue? constantValue = boundBinaryOperator.ConstantValueOpt; 1591ConstantValue? constantValue = boundNullCoalescingOperator.ConstantValueOpt; 2489return new InvalidOperation(ImmutableArray<IOperation>.Empty, _semanticModel, syntax, type, placeholder.ConstantValueOpt, isImplicit);
Symbols\ConstantValueUtils.cs (2)
106var constantValue = boundValue.ConstantValueOpt; 108var unconvertedConstantValue = unconvertedBoundValue.ConstantValueOpt;
Symbols\Source\ParameterHelpers.cs (1)
879if (expression.ConstantValueOpt != null)
Symbols\Source\SourceComplexParameterSymbol.cs (2)
399if (convertedExpression.ConstantValueOpt == null && convertedExpression.Kind == BoundKind.Conversion && 410var value = convertedExpression.ConstantValueOpt ?? ConstantValue.Null;