15 overrides of ConstantValueOpt
Microsoft.CodeAnalysis.CSharp (15)
BoundTree\BoundExpression.cs (3)
239public override ConstantValue? ConstantValueOpt 404public override ConstantValue? ConstantValueOpt => Data?.ConstantValue; 598public override ConstantValue? ConstantValueOpt
Generated\BoundNodes.xml.Generated.cs (12)
1183public override ConstantValue? ConstantValueOpt { get; } 1974public override ConstantValue? ConstantValueOpt { get; } 2017public override ConstantValue? ConstantValueOpt { get; } 2818public override ConstantValue? ConstantValueOpt { get; } 2922public override ConstantValue? ConstantValueOpt { get; } 2963public override ConstantValue? ConstantValueOpt { get; } 4300public override ConstantValue? ConstantValueOpt { get; } 4522public override ConstantValue? ConstantValueOpt { get; } 6359public override ConstantValue? ConstantValueOpt { get; } 7263public override ConstantValue? ConstantValueOpt { get; } 7745public override ConstantValue ConstantValueOpt { get; } 7775public override ConstantValue? ConstantValueOpt { get; }
285 references to ConstantValueOpt
Microsoft.CodeAnalysis.CSharp (285)
Binder\Binder.ValueChecks.cs (5)
729if ((expr.ConstantValueOpt != null) || (expr.Type.GetSpecialTypeSafe() == SpecialType.System_Void)) 3443if (expr.ConstantValueOpt != null) 3759if (expr.ConstantValueOpt != null) 4140if (expr.ConstantValueOpt != null) 4846if (expr.ConstantValueOpt != null)
Binder\Binder_Attributes.cs (1)
849ConstantValue? constantValue = node.ConstantValueOpt;
Binder\Binder_Conversions.cs (4)
169convertedSwitch.ConstantValueOpt, 184convertedConditional.ConstantValueOpt, 768expr.ConstantValueOpt, 3142var sourceConstantValue = source.ConstantValueOpt;
Binder\Binder_Expressions.cs (11)
2949if (underlyingExpr.ConstantValueOpt != null && 4717var constantValue = expression.ConstantValueOpt; 4736var constantValue = expression.ConstantValueOpt; 7942if ((boundLeft is BoundDefaultLiteral || boundLeft is BoundDefaultExpression) && boundLeft.ConstantValueOpt == ConstantValue.Null && 9043constantValueOpt: expr.ConstantValueOpt, 9542if (convertedIndex.ConstantValueOpt is { SpecialType: SpecialType.System_Int32, Int32Value: int constIndex }) 9623if (hatExpression.Operand.ConstantValueOpt is { SpecialType: SpecialType.System_Int32, Int32Value: int constIndex }) 9629else if (convertedIndex is BoundConversion { Operand: { ConstantValueOpt: { SpecialType: SpecialType.System_Int32, Int32Value: int constIndex } } operand }) 9636arguments[0] is { ConstantValueOpt: { SpecialType: SpecialType.System_Int32, Int32Value: int constIndex1 } } index && 9637arguments[1] is { ConstantValueOpt: { SpecialType: SpecialType.System_Boolean, BooleanValue: bool isFromEnd } }) 9742ConstantValue 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)
2574var valueLeft = left.ConstantValueOpt; 2575var valueRight = right.ConstantValueOpt; 2719ConstantValue? leftConstant = leftConv.Operand.ConstantValueOpt; 2720ConstantValue? rightConstant = rightConv.Operand.ConstantValueOpt; 4198var value = operand.ConstantValueOpt; 4629if (operand.ConstantValueOpt == ConstantValue.Null || 4671ReportIsOperatorDiagnostics(node, diagnostics, operandType, targetType, conversion.Kind, operand.ConstantValueOpt); 5167bool hasErrors = ReportAsOperatorConversionDiagnostics(node, diagnostics, this.Compilation, operandType, targetType, conversion.Kind, operand.ConstantValueOpt); 5744ConstantValue trueValue = trueExpr.ConstantValueOpt; 5750ConstantValue falseValue = falseExpr.ConstantValueOpt; 5756ConstantValue conditionValue = condition.ConstantValueOpt;
Binder\Binder_Patterns.cs (9)
97else if (expression.ConstantValueOpt != null) 605if (!hasErrors && expression.ConstantValueOpt is object) 608if (expression.ConstantValueOpt == ConstantValue.Null) 671constantValue = convertedExpression.ConstantValueOpt; 691if (inputType.IsNullableType() && (convertedExpression.ConstantValueOpt == null || !convertedExpression.ConstantValueOpt.IsNull)) 698&& operand.ConstantValueOpt != null && convertedExpression.ConstantValueOpt == null) 715constantValue = convertedExpression.ConstantValueOpt;
Binder\Binder_Statements.cs (4)
2452GenerateImplicitConversionError(diagnostics, this.Compilation, syntax, conversion, sourceType, targetType, operand.ConstantValueOpt); 2702if (assignment.Right.Kind == BoundKind.Literal && assignment.Right.ConstantValueOpt.Discriminator == ConstantValueTypeDiscriminator.Boolean) 3370if (boundFilter.ConstantValueOpt != ConstantValue.NotAvailable) 3374var 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)
1205if (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; 318if (init.ConstantValueOpt != null) 488if (initializers.Any(static init => init.ConstantValueOpt == null)) 519if (start.ConstantValueOpt?.IsDefaultValue != true || start.ConstantValueOpt.Discriminator != ConstantValueTypeDiscriminator.Int32) 526if (length.ConstantValueOpt?.Discriminator != ConstantValueTypeDiscriminator.Int32) 531lengthForConstructor = length.ConstantValueOpt.Int32Value; 693Debug.Assert(initializers.All(static init => init.ConstantValueOpt != null)); 814Debug.Assert(initializers.All(static init => init.ConstantValueOpt != null)); 820init.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)) 3746expr.Consequence.ConstantValueOpt?.IsIntegralValueZeroOrOne(out bool isConsequenceOne) == true && 3747expr.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)
174if (init.ConstantValueOpt != null) 187if (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)
468var result = node.ConstantValueOpt == null ? 1476if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 1492if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 2052if (asExpression != null && asExpression.ConstantValueOpt != null) 2070if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 2086if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null)
Compilation\MemberSemanticModel.cs (1)
1264ConstantValue constantValue = boundExpr.ConstantValueOpt;
FlowAnalysis\AbstractFlowPass.cs (10)
677return node.ConstantValueOpt == ConstantValue.True; 682return node.ConstantValueOpt == ConstantValue.False; 687return node.ConstantValueOpt == ConstantValue.Null; 1674if (node.ConstantValueOpt is { IsBoolean: true, BooleanValue: bool booleanValue } 2661return expr.ConstantValueOpt is object 2675var isNullConstant = binary.Left.ConstantValueOpt?.IsNull == true; 2683else if (IsConditionalState && binary.Right.ConstantValueOpt is { IsBoolean: true } rightConstant) 2695else if (binary.Left.ConstantValueOpt is { IsBoolean: true } leftConstant) 2981if (node.LeftOperand.ConstantValueOpt != null) 3081if (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)
909return value.ConstantValueOpt != ConstantValue.Null; 922if (value is { ConstantValueOpt: not null, Kind: not BoundKind.InterpolatedString }) return false; 1596(elementAccess.Argument.ConstantValueOpt is { SpecialType: SpecialType.System_Int32, Int32Value: 0 } ||
FlowAnalysis\NullableWalker.cs (20)
1077if (returnStatement.ExpressionOpt is { ConstantValueOpt: { IsBoolean: true, BooleanValue: bool value } }) 1242if (returnStatement.ExpressionOpt is { ConstantValueOpt: { IsBoolean: true, BooleanValue: bool value } }) 1263else if (returnStatement.ExpressionOpt is { ConstantValueOpt: { IsBoolean: true, BooleanValue: bool value } }) 2423if (value.ConstantValueOpt?.IsNull == true && !useLegacyWarnings) 5143var isNullConstant = rightOperand.ConstantValueOpt?.IsNull == true; 5185|| expr.ConstantValueOpt is object; 5195else if (isEquals(binary) && otherOperand.ConstantValueOpt is { IsBoolean: true, BooleanValue: var boolValue }) 5227var isNullConstant = leftOperand.ConstantValueOpt?.IsNull == true; 5500if (binary.Right.ConstantValueOpt?.IsNull == true) 5504else if (binary.Left.ConstantValueOpt?.IsNull == true) 5709if (expression.ConstantValueOpt != null) 5878bool leftIsConstant = leftOperand.ConstantValueOpt != null; 6033if (receiver.ConstantValueOpt is { IsNull: false }) 6860if (left.ConstantValueOpt?.IsNull == true) 6866else if (right.ConstantValueOpt?.IsNull == true) 6943if (comparand.ConstantValueOpt?.IsNull == true) 8359return expr.ConstantValueOpt == ConstantValue.NotAvailable || !expr.ConstantValueOpt.IsNull || expr.IsSuppressed ? NullableAnnotation.NotAnnotated : NullableAnnotation.Annotated; 8619if (value.Type is null || value.Type.IsDynamic() || value.ConstantValueOpt != null) 12491if (node.Argument.ConstantValueOpt?.IsNull != true
FlowAnalysis\NullableWalker.DebugVerifier.cs (1)
371if (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)
520.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)
287if (loweredRight.ConstantValueOpt == ConstantValue.True) return loweredLeft; 288if (loweredLeft.ConstantValueOpt == ConstantValue.True) return loweredRight; 289if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredLeft; 299if (loweredRight.ConstantValueOpt == ConstantValue.False) return loweredLeft; 300if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredRight; 301if (loweredLeft.ConstantValueOpt == ConstantValue.True) return loweredLeft; 311if (loweredRight.ConstantValueOpt == ConstantValue.True) return loweredLeft; 312if (loweredLeft.ConstantValueOpt == ConstantValue.True) return loweredRight; 332if (loweredRight.ConstantValueOpt == ConstantValue.False) return loweredLeft; 333if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredRight; 337if (loweredLeft.ConstantValueOpt == ConstantValue.True) return loweredRight; 338if (loweredRight.ConstantValueOpt == ConstantValue.True) return loweredLeft; 342if (loweredLeft.ConstantValueOpt == ConstantValue.False) 345if (loweredRight.ConstantValueOpt == ConstantValue.False) 351if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredRight; 352if (loweredRight.ConstantValueOpt == ConstantValue.False) return loweredLeft; 356if (loweredLeft.ConstantValueOpt == ConstantValue.True) 359if (loweredRight.ConstantValueOpt == ConstantValue.True) 365if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredRight; 366if (loweredRight.ConstantValueOpt == ConstantValue.False) return loweredLeft; 370if (loweredLeft.ConstantValueOpt == ConstantValue.True) 373if (loweredRight.ConstantValueOpt == ConstantValue.True) 478if (loweredLeft.ConstantValueOpt?.UInt64Value == 1) 482if (loweredRight.ConstantValueOpt?.UInt64Value == 1) 632ConstantValue? constantLeft = loweredLeft.ConstantValueOpt ?? UnboxConstant(loweredLeft); 725return conversion.Operand.ConstantValueOpt; 1020if (canNotBeEqualToDefaultValue(xNonNull?.ConstantValueOpt)) 1033if (canNotBeEqualToDefaultValue(yNonNull?.ConstantValueOpt)) 1407if (sideEffect.ConstantValueOpt != null) 1626if (nonNullRight != null && nonNullRight.ConstantValueOpt != null && left.Kind == BoundKind.Sequence) 2015if (oldNode != null && (loweredLeft.ConstantValueOpt == ConstantValue.Null || loweredRight.ConstantValueOpt == ConstantValue.Null)) 2104if (rewrittenExpr.ConstantValueOpt != null) 2109return MakeLiteral(syntax, ConstantValue.Create(rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType); 2111return MakeLiteral(syntax, ConstantValue.Create(!rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType); 2154ConstantValue? rightConstantValue = loweredRight.ConstantValueOpt; 2226ConstantValue? rightConstantValue = loweredRight.ConstantValueOpt; 2326if (numericOperand.ConstantValueOpt?.UInt64Value == 1) 2337if (sizeOfExpression.ConstantValueOpt?.Int32Value == 1) 2358var constVal = numericOperand.ConstantValueOpt; 2369var constVal = numericOperand.ConstantValueOpt;
Lowering\LocalRewriter\LocalRewriter_Call.cs (1)
562if (current.ConstantValueOpt != null)
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (1)
529node.Elements.All(e => ((BoundExpression)e).ConstantValueOpt is { });
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (4)
807return MakeEventAccess(eventAccess.Syntax, receiverOpt, eventAccess.EventSymbol, eventAccess.ConstantValueOpt, eventAccess.ResultKind, eventAccess.Type); 845constantValueOpt: rewrittenReceiver.ConstantValueOpt); 903if (expression.ConstantValueOpt != null) 944if (expression.ConstantValueOpt != null)
Lowering\LocalRewriter\LocalRewriter_ConditionalOperator.cs (2)
27if (rewrittenCondition.ConstantValueOpt == null) 51ConstantValue? conditionConstantValue = rewrittenCondition.ConstantValueOpt;
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (1)
219if (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 (5)
223and { ConstantValueOpt: null }); 312switch (argument.ConstantValueOpt) 324var current = getRope(argument.ConstantValueOpt!); 592if (expr is { ConstantValueOpt: { } cv }) 660expr.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)
859if (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)
675if (expr.ConstantValueOpt != null)
Lowering\SyntheticBoundNodeFactory.cs (3)
1776if (rewrittenExpr.ConstantValueOpt != null) 1781return Literal(ConstantValue.Create(rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType); 1783return 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)
1074if (expression.ConstantValueOpt != null)
Symbols\Source\SourceComplexParameterSymbol.cs (2)
401if (convertedExpression.ConstantValueOpt == null && convertedExpression.Kind == BoundKind.Conversion && 412var value = convertedExpression.ConstantValueOpt ?? ConstantValue.Null;