6 types derived from ConstantValue
Microsoft.CodeAnalysis (6)
ConstantValueSpecialized.cs (6)
28private sealed class ConstantValueBad : ConstantValue 68private sealed class ConstantValueNull : ConstantValue 134private sealed class ConstantValueString : ConstantValue 229private sealed class ConstantValueDecimal : ConstantValue 270private sealed class ConstantValueDateTime : ConstantValue 313private abstract class ConstantValueDiscriminated : ConstantValue
1309 references to ConstantValue
Microsoft.CodeAnalysis (395)
CodeGen\ILBuilderEmit.cs (3)
224KeyValuePair<ConstantValue, object>[] caseLabels, 257KeyValuePair<ConstantValue, object>[] caseLabels, 566internal void EmitConstantValue(ConstantValue value, SyntaxNode? syntaxNode)
CodeGen\PrivateImplementationDetails.cs (9)
79private readonly ConcurrentDictionary<(ImmutableArray<ConstantValue> Constants, ushort ElementType), CachedArrayField> _cachedArrayFieldsForConstants = 80new ConcurrentDictionary<(ImmutableArray<ConstantValue> Constants, ushort ElementType), CachedArrayField>(ConstantValueAndUShortEqualityComparer.Instance); 220internal Cci.IFieldReference CreateArrayCachingField(ImmutableArray<ConstantValue> constants, Cci.IArrayTypeReference arrayType, EmitContext emitContext) 533private static string ConstantsToHex(ImmutableArray<ConstantValue> constants) 571private sealed class ConstantValueAndUShortEqualityComparer : EqualityComparer<(ImmutableArray<ConstantValue> Constants, ushort Value)> 577public override bool Equals((ImmutableArray<ConstantValue> Constants, ushort Value) x, (ImmutableArray<ConstantValue> Constants, ushort Value) y) 600public override int GetHashCode((ImmutableArray<ConstantValue> Constants, ushort Value) obj) 603foreach (var constant in obj.Constants)
CodeGen\SwitchIntegralJumpTableEmitter.cs (20)
45private readonly ImmutableArray<KeyValuePair<ConstantValue, object>> _sortedCaseLabels; 57KeyValuePair<ConstantValue, object>[] caseLabels, 116if (sortedCaseLabels[0].Key != ConstantValue.Null) 146private static int CompareIntegralSwitchLabels(KeyValuePair<ConstantValue, object> first, KeyValuePair<ConstantValue, object> second) 148ConstantValue firstConstant = first.Key; 149ConstantValue secondConstant = second.Key; 303ConstantValue pivotConstant = switchBuckets[mid - 1].EndConstant; 334ConstantValue constant = c.Key; 371ConstantValue startConstant = switchBucket.StartConstant; 393ConstantValue caseLabelConstant = switchBucket[nextCaseIndex].Key; 421private void EmitCondBranchForSwitch(ILOpCode branchCode, ConstantValue constant, object targetLabel) 437private void EmitEqBranchForSwitch(ConstantValue constant, object targetLabel) 458private void EmitRangeCheckedBranch(ConstantValue startConstant, ConstantValue endConstant, object targetLabel) 478int Int32Value(ConstantValue value) 521private void EmitNormalizedSwitchKey(ConstantValue startConstant, ConstantValue endConstant, object bucketFallThroughLabel) 542private void EmitRangeCheckIfNeeded(ConstantValue startConstant, ConstantValue endConstant, object bucketFallThroughLabel)
CodeGen\SwitchIntegralJumpTableEmitter.SwitchBucket.cs (21)
18private readonly ImmutableArray<KeyValuePair<ConstantValue, object>> _allLabels; 54internal SwitchBucket(ImmutableArray<KeyValuePair<ConstantValue, object>> allLabels, int index) 62private SwitchBucket(ImmutableArray<KeyValuePair<ConstantValue, object>> allLabels, int startIndex, int endIndex) 72internal SwitchBucket(ImmutableArray<KeyValuePair<ConstantValue, object>> allLabels, int startIndex, int endIndex, bool isDegenerate) 91internal KeyValuePair<ConstantValue, object> this[int i] 144var lastConst = this.StartConstant; 171private bool IsContiguous(ConstantValue lastConst, ConstantValue nextConst) 181private static ulong GetBucketSize(ConstantValue startConstant, ConstantValue endConstant) 203private static bool BucketOverflowUInt64Limit(ConstantValue startConstant, ConstantValue endConstant) 223private static bool BucketOverflow(ConstantValue startConstant, ConstantValue endConstant) 245internal ConstantValue StartConstant 253internal ConstantValue EndConstant 261private static bool IsValidSwitchBucketConstant(ConstantValue constant) 269private static bool IsValidSwitchBucketConstantPair(ConstantValue startConstant, ConstantValue endConstant) 284var startConstant = bucket1.StartConstant; 285var endConstant = bucket2.EndConstant;
CodeGen\SwitchStringJumpTableEmitter.cs (12)
16using HashBucket = List<KeyValuePair<ConstantValue, object>>; 35private readonly KeyValuePair<ConstantValue, object>[] _caseLabels; 48public delegate void EmitStringCompareAndBranch(LocalOrParameter key, ConstantValue stringConstant, object targetLabel); 75KeyValuePair<ConstantValue, object>[] caseLabels, 141var jumpTableLabels = new KeyValuePair<ConstantValue, object>[count]; 146ConstantValue hashConstant = ConstantValue.Create(hashValue); 149jumpTableLabels[i] = new KeyValuePair<ConstantValue, object>(hashConstant, hashBucketLabel); 169private void EmitNonHashTableSwitch(KeyValuePair<ConstantValue, object>[] labels) 180private void EmitCondBranchForStringSwitch(ConstantValue stringConstant, object targetLabel) 192KeyValuePair<ConstantValue, object>[] caseLabels, 200ConstantValue stringConstant = kvPair.Key;
Compilation\Compilation.cs (1)
1780internal abstract IConvertibleConversion ClassifyConvertibleConversion(IOperation source, ITypeSymbol destination, out ConstantValue? constantValue);
Compilation\Expression.cs (15)
9public static ConstantValue SynthesizeNumeric(ITypeSymbol type, int value) 14return ConstantValue.Create(value); 16return ConstantValue.Create((long)value); 18return ConstantValue.Create((uint)value); 20return ConstantValue.Create((ulong)value); 22return ConstantValue.Create((ushort)value); 24return ConstantValue.Create((short)value); 26return ConstantValue.Create((sbyte)value); 28return ConstantValue.Create((byte)value); 30return ConstantValue.Create((char)value); 32return ConstantValue.Create(value != 0); 34return ConstantValue.Create((float)value); 36return ConstantValue.Create((double)value); 38return ConstantValue.Create(1, ConstantValueTypeDiscriminator.Int32); 46return ConstantValue.Bad;
ConstantValue.cs (39)
39internal abstract partial class ConstantValue : IEquatable<ConstantValue?>, IFormattable 89public const ConstantValue? NotAvailable = null; 91public static ConstantValue Bad { get { return ConstantValueBad.Instance; } } 92public static ConstantValue Null { get { return ConstantValueNull.Instance; } } 93public static ConstantValue Nothing { get { return Null; } } 96public static ConstantValue Unset { get { return ConstantValueNull.Uninitialized; } } 98public static ConstantValue True { get { return ConstantValueOne.Boolean; } } 99public static ConstantValue False { get { return ConstantValueDefault.Boolean; } } 101public static ConstantValue Create(string? value) 111internal static ConstantValue CreateFromRope(Rope value) 117public static ConstantValue Create(char value) 131public static ConstantValue Create(sbyte value) 145public static ConstantValue Create(byte value) 159public static ConstantValue Create(Int16 value) 173public static ConstantValue Create(UInt16 value) 187public static ConstantValue Create(Int32 value) 201public static ConstantValue Create(UInt32 value) 215public static ConstantValue Create(Int64 value) 229public static ConstantValue Create(UInt64 value) 243public static ConstantValue CreateNativeInt(Int32 value) 257public static ConstantValue CreateNativeUInt(UInt32 value) 271public static ConstantValue Create(bool value) 283public static ConstantValue Create(float value) 297public static ConstantValue CreateSingle(double value) 311public static ConstantValue Create(double value) 325public static ConstantValue Create(decimal value) 345public static ConstantValue Create(DateTime value) 355public static ConstantValue Create(object value, SpecialType st) 362public static ConstantValue? CreateSizeOf(SpecialType st) 365return (size == 0) ? null : ConstantValue.Create(size); 368public static ConstantValue Create(object value, ConstantValueTypeDiscriminator discriminator) 399public static ConstantValue Default(SpecialType st) 406public static ConstantValue Default(ConstantValueTypeDiscriminator discriminator) 864public virtual bool Equals(ConstantValue? other) 879public static bool operator ==(ConstantValue? left, ConstantValue? right) 894public static bool operator !=(ConstantValue? left, ConstantValue? right) 906return this.Equals(obj as ConstantValue);
ConstantValueSpecialized.cs (18)
48public override bool Equals(ConstantValue? other) 105public override bool Equals(ConstantValue? other) 205public override bool Equals(ConstantValue? other) 264public override bool Equals(ConstantValue? other) 305public override bool Equals(ConstantValue? other) 426public override bool Equals(ConstantValue? other) 454public override bool Equals(ConstantValue? other) 477public override bool Equals(ConstantValue? other) 500public override bool Equals(ConstantValue? other) 652public override bool Equals(ConstantValue? other) 670public override bool Equals(ConstantValue? other) 723public override bool Equals(ConstantValue? other) 780public override bool Equals(ConstantValue? other) 823public override bool Equals(ConstantValue? other) 866public override bool Equals(ConstantValue? other) 910public override bool Equals(ConstantValue? other) 944public override bool Equals(ConstantValue? other) 990public override bool Equals(ConstantValue? other)
CryptographicHashProvider.cs (3)
246internal static ImmutableArray<byte> ComputeSourceHash(ImmutableArray<ConstantValue> constants, SourceHashAlgorithm hashAlgorithm = SourceHashAlgorithms.Default) 251foreach (var constant in constants) 258static byte[] getBytes(ConstantValue constant)
Emit\CommonPEModuleBuilder.cs (2)
195public abstract Cci.IFieldReference GetArrayCachingFieldForConstants(ImmutableArray<ConstantValue> constants, Cci.IArrayTypeReference arrayType, SyntaxNode syntaxNode, DiagnosticBag diagnostics); 1124public sealed override Cci.IFieldReference GetArrayCachingFieldForConstants(ImmutableArray<ConstantValue> constants, Cci.IArrayTypeReference arrayType, SyntaxNode syntaxNode, DiagnosticBag diagnostics)
EnumConstantHelper.cs (11)
20internal static EnumOverflowKind OffsetValue(ConstantValue constantValue, uint offset, out ConstantValue offsetValue) 25offsetValue = ConstantValue.Bad; 36offsetValue = ConstantValue.Create((sbyte)(previous + offset)); 46offsetValue = ConstantValue.Create((byte)(previous + offset)); 56offsetValue = ConstantValue.Create((short)(previous + offset)); 66offsetValue = ConstantValue.Create((ushort)(previous + offset)); 76offsetValue = ConstantValue.Create((int)(previous + offset)); 86offsetValue = ConstantValue.Create((uint)(previous + offset)); 96offsetValue = ConstantValue.Create((long)(previous + offset)); 106offsetValue = ConstantValue.Create((ulong)(previous + offset));
Generated\Operations.Generated.cs (144)
4089internal override ConstantValue? OperationConstantValue => null; 4144internal override ConstantValue? OperationConstantValue => null; 4214internal override ConstantValue? OperationConstantValue => null; 4320internal override ConstantValue? OperationConstantValue => null; 4412internal override ConstantValue? OperationConstantValue => null; 4524internal override ConstantValue? OperationConstantValue => null; 4548internal override ConstantValue? OperationConstantValue => null; 4601internal override ConstantValue? OperationConstantValue => null; 4621internal override ConstantValue? OperationConstantValue => null; 4635internal override ConstantValue? OperationConstantValue => null; 4687internal override ConstantValue? OperationConstantValue => null; 4751internal override ConstantValue? OperationConstantValue => null; 4830internal override ConstantValue? OperationConstantValue => null; 4898internal override ConstantValue? OperationConstantValue => null; 4949internal override ConstantValue? OperationConstantValue => null; 5013internal override ConstantValue? OperationConstantValue => null; 5027internal override ConstantValue? OperationConstantValue => null; 5041internal override ConstantValue? OperationConstantValue => null; 5107internal override ConstantValue? OperationConstantValue => null; 5114internal LiteralOperation(SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5125internal override ConstantValue? OperationConstantValue { get; } 5132internal ConversionOperation(IOperation operand, IConvertibleConversion conversion, bool isTryCast, bool isChecked, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5185internal override ConstantValue? OperationConstantValue { get; } 5258internal override ConstantValue? OperationConstantValue => null; 5325internal override ConstantValue? OperationConstantValue => null; 5332internal LocalReferenceOperation(ILocalSymbol local, bool isDeclaration, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5347internal override ConstantValue? OperationConstantValue { get; } 5366internal override ConstantValue? OperationConstantValue => null; 5383internal FieldReferenceOperation(IFieldSymbol field, bool isDeclaration, IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5431internal override ConstantValue? OperationConstantValue { get; } 5487internal override ConstantValue? OperationConstantValue => null; 5556internal override ConstantValue? OperationConstantValue => null; 5610internal override ConstantValue? OperationConstantValue => null; 5617internal UnaryOperation(UnaryOperatorKind operatorKind, IOperation operand, bool isLifted, bool isChecked, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5673internal override ConstantValue? OperationConstantValue { get; } 5680internal BinaryOperation(BinaryOperatorKind operatorKind, IOperation leftOperand, IOperation rightOperand, bool isLifted, bool isChecked, bool isCompareText, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, IMethodSymbol? unaryOperatorMethod, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5751internal override ConstantValue? OperationConstantValue { get; } 5758internal ConditionalOperation(IOperation condition, IOperation whenTrue, IOperation? whenFalse, bool isRef, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5828internal override ConstantValue? OperationConstantValue { get; } 5835internal CoalesceOperation(IOperation value, IOperation whenNull, IConvertibleConversion valueConversion, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5895internal override ConstantValue? OperationConstantValue { get; } 5948internal override ConstantValue? OperationConstantValue => null; 5955internal ObjectCreationOperation(IMethodSymbol? constructor, IObjectOrCollectionInitializerOperation? initializer, ImmutableArray<IArgumentOperation> arguments, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 6018internal override ConstantValue? OperationConstantValue { get; } 6070internal override ConstantValue? OperationConstantValue => null; 6137internal override ConstantValue? OperationConstantValue => null; 6156internal override ConstantValue? OperationConstantValue => null; 6212internal override ConstantValue? OperationConstantValue => null; 6264internal override ConstantValue? OperationConstantValue => null; 6282internal SimpleAssignmentOperation(bool isRef, IOperation target, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 6337internal override ConstantValue? OperationConstantValue { get; } 6412internal override ConstantValue? OperationConstantValue => null; 6419internal ParenthesizedOperation(IOperation operand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 6465internal override ConstantValue? OperationConstantValue { get; } 6530internal override ConstantValue? OperationConstantValue => null; 6593internal override ConstantValue? OperationConstantValue => null; 6610internal override ConstantValue? OperationConstantValue => null; 6617internal InterpolatedStringOperation(ImmutableArray<IInterpolatedStringContentOperation> parts, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 6667internal override ConstantValue? OperationConstantValue { get; } 6723internal override ConstantValue? OperationConstantValue => null; 6779internal override ConstantValue? OperationConstantValue => null; 6842internal override ConstantValue? OperationConstantValue => null; 6849internal NameOfOperation(IOperation argument, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 6895internal override ConstantValue? OperationConstantValue { get; } 6953internal override ConstantValue? OperationConstantValue => null; 7011internal override ConstantValue? OperationConstantValue => null; 7063internal override ConstantValue? OperationConstantValue => null; 7115internal override ConstantValue? OperationConstantValue => null; 7122internal DefaultValueOperation(SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 7133internal override ConstantValue? OperationConstantValue { get; } 7152internal override ConstantValue? OperationConstantValue => null; 7159internal SizeOfOperation(ITypeSymbol typeOperand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 7172internal override ConstantValue? OperationConstantValue { get; } 7224internal override ConstantValue? OperationConstantValue => null; 7287internal override ConstantValue? OperationConstantValue => null; 7350internal override ConstantValue? OperationConstantValue => null; 7402internal override ConstantValue? OperationConstantValue => null; 7461internal override ConstantValue? OperationConstantValue => null; 7513internal override ConstantValue? OperationConstantValue => null; 7530internal override ConstantValue? OperationConstantValue => null; 7592internal override ConstantValue? OperationConstantValue => null; 7639internal override ConstantValue? OperationConstantValue => null; 7690internal override ConstantValue? OperationConstantValue => null; 7741internal override ConstantValue? OperationConstantValue => null; 7796internal override ConstantValue? OperationConstantValue => null; 7864internal override ConstantValue? OperationConstantValue => null; 7945internal override ConstantValue? OperationConstantValue => null; 8006internal override ConstantValue? OperationConstantValue => null; 8083internal override ConstantValue? OperationConstantValue => null; 8157internal override ConstantValue? OperationConstantValue => null; 8181internal override ConstantValue? OperationConstantValue => null; 8244internal override ConstantValue? OperationConstantValue => null; 8306internal override ConstantValue? OperationConstantValue => null; 8359internal override ConstantValue? OperationConstantValue => null; 8410internal override ConstantValue? OperationConstantValue => null; 8466internal override ConstantValue? OperationConstantValue => null; 8539internal override ConstantValue? OperationConstantValue => null; 8601internal override ConstantValue? OperationConstantValue => null; 8623internal override ConstantValue? OperationConstantValue => null; 8688internal override ConstantValue? OperationConstantValue => null; 8755internal override ConstantValue? OperationConstantValue => null; 8826internal override ConstantValue? OperationConstantValue => null; 8845internal override ConstantValue? OperationConstantValue => null; 8898internal override ConstantValue? OperationConstantValue => null; 8905internal FlowCaptureReferenceOperation(CaptureId id, bool isInitialization, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 8920internal override ConstantValue? OperationConstantValue { get; } 8927internal IsNullOperation(IOperation operand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 8973internal override ConstantValue? OperationConstantValue { get; } 8990internal override ConstantValue? OperationConstantValue => null; 9009internal override ConstantValue? OperationConstantValue => null; 9068internal override ConstantValue? OperationConstantValue => null; 9135internal override ConstantValue? OperationConstantValue => null; 9192internal override ConstantValue? OperationConstantValue => null; 9258internal override ConstantValue? OperationConstantValue => null; 9334internal override ConstantValue? OperationConstantValue => null; 9348internal override ConstantValue? OperationConstantValue => null; 9417internal override ConstantValue? OperationConstantValue => null; 9492internal override ConstantValue? OperationConstantValue => null; 9554internal override ConstantValue? OperationConstantValue => null; 9617internal override ConstantValue? OperationConstantValue => null; 9681internal override ConstantValue? OperationConstantValue => null; 9733internal override ConstantValue? OperationConstantValue => null; 9752internal override ConstantValue? OperationConstantValue => null; 9814internal override ConstantValue? OperationConstantValue => null; 9869internal override ConstantValue? OperationConstantValue => null; 9920internal override ConstantValue? OperationConstantValue => null; 9984internal override ConstantValue? OperationConstantValue => null; 10002internal override ConstantValue? OperationConstantValue => null; 10055internal override ConstantValue? OperationConstantValue => null; 10120internal override ConstantValue? OperationConstantValue => null; 10187internal override ConstantValue? OperationConstantValue => null; 10249internal override ConstantValue? OperationConstantValue => null; 10301internal override ConstantValue? OperationConstantValue => null; 10321internal override ConstantValue? OperationConstantValue => null; 10388internal override ConstantValue? OperationConstantValue => null; 10449internal override ConstantValue? OperationConstantValue => null; 10502internal override ConstantValue? OperationConstantValue => null; 10569internal override ConstantValue? OperationConstantValue => null; 10588internal override ConstantValue? OperationConstantValue => null; 10639internal override ConstantValue? OperationConstantValue => null; 10702internal override ConstantValue? OperationConstantValue => null; 10775internal override ConstantValue? OperationConstantValue => null; 10831internal override ConstantValue? OperationConstantValue => null; 10848internal override ConstantValue? OperationConstantValue => null;
MetadataReader\MetadataDecoder.cs (24)
987internal void DecodeLocalConstantBlobOrThrow(ref BlobReader sigReader, out TypeSymbol type, out ConstantValue value) 1012value = ConstantValue.Create(sigReader.ReadDecimal()); 1016value = ConstantValue.Create(sigReader.ReadDateTime()); 1022value = (type.IsReferenceType || type.TypeKind == TypeKind.Pointer || type.TypeKind == TypeKind.FunctionPointer) ? ConstantValue.Null : ConstantValue.Bad; 1026value = ConstantValue.Bad; 1057private static ConstantValue DecodePrimitiveConstantValue(ref BlobReader sigReader, SignatureTypeCode typeCode, out bool isEnumTypeCode) 1063return ConstantValue.Create(sigReader.ReadBoolean()); 1067return ConstantValue.Create(sigReader.ReadChar()); 1071return ConstantValue.Create(sigReader.ReadSByte()); 1075return ConstantValue.Create(sigReader.ReadByte()); 1079return ConstantValue.Create(sigReader.ReadInt16()); 1083return ConstantValue.Create(sigReader.ReadUInt16()); 1087return ConstantValue.Create(sigReader.ReadInt32()); 1091return ConstantValue.Create(sigReader.ReadUInt32()); 1095return ConstantValue.Create(sigReader.ReadInt64()); 1099return ConstantValue.Create(sigReader.ReadUInt64()); 1103return ConstantValue.Create(sigReader.ReadSingle()); 1107return ConstantValue.Create(sigReader.ReadDouble()); 1116return ConstantValue.Bad; 1119return ConstantValue.Null; 1124return ConstantValue.Bad; 1127return ConstantValue.Create(sigReader.ReadUTF16(sigReader.RemainingBytes)); 1132return ConstantValue.Null;
MetadataReader\PEModule.cs (27)
1625internal bool HasDateTimeConstantAttribute(EntityHandle token, out ConstantValue defaultValue) 1634defaultValue = ConstantValue.Bad; 1638defaultValue = ConstantValue.Create(new DateTime(value)); 1648internal bool HasDecimalConstantAttribute(EntityHandle token, out ConstantValue defaultValue) 1654defaultValue = ConstantValue.Create(value); 3612internal ConstantValue GetParamDefaultValue(ParameterHandle param) 3621return constantHandle.IsNil ? ConstantValue.Bad : GetConstantValueOrThrow(constantHandle); 3625return ConstantValue.Bad; 3629internal ConstantValue GetConstantFieldValue(FieldDefinitionHandle fieldDef) 3638return constantHandle.IsNil ? ConstantValue.Bad : GetConstantValueOrThrow(constantHandle); 3642return ConstantValue.Bad; 3733private ConstantValue GetConstantValueOrThrow(ConstantHandle handle) 3740return ConstantValue.Create(reader.ReadBoolean()); 3743return ConstantValue.Create(reader.ReadChar()); 3746return ConstantValue.Create(reader.ReadSByte()); 3749return ConstantValue.Create(reader.ReadInt16()); 3752return ConstantValue.Create(reader.ReadInt32()); 3755return ConstantValue.Create(reader.ReadInt64()); 3758return ConstantValue.Create(reader.ReadByte()); 3761return ConstantValue.Create(reader.ReadUInt16()); 3764return ConstantValue.Create(reader.ReadUInt32()); 3767return ConstantValue.Create(reader.ReadUInt64()); 3770return ConstantValue.Create(reader.ReadSingle()); 3773return ConstantValue.Create(reader.ReadDouble()); 3776return ConstantValue.Create(reader.ReadUTF16(reader.Length)); 3784return ConstantValue.Null; 3790return ConstantValue.Bad;
Operations\ControlFlowGraphBuilder.cs (12)
2443ConstantValue constantValue = ConstantValue.Create(!isAndAlso); 2468return new ConversionOperation(operand, _compilation.ClassifyConvertibleConversion(operand, type, out ConstantValue? constantValue), isTryCast: false, isChecked: false, 2702var constantValue = ConstantValue.Create(stopValue); 3325ConstantValue? constantValue = operand.GetConstantValue() is { IsNull: var isNull } 3326? ConstantValue.Create(isNull) 3469? ConstantValue.Null 4225return new ConversionOperation(operand, _compilation.ClassifyConvertibleConversion(operand, iDisposable, out var constantValue), isTryCast, isChecked: false, 4959isUp = new LiteralOperation(semanticModel: null, stepValue.Syntax, booleanType, constantValue: ConstantValue.Create(false), isImplicit: true); 4968constantValue: ConstantValue.Default(stepValueEnumUnderlyingTypeOrSelf.SpecialType), 5255constantValue: ConstantValue.Create(bits), isImplicit: true);
Operations\Operation.cs (1)
89internal abstract CodeAnalysis.ConstantValue? OperationConstantValue { get; }
Operations\OperationExtensions.cs (1)
393internal static ConstantValue? GetConstantValue(this IOperation operation)
Operations\OperationNodes.cs (10)
18public NoneOperation(ImmutableArray<IOperation> children, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) : 65internal override ConstantValue? OperationConstantValue { get; } 87public InvalidOperation(ImmutableArray<IOperation> children, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) : 136internal override ConstantValue? OperationConstantValue { get; } 170internal override ConstantValue? OperationConstantValue => null; 259internal override ConstantValue? OperationConstantValue => null; 401internal override ConstantValue? OperationConstantValue => null; 423internal override ConstantValue? OperationConstantValue => null; 641public FlowCaptureReferenceOperation(int id, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isInitialization = false) : 658public IsNullOperation(SyntaxNode syntax, IOperation operand, ITypeSymbol type, ConstantValue? constantValue) :
SwitchConstantValueHelper.cs (9)
17public static bool IsValidSwitchCaseLabelConstant(ConstantValue constant) 50public static int CompareSwitchCaseLabelConstants(ConstantValue first, ConstantValue second) 103var firstConstant = first as ConstantValue; 106var secondConstant = second as ConstantValue; 132var constant = obj as ConstantValue;
Symbols\Attributes\CommonAttributeData.cs (5)
193internal ConstantValue DecodeDecimalConstantValue() 236return ConstantValue.Create(new decimal(low, mid, high, isNegative, scale)); 239internal ConstantValue DecodeDateTimeConstantValue() 246return ConstantValue.Bad; 249return ConstantValue.Create(new DateTime(value));
Symbols\Attributes\CommonFieldWellKnownAttributeData.cs (4)
45private ConstantValue _constValue = ConstantValue.Unset; 47public ConstantValue ConstValue 56Debug.Assert(_constValue == ConstantValue.Unset);
Symbols\Attributes\CommonParameterEarlyWellKnownAttributeData.cs (4)
17private ConstantValue _defaultParameterValue = ConstantValue.Unset; 19public ConstantValue DefaultParameterValue 28Debug.Assert(_defaultParameterValue == ConstantValue.Unset);
Microsoft.CodeAnalysis.CSharp (914)
Binder\Binder_Attributes.cs (2)
582lvalue = new BoundFieldAccess(nameSyntax, null, fieldSymbol, ConstantValue.NotAvailable, resultKind, fieldSymbol.Type); 857ConstantValue? constantValue = node.ConstantValueOpt;
Binder\Binder_Await.cs (1)
640var receiver = new BoundLiteral(node, ConstantValue.Null, awaiterType);
Binder\Binder_Conversions.cs (27)
322ConstantValue? constantValue = this.FoldConstantConversion(syntax, source, conversion, destination, diagnostics); 2471var constantValue = FoldConditionalOperator(condition, trueExpr, falseExpr); 2546constantValueOpt: ConstantValue.NotAvailable, 2636constantValueOpt: ConstantValue.NotAvailable, 2681constantValueOpt: ConstantValue.NotAvailable, 2736constantValueOpt: ConstantValue.NotAvailable, 2813constantValueOpt: ConstantValue.NotAvailable, 2871constantValueOpt: ConstantValue.NotAvailable, type: delegateType, hasErrors: true) 2923constantValueOpt: ConstantValue.NotAvailable, 2950return new BoundConversion(syntax, group, conversion, @checked: false, explicitCastInCode: isCast, conversionGroup, inConversionGroupFlags, constantValueOpt: ConstantValue.NotAvailable, type: destination, hasErrors: hasErrors) { WasCompilerGenerated = group.WasCompilerGenerated }; 3023DefaultValueFromAttributes: ConstantValue.NotAvailable 3059var delegateParamDefault = delegateParameter.HasExplicitDefaultValue ? delegateParameter.ExplicitDefaultConstantValue : null; 3216constantValueOpt: ConstantValue.NotAvailable, 3233constantValueOpt: ConstantValue.NotAvailable, 3798public ConstantValue? FoldConstantConversion( 3833var sourceConstantValue = source.ConstantValueOpt; 3864return ConstantValue.Create(sourceConstantValue.SingleValue); 3866return ConstantValue.Create(sourceConstantValue.DoubleValue); 3900private ConstantValue? FoldConstantNumericConversion( 3902ConstantValue sourceValue, 3933return ConstantValue.Bad; 3941return ConstantValue.Bad; 3957return ConstantValue.Bad; 3970return ConstantValue.Create(DoUncheckedConversion(destinationType, sourceValue), destinationType); 3973private static object DoUncheckedConversion(SpecialType destinationType, ConstantValue value) 4276public static bool CheckConstantBounds(SpecialType destinationType, ConstantValue value, out bool maySucceedAtRuntime) 4353private static object CanonicalizeConstant(ConstantValue value)
Binder\Binder_Expressions.cs (21)
1474ConstantValue constantValue = GetConstantSizeOf(type); 1625internal static ConstantValue GetConstantSizeOf(TypeSymbol type) 1627return ConstantValue.CreateSizeOf((type.GetEnumUnderlyingType() ?? type).SpecialType); 2078var constantValueOpt = localSymbol.IsConst && !IsInsideNameof && !type.IsErrorType() 4564ConstantValue.Create(knownSizes[i] ?? 0), 4801ConstantValue.Create(boundInitExprOpt.Length), 4821var constantValue = expression.ConstantValueOpt; 4840var constantValue = expression.ConstantValueOpt; 5438lengthOrCount = new BoundLiteral(expression.Syntax, ConstantValue.Create(length), @this.GetSpecialType(SpecialType.System_Int32, diagnostics, expression.Syntax)) { WasCompilerGenerated = true }; 6986ConstantValue constantValueOpt = (initializerSyntaxOpt == null && method.IsDefaultValueTypeConstructor()) ? 7500private static ConstantValue FoldParameterlessValueTypeConstructor(NamedTypeSymbol type) 7533return ConstantValue.Default(specialType); 7562ConstantValue cv; 7567cv = ConstantValue.Null; 7583cv = ConstantValue.Create(value, specialType); 8023if (boundLeft.Kind == BoundKind.Literal && ((BoundLiteral)boundLeft).ConstantValueOpt == ConstantValue.Null) 8197if ((boundLeft is BoundDefaultLiteral || boundLeft is BoundDefaultExpression) && boundLeft.ConstantValueOpt == ConstantValue.Null && 9868ConstantValue constantValueOpt = null; 9873if (constantValueOpt == ConstantValue.Unset) 9877constantValueOpt = ConstantValue.Bad; 10688ConstantValue constant = index.ConstantValueOpt;
Binder\Binder_InterpolatedString.cs (10)
42ConstantValue? resultConstant = null; 47resultConstant = ConstantValue.Create(string.Empty); 102var alignmentConstant = alignment.ConstantValueOpt; 137format = new BoundLiteral(interpolation.FormatClause, ConstantValue.Create(text), stringType, hasErrors); 167var constantValue = ConstantValue.Create(text, SpecialType.System_String); 414expressions[0] = new BoundLiteral(syntax, ConstantValue.Create(formatString.ToStringAndFree()), GetSpecialType(Microsoft.CodeAnalysis.SpecialType.System_String, diagnostics, syntax)) { WasCompilerGenerated = true }; 820argumentsBuilder.Add(new BoundLiteral(syntax, ConstantValue.Create(baseStringLength), intType) { WasCompilerGenerated = true }); 822argumentsBuilder.Add(new BoundLiteral(syntax, ConstantValue.Create(numFormatHoles), intType) { WasCompilerGenerated = true }); 955argumentsBuilder.Add(boundLiteral.Update(ConstantValue.Create(literalText), boundLiteral.Type));
Binder\Binder_Invocation.cs (12)
1504defaultValue = new BoundFieldAccess(syntax, null, fieldSymbol, ConstantValue.NotAvailable) { WasCompilerGenerated = true }; 1700var parameterDefaultValue = parameter.ExplicitDefaultConstantValue; 1707var defaultConstantValue = parameterDefaultValue switch 1710{ IsBad: true } => ConstantValue.Null, 1713Debug.Assert((object?)defaultConstantValue != ConstantValue.Unset); 1721defaultValue = new BoundLiteral(syntax, ConstantValue.Create(line), Compilation.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true }; 1726defaultValue = new BoundLiteral(syntax, ConstantValue.Create(path), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true }; 1731defaultValue = new BoundLiteral(syntax, ConstantValue.Create(memberName), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true }; 1739defaultValue = new BoundLiteral(syntax, ConstantValue.Create(argument.Syntax.ToString()), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true }; 1741else if (defaultConstantValue == ConstantValue.NotAvailable) 1869BoundExpression arraySize = new BoundLiteral(node, ConstantValue.Create(collectionArgs.Length), int32Type) { WasCompilerGenerated = true }; 2459return new BoundNameOfOperator(node, boundArgument, ConstantValue.Create(name), Compilation.GetSpecialType(SpecialType.System_String));
Binder\Binder_Operators.cs (113)
848constantValueOpt: ConstantValue.NotAvailable, 949return new BoundBinaryOperator(node, kind, ConstantValue.NotAvailable, methodOpt: null, constrainedToTypeOpt: null, LookupResultKind.Empty, left, right, GetBinaryOperatorErrorType(kind, diagnostics, node), true); 973return new BoundLiteral(node, ConstantValue.Create(kind == BinaryOperatorKind.Equal), GetSpecialType(SpecialType.System_Boolean, diagnostics, node)); 989var stringConstant = FoldBinaryOperator(node, BinaryOperatorKind.StringConcatenation, left, right, right.Type, diagnostics); 1069ConstantValue resultConstant = null; 1444var constantValue = FoldBinaryOperator(node, kind | BinaryOperatorKind.Bool, left, right, left.Type, diagnostics); 1457return new BoundBinaryOperator(node, kind, ConstantValue.NotAvailable, methodOpt: null, constrainedToTypeOpt: null, 1573ConstantValue.NotAvailable, 1584return new BoundBinaryOperator(node, kind, left, right, ConstantValue.NotAvailable, methodOpt: null, constrainedToTypeOpt: null, lookupResult, originalUserDefinedOperators, CreateErrorType(), true); 2458private static object FoldDecimalBinaryOperators(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 2489private static object FoldNativeIntegerOverflowingBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 2532private static object FoldUncheckedIntegralBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 2588private static object FoldCheckedIntegralBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 2678private ConstantValue? FoldEnumBinaryOperator( 2739var constantValue = FoldBinaryOperator(syntax, newKind, newLeftOperand, newRightOperand, resultTypeSymbol, diagnostics); 2753private ConstantValue? FoldBinaryOperator( 2770ConstantValue? nullableEqualityResult = TryFoldingNullableEquality(kind, left, right); 2776var valueLeft = left.ConstantValueOpt; 2777var valueRight = right.ConstantValueOpt; 2785return ConstantValue.Bad; 2797return ConstantValue.Bad; 2812return ConstantValue.Create(newValue, resultType); 2815ConstantValue? concatResult = FoldStringConcatenation(kind, valueLeft, valueRight); 2836return ConstantValue.Bad; 2841return ConstantValue.Create(newValue, resultType); 2860return ConstantValue.Create(newValue, resultType); 2872return ConstantValue.Bad; 2882return ConstantValue.Create(newValue, resultType); 2910private static ConstantValue? TryFoldingNullableEquality(BinaryOperatorKind kind, BoundExpression left, BoundExpression right) 2921ConstantValue? leftConstant = leftConv.Operand.ConstantValueOpt; 2922ConstantValue? rightConstant = rightConv.Operand.ConstantValueOpt; 2932return (leftIsNull == rightIsNull) == (op == BinaryOperatorKind.Equal) ? ConstantValue.True : ConstantValue.False; 2943private static object? FoldNeverOverflowBinaryOperators(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 3198private static ConstantValue? FoldStringConcatenation(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 3209return (newLength > int.MaxValue) ? ConstantValue.Bad : ConstantValue.CreateFromRope(Rope.Concat(leftValue, rightValue)); 4362return new BoundUnaryOperator(node, kind, operand, ConstantValue.NotAvailable, 4383constantValueOpt: ConstantValue.NotAvailable, 4404ConstantValue.NotAvailable, 4419var resultConstant = FoldUnaryOperator(node, resultOperatorKind, resultOperand, resultType, diagnostics); 4435private ConstantValue? FoldEnumUnaryOperator( 4456var constantValue = FoldUnaryOperator(syntax, newKind, operand, upconvertType, diagnostics); 4470private ConstantValue? FoldUnaryOperator( 4485var value = operand.ConstantValueOpt; 4500return ConstantValue.Create(newValue, resultType); 4519return ConstantValue.Create(newValue, resultType); 4531return ConstantValue.Bad; 4541return ConstantValue.Create(newValue, resultType); 4547private static object? FoldNeverOverflowUnaryOperator(UnaryOperatorKind kind, ConstantValue value) 4587private static object? FoldUncheckedIntegralUnaryOperator(UnaryOperatorKind kind, ConstantValue value) 4603private static object? FoldCheckedIntegralUnaryOperator(UnaryOperatorKind kind, ConstantValue value) 4619private static object? FoldNativeIntegerOverflowingUnaryOperator(UnaryOperatorKind kind, ConstantValue value) 4708return new BoundLiteral(node, ConstantValue.Create((int)-2147483648), GetSpecialType(SpecialType.System_Int32, diagnostics, node)); 4723return new BoundLiteral(node, ConstantValue.Create(-9223372036854775808), GetSpecialType(SpecialType.System_Int64, diagnostics, node)); 4729private static bool IsDivisionByZero(BinaryOperatorKind kind, ConstantValue valueRight) 4895if (operand.ConstantValueOpt == ConstantValue.Null || 4978var convertedExpression = BindExpressionForPattern(unionType, inputType, node.Right, ref hasErrors, diagnostics, out var constantValueOpt, out var wasExpression, patternExpressionConversion: out _, out BoundExpression originalExpression); 5006constantValueOpt ?? ConstantValue.Bad, 5030ConstantValue operandConstantValue) 5037ConstantValue constantValue = GetIsOperatorConstantResult(operandType, targetType, conversionKind, operandConstantValue); 5046Debug.Assert(constantValue == ConstantValue.True || constantValue == ConstantValue.False); 5048ErrorCode errorCode = constantValue == ConstantValue.True ? ErrorCode.WRN_IsAlwaysTrue : ErrorCode.WRN_IsAlwaysFalse; 5056/// - <see cref="ConstantValue.False"/> 5057/// - <see cref="ConstantValue.True"/> 5058/// - <see cref="ConstantValue.Bad"/> - compiler doesn't support the type check, i.e. cannot perform it, even at runtime 5061internal static ConstantValue GetIsOperatorConstantResult( 5065ConstantValue operandConstantValue, 5104if (operandConstantValue == ConstantValue.Null) 5106return ConstantValue.False; 5114(operandConstantValue == null || operandConstantValue == ConstantValue.Null); // a non-null constant is never null 5179return ConstantValue.False; 5189return ConstantValue.False; 5210return ConstantValue.False; 5218return ConstantValue.False; 5223return ConstantValue.Bad; 5257return ConstantValue.False; 5267return ConstantValue.False; 5283return ConstantValue.False; 5292return operandCouldBeNull ? null : ConstantValue.True; 5298return ConstantValue.False; 5301return operandCouldBeNull ? null : ConstantValue.True; 5316return operandCouldBeNull ? null : ConstantValue.True; 5333return operandCouldBeNull ? null : ConstantValue.True; 5345? ConstantValue.True : ConstantValue.False; 5470operand = new BoundDefaultExpression(operand.Syntax, targetType: null, constantValueOpt: ConstantValue.Null, 5528ConstantValue operandConstantValue) 5590ConstantValue operandConstantValue) 5597ConstantValue constantValue = GetAsOperatorConstantResult(operandType, targetType, conversionKind, operandConstantValue); 5614/// - <see cref="ConstantValue.Null"/> 5615/// - <see cref="ConstantValue.Bad"/> - compiler doesn't support the type check, i.e. cannot perform it, even at runtime 5618internal static ConstantValue GetAsOperatorConstantResult(TypeSymbol operandType, TypeSymbol targetType, ConversionKind conversionKind, ConstantValue operandConstantValue) 5625ConstantValue isOperatorConstantResult = GetIsOperatorConstantResult(operandType, targetType, conversionKind, operandConstantValue); 5637return ConstantValue.Bad; 5640return ConstantValue.Null; 5978ConstantValue? constantValue = null; 6074private static ConstantValue FoldConditionalOperator(BoundExpression condition, BoundExpression trueExpr, BoundExpression falseExpr) 6076ConstantValue trueValue = trueExpr.ConstantValueOpt; 6082ConstantValue falseValue = falseExpr.ConstantValueOpt; 6088ConstantValue conditionValue = condition.ConstantValueOpt; 6093else if (conditionValue == ConstantValue.True) 6097else if (conditionValue == ConstantValue.False) 6103return ConstantValue.Bad;
Binder\Binder_Patterns.cs (32)
510ConstantValue? constantValueOpt; 552constantValueOpt ?? ConstantValue.Bad, 565internal static bool IsClassOrNullableValueTypeUnionNullPatternMatching([NotNullWhen(true)] NamedTypeSymbol? unionMatchingInputType, [NotNullWhen(true)] ConstantValue? constantValueOpt) 568return unionMatchingInputType is not null && constantValueOpt == ConstantValue.Null && (unionMatchingInputType.IsNullableType() || !unionMatchingInputType.IsValueType); 620out ConstantValue? constantValueOpt, 640out ConstantValue? constantValueOpt, 670if (convertedExpression.Type is null && constantValueOpt != ConstantValue.Null) 684out ConstantValue? constantValue, 700if (expression.ConstantValueOpt == ConstantValue.Null) 713ConstantValue match = ExpressionOfTypeMatchesPatternType(Conversions, inputType, expression.Type, ref useSiteInfo, out _, operandConstantValue: null); 714if (match == ConstantValue.False || match == ConstantValue.Bad) 764if (constantValue == ConstantValue.Null) 822constantValue: out var caseConstant, 848constantValue = ConstantValue.Bad; 913ConstantValue matchPossible = ExpressionOfTypeMatchesPatternType( 926private DiagnosticInfo? PatternTypeMatchErrorInfo(TypeSymbol inputType, TypeSymbol patternType, ConstantValue matchPossible, Conversion conversion) 928if (matchPossible != ConstantValue.False && matchPossible != ConstantValue.Bad) 961ConstantValue matchPossible = ExpressionOfTypeMatchesPatternType( 971if (PatternTypeMatchErrorInfo(unionType, patternType, matchPossible: ConstantValue.Bad, conversion: Conversion.NoConversion) is { } errorInfo) 983/// - <see cref="ConstantValue.True"/> if the matched type catches all of them 984/// - <see cref="ConstantValue.False"/> if it catches none of them 985/// - <see cref="ConstantValue.Bad"/> - compiler doesn't support the type check, i.e. cannot perform it, even at runtime 988internal static ConstantValue ExpressionOfTypeMatchesPatternType( 994ConstantValue? operandConstantValue = null, 1004return ConstantValue.True; 1014ConstantValue result = Binder.GetIsOperatorConstantResult(expressionType, patternType, conversion.Kind, operandConstantValue, operandCouldBeNull); 1017Debug.Assert((!conversion.IsUserDefined && !conversion.IsUnion) || result == ConstantValue.False || result == ConstantValue.Bad); 1974BoundExpression value = BindExpressionForPattern(unionType, inputType, node.Expression, ref hasErrors, diagnostics, out var constantValueOpt, out _, out Conversion patternConversion, originalExpression: out _); 2010constantValueOpt = ConstantValue.Bad;
Binder\Binder_Statements.cs (9)
2279Conversion conversion, TypeSymbol sourceType, TypeSymbol targetType, ConstantValue sourceConstantValueOpt = null) 2296else if (conversion.Kind == ConversionKind.ExplicitNumeric && sourceConstantValueOpt != null && sourceConstantValueOpt != ConstantValue.Bad && 2297ConversionsBase.HasImplicitConstantExpressionConversion(new BoundLiteral(syntax, ConstantValue.Bad, sourceType), targetType)) 2694return BoundConversion.Synthesized(node, BindToTypeForErrorRecovery(expr), Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, InConversionGroupFlags.Unspecified, ConstantValue.NotAvailable, boolean, hasErrors: true); 2706ConstantValue.NotAvailable, 2762return BoundConversion.Synthesized(node, expr, Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, InConversionGroupFlags.Unspecified, ConstantValue.NotAvailable, boolean, hasErrors: true); 2782return new BoundUnaryOperator(node, signature.Kind, resultOperand, ConstantValue.NotAvailable, signature.Method, signature.ConstrainedToTypeOpt, resultKind, originalUserDefinedOperators, signature.ReturnType) 3434exceptionSource = new BoundLocal(declaration, local, ConstantValue.NotAvailable, local.Type); 3446if (boundFilter.ConstantValueOpt != ConstantValue.NotAvailable)
Binder\DecisionDagBuilder_CheckOrReachability.cs (2)
1168new BoundLiteral(node.Syntax, constantValueOpt: ConstantValue.Null, type: node.InputType, hasErrors: false), 1169ConstantValue.Null, unionMatchingMode: UnionMatchingMode.None, node.InputType, node.InputType, hasErrors: false);
Binder\DecisionDagBuilder_ListPatterns.cs (2)
50? new BoundDagRelationalTest(syntax, BinaryOperatorKind.IntGreaterThanOrEqual, ConstantValue.Create(subpatterns.Length - 1), lengthTemp) 51: new BoundDagValueTest(syntax, ConstantValue.Create(subpatterns.Length), lengthTemp)));
Binder\DecisionDagBuilder.cs (28)
520tests.Add(new Tests.One(new BoundDagValueTest(syntax, ConstantValue.Create(patternLength), lengthTemp))); 760Tests test = MakeConstantTest(syntax, temp, sense ? ConstantValue.True : ConstantValue.False); 805Tests test = MakeConstantTest(syntax, boolResult, ConstantValue.True); 871if (constant.ConstantValue == ConstantValue.Null) 892ConstantValue constantValue = constant.ConstantValue; 918private static Tests MakeConstantTest(SyntaxNode syntax, BoundDagTemp input, ConstantValue constantValue) 1790resultForRelation(BinaryOperatorKind relation, ConstantValue value) 2066ConstantValue value, 2135ConstantValue? matches = ExpressionOfTypeMatchesPatternTypeForLearningFromSuccessfulTypeTest(_conversions, t1Type, t2Type, ref useSiteInfo); 2136if (matches == ConstantValue.False) 2142else if (matches == ConstantValue.True) 2152if (matches == ConstantValue.True) 2377Debug.Assert((hasValueTest.Value == ConstantValue.True || hasValueTest.Value == ConstantValue.False)); 2378if (hasValueTest.Value == ConstantValue.True || hasValueTest.Value == ConstantValue.False) 2380sense = hasValueTest.Value == ConstantValue.True; 2395bool isTrue = tryGetValueTest.Value == ConstantValue.True; 2702internal static ConstantValue? ExpressionOfTypeMatchesPatternTypeForLearningFromSuccessfulTypeTest( 2708ConstantValue result = Binder.ExpressionOfTypeMatchesPatternType(conversions, expressionType, patternType, ref useSiteInfo, out Conversion conversion); 3192public bool IsFullyMatched => RemainingTests is Tests.True && (WhenClause is null || WhenClause.ConstantValueOpt == ConstantValue.True); 3551static Tests? knownResult(BinaryOperatorKind relation, ConstantValue constant, int offset) 3563static ConstantValue safeAdd(ConstantValue constant, int offset) 3570return ConstantValue.Create(offset > (int.MaxValue - value) ? int.MaxValue : value + offset); 3913condition = new Tests.One(new BoundDagValueTest(s2.Syntax, ConstantValue.Create(lengthValue), s1LengthTemp)); 4150ConstantValue? sample = Values.Sample;
Binder\ForEachLoopBinder.cs (2)
675ConstantValue.NotAvailable, 1581ConstantValue.NotAvailable,
Binder\LockBinder.cs (1)
46if (expr.ConstantValueOpt != ConstantValue.Null || Compilation.FeatureStrictEnabled) // Dev10 allows the null literal.
Binder\PatternExplainer.cs (8)
776void addRelation(BinaryOperatorKind relation, ConstantValue value) 818field.GetConstantValue(ConstantFieldsInProgress.Empty, false) is ConstantValue constantValue && 828var sample = remainingValues.Sample; 840if (remainingValues.Any(BinaryOperatorKind.GreaterThan, ConstantValue.Create(int.MaxValue))) 843if (remainingValues.Any(BinaryOperatorKind.LessThan, ConstantValue.Create(int.MinValue))) 848if (remainingValues.Any(BinaryOperatorKind.GreaterThan, ConstantValue.Create(uint.MaxValue))) 855private static string ValueString(ConstantValue value, TypeSymbol type, bool requireExactType) 878private static string PrimitiveValueString(ConstantValue value, TypeSymbol type)
Binder\Semantics\Conversions\Conversions.cs (2)
75var defaultValue = p.ExplicitDefaultConstantValue; 76if (defaultValue != ConstantValue.NotAvailable)
Binder\Semantics\Conversions\ConversionsBase.cs (4)
1366var constantValue = source.ConstantValueOpt; 1475var sourceConstantValue = source.ConstantValueOpt; 1772BoundLiteral intMaxValueLiteral = new BoundLiteral(syntaxNode, ConstantValue.Create(int.MaxValue), expectedAttributeType); 2082private static bool IsConstantNumericZero(ConstantValue value)
Binder\SwitchBinder.cs (6)
110var constantValue = label.SwitchCaseLabelConstant; 205ConstantValue boundLabelConstantOpt = null; 241protected BoundExpression ConvertCaseExpression(CSharpSyntaxNode node, BoundExpression caseExpression, out ConstantValue constantValueOpt, BindingDiagnosticBag diagnostics, bool isGotoCaseExpr = false) 284protected static object KeyForConstant(ConstantValue constantValue) 305protected SourceLabelSymbol FindMatchingSwitchCaseLabel(ConstantValue constantValue, CSharpSyntaxNode labelSyntax) 502ConstantValue gotoCaseExpressionConstant = null;
BoundTree\BoundBinaryOperator.UncommonData.cs (4)
32public static UncommonData UnconvertedInterpolatedStringAddition(ConstantValue? constantValue) => 50public static UncommonData? CreateIfNeeded(ConstantValue? constantValue, MethodSymbol? method, TypeSymbol? constrainedToType, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt) 60public readonly ConstantValue? ConstantValue; 71private UncommonData(ConstantValue? constantValue, MethodSymbol? method, TypeSymbol? constrainedToType, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, bool isUnconvertedInterpolatedStringAddition, InterpolatedStringHandlerData? interpolatedStringHandlerData)
BoundTree\BoundConstantPattern.cs (1)
20(ConstantValue == ConstantValue.Null && (InputType.IsNullableType() || !InputType.IsValueType) && NarrowedType.Equals(InputType, TypeCompareKind.AllIgnoreOptions)));
BoundTree\BoundDecisionDag.cs (1)
152ConstantValue inputConstant = input.ConstantValueOpt;
BoundTree\BoundExpression.cs (6)
106public virtual ConstantValue? ConstantValueOpt 249public override ConstantValue? ConstantValueOpt 313public BoundLocal(SyntaxNode syntax, LocalSymbol localSymbol, ConstantValue? constantValueOpt, TypeSymbol type, bool hasErrors = false) 318public BoundLocal Update(LocalSymbol localSymbol, ConstantValue? constantValueOpt, TypeSymbol type) 414public override ConstantValue? ConstantValueOpt => Data?.ConstantValue; 609public override ConstantValue? ConstantValueOpt
BoundTree\BoundExpressionExtensions.cs (1)
114var constValue = node.ConstantValueOpt;
BoundTree\BoundNode_Source.cs (2)
239ConstantValue? constantValueOpt = literal.ConstantValueOpt; 555void appendConstantValue(ConstantValue? constantValueOpt)
BoundTree\BoundObjectCreationExpression.cs (3)
13ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ConstantValue? constantValueOpt, 19ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ConstantValue? constantValueOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, TypeSymbol type) 26BitVector defaultArguments, ConstantValue? constantValueOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, TypeSymbol type)
BoundTree\Constructors.cs (12)
18ConstantValue? constantValueOpt, 28ConstantValue? constantValueOpt, 40ConstantValue? constantValueOpt, 52ConstantValue? constantValueOpt, 335public static BoundConversion SynthesizedNonUserDefined(SyntaxNode syntax, BoundExpression operand, Conversion conversion, TypeSymbol type, ConstantValue? constantValueOpt = null) 364ConstantValue? constantValueOpt, 392ConstantValue? constantValueOpt, 417ConstantValue? constantValueOpt, 438ConstantValue? constantValueOpt, 451ConstantValue? constantValueOpt, 687ConstantValue? constantValueOpt, 699ConstantValue? constantValueOpt,
BoundTree\LengthBasedStringSwitchData.cs (1)
137internal static LengthBasedStringSwitchData Create(ImmutableArray<(ConstantValue value, LabelSymbol label)> inputCases)
CodeGen\CodeGenerator.cs (1)
484_builder.EmitConstantValue(ConstantValue.Create(true), syntaxNode);
CodeGen\EmitArrayInitializer.cs (4)
216private static ConstantValue AsConstOrDefault(BoundExpression init) 218ConstantValue initConstantValueOpt = init.ConstantValueOpt; 226return ConstantValue.Default(type.SpecialType); 706ImmutableArray<ConstantValue> constants = initializers.SelectAsArray(static init => init.ConstantValueOpt!);
CodeGen\EmitExpression.cs (5)
43var constantValue = expression.ConstantValueOpt; 411var receiverConstant = receiver.ConstantValueOpt; 1543var constVal = receiver.ConstantValueOpt; 3507var constantValue = type.GetDefaultValue(); 3544private void EmitConstantExpression(TypeSymbol type, ConstantValue constantValue, bool used, SyntaxNode syntaxNode)
CodeGen\EmitOperators.cs (4)
360var constant = binOp.Left.ConstantValueOpt; 454private void EmitIsNotNullOrZero(BoundExpression comparand, ConstantValue nullOrZero) 468private void EmitIsNullOrZero(BoundExpression comparand, ConstantValue nullOrZero) 498var constantValue = condition.ConstantValueOpt;
CodeGen\EmitStatement.cs (13)
1270dispatch.Cases.Select(p => new KeyValuePair<ConstantValue, object>(p.value, p.label)).ToArray(), 1277KeyValuePair<ConstantValue, object>[] switchCaseLabels, 1437lengthBasedSwitchInfo.LengthBasedJumpTable.LengthCaseLabels.Select(p => new KeyValuePair<ConstantValue, object>(ConstantValue.Create(p.value), p.label)).ToArray(), 1477charJumpTable.CharCaseLabels.Select(p => new KeyValuePair<ConstantValue, object>(ConstantValue.Create(p.value), p.label)).ToArray(), 1497stringJumpTable.StringCaseLabels.Select(p => new KeyValuePair<ConstantValue, object>(ConstantValue.Create(p.value), p.label)).ToArray(), 1513KeyValuePair<ConstantValue, object>[] switchCaseLabels, 1591if (stringConstant == ConstantValue.Null) 1717private void EmitStringCompareAndBranch(LocalOrParameter key, SyntaxNode syntaxNode, ConstantValue stringConstant, object targetLabel, Microsoft.Cci.IReference stringEqualityMethodRef) 1755private void EmitCharCompareAndBranch(LocalOrParameter key, SyntaxNode syntaxNode, ConstantValue stringConstant, object targetLabel, Cci.IReference sequenceEqualsRef, Cci.IReference asSpanRef) 2014var casesBuilder = ArrayBuilder<(ConstantValue, LabelSymbol)>.GetInstance();
CodeGen\Optimizer.cs (1)
2467internal override ConstantValue GetConstantValue(SyntaxNode node, LocalSymbol inProgress, BindingDiagnosticBag diagnostics)
Compilation\CSharpCompilation.cs (3)
2288var dumbInstance = new BoundLiteral(syntax, ConstantValue.Null, namedType); 2434internal override IConvertibleConversion ClassifyConvertibleConversion(IOperation source, ITypeSymbol? destination, out ConstantValue? constantValue) 2445ConstantValue? sourceConstantValue = source.GetConstantValue();
Compilation\MemberSemanticModel.cs (1)
1309ConstantValue constantValue = boundExpr.ConstantValueOpt;
Compiler\MethodBodySynthesizer.cs (8)
106ImmutableArray.Create<BoundExpression>(new BoundLiteral(syntax, ConstantValue.Create(slotIndex), intType) { WasCompilerGenerated = true }), 122new BoundFieldAccess(syntax, thisReference, hostObjectField, ConstantValue.NotAvailable) { WasCompilerGenerated = true }, 126ImmutableArray.Create<BoundExpression>(new BoundLiteral(syntax, ConstantValue.Create(0), intType) { WasCompilerGenerated = true }), 133ConstantValue.NotAvailable, 151new BoundFieldAccess(syntax, thisReference, field, ConstantValue.NotAvailable) { WasCompilerGenerated = true }, 155ImmutableArray.Create<BoundExpression>(new BoundLiteral(syntax, ConstantValue.Create(targetSubmissionIndex), intType) { WasCompilerGenerated = true }), 163ConstantValue.NotAvailable, 190var fieldAccess = new BoundFieldAccess(syntax, thisReference, field, ConstantValue.NotAvailable) { WasCompilerGenerated = true };
Compiler\MethodCompiler.cs (1)
589ConstantValue constantValue = fieldSymbol.GetConstantValue(ConstantFieldsInProgress.Empty, earlyDecodingWellKnownAttributes: false);
Emitter\Model\ParameterSymbolAdapter.cs (1)
84ConstantValue constant = AdaptedParameterSymbol.ExplicitDefaultConstantValue;
FlowAnalysis\AbstractFlowPass.cs (3)
678return node.ConstantValueOpt == ConstantValue.True; 683return node.ConstantValueOpt == ConstantValue.False; 688return node.ConstantValueOpt == ConstantValue.Null;
FlowAnalysis\DefiniteAssignment.cs (1)
860return value.ConstantValueOpt != ConstantValue.Null;
FlowAnalysis\NullableWalker_Patterns.cs (4)
171bool isExplicitNullCheck = cp.Value.ConstantValueOpt == ConstantValue.Null; 582Debug.Assert(t.Value != ConstantValue.Null); 598bool isFalseTest = t.Value == ConstantValue.False; 656if (w.WhenExpression != null && w.WhenExpression.ConstantValueOpt != ConstantValue.True)
FlowAnalysis\NullableWalker.cs (1)
8831return expr.ConstantValueOpt == ConstantValue.NotAvailable || !expr.ConstantValueOpt.IsNull || expr.IsSuppressed ? NullableAnnotation.NotAnnotated : NullableAnnotation.Annotated;
FlowAnalysis\NullableWalker.DebugVerifier.cs (1)
423if (node.WhenClause?.ConstantValueOpt != ConstantValue.True)
FlowAnalysis\NullableWalker.PlaceholderLocal.cs (1)
61internal override ConstantValue GetConstantValue(SyntaxNode node, LocalSymbol inProgress, BindingDiagnosticBag diagnostics = null) => null;
Generated\BoundNodes.xml.Generated.cs (56)
1204public BoundUnaryOperator(SyntaxNode syntax, UnaryOperatorKind operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type, bool hasErrors = false) 1223public override ConstantValue? ConstantValueOpt { get; } 1232public BoundUnaryOperator Update(UnaryOperatorKind operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type) 1999public BoundUnconvertedConditionalOperator(SyntaxNode syntax, BoundExpression condition, BoundExpression consequence, BoundExpression alternative, ConstantValue? constantValueOpt, ErrorCode noCommonTypeError, bool hasErrors = false) 2018public override ConstantValue? ConstantValueOpt { get; } 2024public BoundUnconvertedConditionalOperator Update(BoundExpression condition, BoundExpression consequence, BoundExpression alternative, ConstantValue? constantValueOpt, ErrorCode noCommonTypeError) 2038public BoundConditionalOperator(SyntaxNode syntax, bool isRef, BoundExpression condition, BoundExpression consequence, BoundExpression alternative, ConstantValue? constantValueOpt, TypeSymbol? naturalTypeOpt, bool wasTargetTyped, TypeSymbol type, bool hasErrors = false) 2061public override ConstantValue? ConstantValueOpt { get; } 2068public BoundConditionalOperator Update(bool isRef, BoundExpression condition, BoundExpression consequence, BoundExpression alternative, ConstantValue? constantValueOpt, TypeSymbol? naturalTypeOpt, bool wasTargetTyped, TypeSymbol type) 2863public BoundDefaultExpression(SyntaxNode syntax, BoundTypeExpression? targetType, ConstantValue? constantValueOpt, TypeSymbol type, bool hasErrors = false) 2875public override ConstantValue? ConstantValueOpt { get; } 2880public BoundDefaultExpression Update(BoundTypeExpression? targetType, ConstantValue? constantValueOpt, TypeSymbol type) 2966public BoundSizeOfOperator(SyntaxNode syntax, BoundTypeExpression sourceType, ConstantValue? constantValueOpt, TypeSymbol type, bool hasErrors = false) 2979public override ConstantValue? ConstantValueOpt { get; } 2984public BoundSizeOfOperator Update(BoundTypeExpression sourceType, ConstantValue? constantValueOpt, TypeSymbol type) 2998public BoundConversion(SyntaxNode syntax, BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, InConversionGroupFlags inConversionGroupFlags, TypeSymbol type, bool hasErrors = false) 3025public override ConstantValue? ConstantValueOpt { get; } 3032public BoundConversion Update(BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, InConversionGroupFlags inConversionGroupFlags, TypeSymbol type) 3856public BoundSwitchDispatch(SyntaxNode syntax, BoundExpression expression, ImmutableArray<(ConstantValue value, LabelSymbol label)> cases, LabelSymbol defaultLabel, LengthBasedStringSwitchData? lengthBasedStringSwitchDataOpt, bool hasErrors = false) 3871public ImmutableArray<(ConstantValue value, LabelSymbol label)> Cases { get; } 3878public BoundSwitchDispatch Update(BoundExpression expression, ImmutableArray<(ConstantValue value, LabelSymbol label)> cases, LabelSymbol defaultLabel, LengthBasedStringSwitchData? lengthBasedStringSwitchDataOpt) 4339public BoundLiteral(SyntaxNode syntax, ConstantValue? constantValueOpt, TypeSymbol? type, bool hasErrors) 4345public BoundLiteral(SyntaxNode syntax, ConstantValue? constantValueOpt, TypeSymbol? type) 4351public override ConstantValue? ConstantValueOpt { get; } 4356public BoundLiteral Update(ConstantValue? constantValueOpt, TypeSymbol? type) 4544public BoundLocal(SyntaxNode syntax, LocalSymbol localSymbol, BoundLocalDeclarationKind declarationKind, ConstantValue? constantValueOpt, bool isNullableUnknown, TypeSymbol type, bool hasErrors) 4557public BoundLocal(SyntaxNode syntax, LocalSymbol localSymbol, BoundLocalDeclarationKind declarationKind, ConstantValue? constantValueOpt, bool isNullableUnknown, TypeSymbol type) 4573public override ConstantValue? ConstantValueOpt { get; } 4579public BoundLocal Update(LocalSymbol localSymbol, BoundLocalDeclarationKind declarationKind, ConstantValue? constantValueOpt, bool isNullableUnknown, TypeSymbol type) 5355public BoundDagValueTest(SyntaxNode syntax, ConstantValue value, BoundDagTemp input, bool hasErrors = false) 5365public ConstantValue Value { get; } 5370public BoundDagValueTest Update(ConstantValue value, BoundDagTemp input) 5384public BoundDagRelationalTest(SyntaxNode syntax, BinaryOperatorKind operatorKind, ConstantValue value, BoundDagTemp input, bool hasErrors = false) 5396public ConstantValue Value { get; } 5401public BoundDagRelationalTest Update(BinaryOperatorKind operatorKind, ConstantValue value, BoundDagTemp input) 6416public BoundObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<MethodSymbol> constructorsGroup, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ConstantValue? constantValueOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, bool wasTargetTyped, TypeSymbol type, bool hasErrors = false) 6446public override ConstantValue? ConstantValueOpt { get; } 6453public BoundObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<MethodSymbol> constructorsGroup, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ConstantValue? constantValueOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, bool wasTargetTyped, TypeSymbol type) 7374public BoundFieldAccess(SyntaxNode syntax, BoundExpression? receiverOpt, FieldSymbol fieldSymbol, ConstantValue? constantValueOpt, LookupResultKind resultKind, bool isByValue, bool isDeclaration, TypeSymbol type, bool hasErrors = false) 7392public override ConstantValue? ConstantValueOpt { get; } 7400public BoundFieldAccess Update(BoundExpression? receiverOpt, FieldSymbol fieldSymbol, ConstantValue? constantValueOpt, LookupResultKind resultKind, bool isByValue, bool isDeclaration, TypeSymbol type) 7860public BoundNameOfOperator(SyntaxNode syntax, BoundExpression argument, ConstantValue constantValueOpt, TypeSymbol type, bool hasErrors = false) 7878public override ConstantValue ConstantValueOpt { get; } 7883public BoundNameOfOperator Update(BoundExpression argument, ConstantValue constantValueOpt, TypeSymbol type) 7897protected BoundInterpolatedStringBase(BoundKind kind, SyntaxNode syntax, ImmutableArray<BoundExpression> parts, ConstantValue? constantValueOpt, TypeSymbol? type, bool hasErrors = false) 7908public override ConstantValue? ConstantValueOpt { get; } 7913public BoundUnconvertedInterpolatedString(SyntaxNode syntax, ImmutableArray<BoundExpression> parts, ConstantValue? constantValueOpt, TypeSymbol? type, bool hasErrors = false) 7925public BoundUnconvertedInterpolatedString Update(ImmutableArray<BoundExpression> parts, ConstantValue? constantValueOpt, TypeSymbol? type) 7939public BoundInterpolatedString(SyntaxNode syntax, InterpolatedStringHandlerData? interpolationData, ImmutableArray<BoundExpression> parts, ConstantValue? constantValueOpt, TypeSymbol? type, bool hasErrors = false) 7953public BoundInterpolatedString Update(InterpolatedStringHandlerData? interpolationData, ImmutableArray<BoundExpression> parts, ConstantValue? constantValueOpt, TypeSymbol? type) 8144public BoundConstantPattern(SyntaxNode syntax, BoundExpression value, ConstantValue constantValue, UnionMatchingMode unionMatchingMode, TypeSymbol inputType, TypeSymbol narrowedType, bool hasErrors = false) 8163public ConstantValue ConstantValue { get; } 8169public BoundConstantPattern Update(BoundExpression value, ConstantValue constantValue, UnionMatchingMode unionMatchingMode, TypeSymbol inputType, TypeSymbol narrowedType) 8705public BoundRelationalPattern(SyntaxNode syntax, BinaryOperatorKind relation, BoundExpression value, ConstantValue constantValue, bool isUnionMatching, TypeSymbol inputType, TypeSymbol narrowedType, bool hasErrors = false) 8726public ConstantValue ConstantValue { get; } 8732public BoundRelationalPattern Update(BinaryOperatorKind relation, BoundExpression value, ConstantValue constantValue, bool isUnionMatching, TypeSymbol inputType, TypeSymbol narrowedType)
Lowering\DiagnosticsPass_Warnings.cs (4)
391private void CheckVacuousComparisons(BoundBinaryOperator tree, ConstantValue constantValue, BoundNode operand) 547ConstantValue constVal = GetConstantValueForBitwiseOrCheck(leftOperand); 571private static ConstantValue GetConstantValueForBitwiseOrCheck(BoundExpression operand) 585ConstantValue constVal = operand.ConstantValueOpt;
Lowering\Extensions.cs (1)
80if ((object)expr.Type == null && expr.ConstantValueOpt == ConstantValue.Null)
Lowering\LocalRewriter\LocalRewriter_AsOperator.cs (1)
51ConstantValue constantValue = Binder.GetAsOperatorConstantResult(rewrittenOperand.Type, rewrittenType, conversion.Kind, rewrittenOperand.ConstantValueOpt);
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (49)
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) 633ConstantValue? constantLeft = loweredLeft.ConstantValueOpt ?? UnboxConstant(loweredLeft); 634if (testOperator == UnaryOperatorKind.DynamicFalse && constantLeft == ConstantValue.False || 635testOperator == UnaryOperatorKind.DynamicTrue && constantLeft == ConstantValue.True) 677bool leftTestIsConstantFalse = testOperator == UnaryOperatorKind.DynamicFalse && constantLeft == ConstantValue.True || 678testOperator == UnaryOperatorKind.DynamicTrue && constantLeft == ConstantValue.False; 719private static ConstantValue? UnboxConstant(BoundExpression expression) 757return new BoundUnaryOperator(syntax, UnaryOperatorKind.BoolLogicalNegation, converted, ConstantValue.NotAvailable, MethodSymbol.None, constrainedToTypeOpt: null, LookupResultKind.Viable, boolean) 835return MakeLiteral(syntax, ConstantValue.Create(kind.Operator() == BinaryOperatorKind.Equal), boolType); 862BoundExpression result = MakeLiteral(syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.NotEqual), boolType); 927return MakeLiteral(syntax, ConstantValue.Create(value), _compilation.GetSpecialType(SpecialType.System_Boolean)); 1123[NotNullWhen(returnValue: true)] ConstantValue? constantValue) 1280rewrittenAlternative: MakeLiteral(syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.Equal), boolType), 1648ConstantValue.NotAvailable, 1970return MakeLiteral(syntax, ConstantValue.Create(kind == BinaryOperatorKind.NullableNullEqual), returnType); 2009new BoundUnaryOperator(syntax, UnaryOperatorKind.BoolLogicalNegation, call, ConstantValue.NotAvailable, null, constrainedToTypeOpt: null, LookupResultKind.Viable, returnType); 2016if (oldNode != null && (loweredLeft.ConstantValueOpt == ConstantValue.Null || loweredRight.ConstantValueOpt == ConstantValue.Null)) 2110return MakeLiteral(syntax, ConstantValue.Create(rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType); 2112return MakeLiteral(syntax, ConstantValue.Create(!rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType); 2135MakeLiteral(syntax, ConstantValue.Null, objectType), 2155ConstantValue? rightConstantValue = loweredRight.ConstantValueOpt; 2168loweredRight = MakeLiteral(rightSyntax, ConstantValue.Create(shiftAmount), rightType); 2181MakeLiteral(rightSyntax, ConstantValue.Create(rightMask), rightType), 2227ConstantValue? rightConstantValue = loweredRight.ConstantValueOpt; 2301ConstantValue.NotAvailable, 2359var constVal = numericOperand.ConstantValueOpt; 2370var constVal = numericOperand.ConstantValueOpt;
Lowering\LocalRewriter\LocalRewriter_Call.cs (1)
1500ConstantValue.Create(0),
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (1)
858ConstantValue.Create(knownLength),
Lowering\LocalRewriter\LocalRewriter_ConditionalOperator.cs (4)
47ConstantValue? constantValueOpt, 51ConstantValue? conditionConstantValue = rewrittenCondition.ConstantValueOpt; 52if (conditionConstantValue == ConstantValue.True) 56else if (conditionConstantValue == ConstantValue.False)
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (9)
267ConstantValue? constantValueOpt, 303ConstantValue? constantValueOpt, 862ConstantValue? constantValueOpt = null) 1395MakeConversionNode(null, syntax, conditional.Consequence, conversion, @checked, explicitCastInCode: false, constantValueOpt: ConstantValue.NotAvailable, rewrittenType: type), 1396MakeConversionNode(null, syntax, conditional.Alternative, conversion, @checked, explicitCastInCode: false, constantValueOpt: ConstantValue.NotAvailable, rewrittenType: type), 1397ConstantValue.NotAvailable, 1599ConstantValue? constantValueOpt, 1809private BoundExpression RewriteDecimalConversion(SyntaxNode syntax, BoundExpression operand, TypeSymbol fromType, TypeSymbol toType, bool @checked, bool isImplicit, ConstantValue? constantValueOpt) 1840private BoundExpression RewriteDecimalConversionCore(SyntaxNode syntax, BoundExpression operand, TypeSymbol fromType, TypeSymbol toType, bool isImplicit, ConstantValue? constantValueOpt)
Lowering\LocalRewriter\LocalRewriter_Event.cs (1)
223ConstantValue? constantValueOpt,
Lowering\LocalRewriter\LocalRewriter_Field.cs (1)
21ConstantValue? constantValueOpt,
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (1)
572new BoundConditionalOperator(factory.Syntax, false, condition, consequenceAssignment, alternativeAssignment, ConstantValue.NotAvailable, localType, wasTargetTyped: false, localType));
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (6)
464right: MakeLiteral(forEachSyntax, constantValue: ConstantValue.Null, type: null), 645MakeLiteral(forEachSyntax, ConstantValue.Default(SpecialType.System_Int32), intType)); 934MakeLiteral(forEachSyntax, ConstantValue.Default(SpecialType.System_Int32), intType)); 1097constantValue: ConstantValue.Create(dimension, ConstantValueTypeDiscriminator.Int32), 1151constantValue: ConstantValue.Create(dimension, ConstantValueTypeDiscriminator.Int32), 1264constantValue: ConstantValue.Create(1),
Lowering\LocalRewriter\LocalRewriter_Index.cs (1)
18BoundExpression fromEnd = MakeLiteral(node.Syntax, ConstantValue.Create(true), booleanType);
Lowering\LocalRewriter\LocalRewriter_IsOperator.cs (6)
40return RewriteConstantIsOperator(receiver.Syntax, receiver, ConstantValue.False, rewrittenType); 44return MakeLiteral(syntax, ConstantValue.False, rewrittenType); 58ConstantValue constantValue = Binder.GetIsOperatorConstantResult(operandType, targetType, conversionKind, rewrittenOperand.ConstantValueOpt); 83ConstantValue constantValue, 86Debug.Assert(constantValue == ConstantValue.True || constantValue == ConstantValue.False);
Lowering\LocalRewriter\LocalRewriter_Literal.cs (14)
23private BoundExpression MakeLiteral(SyntaxNode syntax, ConstantValue constantValue, TypeSymbol? type, BoundLiteral? oldNodeOpt = null) 51private BoundExpression MakeDecimalLiteral(SyntaxNode syntax, ConstantValue constantValue) 100arguments.Add(new BoundLiteral(syntax, ConstantValue.Create((int)value), _compilation.GetSpecialType(SpecialType.System_Int32))); 106arguments.Add(new BoundLiteral(syntax, ConstantValue.Create((uint)value), _compilation.GetSpecialType(SpecialType.System_UInt32))); 112arguments.Add(new BoundLiteral(syntax, ConstantValue.Create((long)value), _compilation.GetSpecialType(SpecialType.System_Int64))); 118arguments.Add(new BoundLiteral(syntax, ConstantValue.Create((ulong)value), _compilation.GetSpecialType(SpecialType.System_UInt64))); 124arguments.Add(new BoundLiteral(syntax, ConstantValue.Create(low), _compilation.GetSpecialType(SpecialType.System_Int32))); 125arguments.Add(new BoundLiteral(syntax, ConstantValue.Create(mid), _compilation.GetSpecialType(SpecialType.System_Int32))); 126arguments.Add(new BoundLiteral(syntax, ConstantValue.Create(high), _compilation.GetSpecialType(SpecialType.System_Int32))); 127arguments.Add(new BoundLiteral(syntax, ConstantValue.Create(isNegative), _compilation.GetSpecialType(SpecialType.System_Boolean))); 128arguments.Add(new BoundLiteral(syntax, ConstantValue.Create(scale), _compilation.GetSpecialType(SpecialType.System_Byte))); 142private BoundExpression MakeDateTimeLiteral(SyntaxNode syntax, ConstantValue constantValue) 148arguments.Add(new BoundLiteral(syntax, ConstantValue.Create(constantValue.DateTimeValue.Ticks), _compilation.GetSpecialType(SpecialType.System_Int64))); 159constantValueOpt: ConstantValue.NotAvailable, initializerExpressionOpt: null, type: ctor.ContainingType);
Lowering\LocalRewriter\LocalRewriter_LockStatement.cs (2)
35Debug.Assert(rewrittenArgument.ConstantValueOpt == ConstantValue.Null); 145MakeLiteral(rewrittenArgument.Syntax, ConstantValue.False, boolType),
Lowering\LocalRewriter\LocalRewriter_PreviousSubmissionReference.cs (1)
24return new BoundFieldAccess(syntax, thisReference, targetScriptReference, ConstantValue.NotAvailable);
Lowering\LocalRewriter\LocalRewriter_StackAlloc.cs (2)
119var sizeConst = sizeOfExpression.ConstantValueOpt; 126var countConst = countExpression.ConstantValueOpt;
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (3)
320var constantValue = followingArgument.ConstantValueOpt; 323followingArgument = _factory.StringLiteral(ConstantValue.CreateFromRope(Rope.Concat(current, next))); 332static Rope getRope(ConstantValue constantValue)
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (5)
209return new BoundLiteral(expr.Syntax, ConstantValue.Null, expr.Type); 264return new BoundLiteral(left.Syntax, ConstantValue.Create(nullnull.Kind == BinaryOperatorKind.Equal), boolType); 324if (rightHasValue.ConstantValueOpt == ConstantValue.False) 332if (leftHasValue.ConstantValueOpt == ConstantValue.False) 576return new BoundLiteral(left.Syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.Equal), boolType);
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (17)
90var constant = UnboxConstant(loweredOperand); 91if (constant == ConstantValue.True || constant == ConstantValue.False) 343ConstantValue.NotAvailable, 900(TypeSymbol binaryOperandType, ConstantValue constantOne) = GetConstantOneForIncrement(_compilation, binaryOperatorKind); 1013return RewriteConditionalOperator(syntax, condition, consequence, alternative, ConstantValue.NotAvailable, operand.Type, isRef: false); 1245private static (TypeSymbol, ConstantValue) GetConstantOneForIncrement( 1249ConstantValue constantOne; 1254constantOne = ConstantValue.Create(1); 1257constantOne = ConstantValue.Create(1U); 1260constantOne = ConstantValue.Create(1L); 1263constantOne = ConstantValue.Create(1LU); 1266constantOne = ConstantValue.Create(1); 1269constantOne = ConstantValue.Create(1U); 1272constantOne = ConstantValue.Create(1f); 1275constantOne = ConstantValue.Create(1.0); 1278constantOne = ConstantValue.Create(1m);
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (2)
128if (rewrittenExpression.ConstantValueOpt == ConstantValue.Null) 230if (boundLocal.ConstantValueOpt == ConstantValue.Null)
Lowering\LocalRewriter\LocalRewriter.cs (2)
261ConstantValue? constantValue = node.ConstantValueOpt; 323var result = new BoundFieldAccess(node.Syntax, new BoundThisReference(node.Syntax, primaryCtor.ContainingType), field, ConstantValue.NotAvailable, LookupResultKind.Viable, node.Type);
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (20)
589var cases = ArrayBuilder<(ConstantValue value, LabelSymbol label)>.GetInstance(); 620ImmutableArray<(ConstantValue value, LabelSymbol label)> cases, 643(ImmutableArray<(ConstantValue value, LabelSymbol label)> whenTrueCases, ImmutableArray<(ConstantValue value, LabelSymbol label)> whenFalseCases) 644splitCases(ImmutableArray<(ConstantValue value, LabelSymbol label)> cases, BinaryOperatorKind op, ConstantValue value) 646var whenTrueBuilder = ArrayBuilder<(ConstantValue value, LabelSymbol label)>.GetInstance(); 647var whenFalseBuilder = ArrayBuilder<(ConstantValue value, LabelSymbol label)>.GetInstance(); 704private sealed class CasesComparer : IComparer<(ConstantValue value, LabelSymbol label)> 713int IComparer<(ConstantValue value, LabelSymbol label)>.Compare((ConstantValue value, LabelSymbol label) left, (ConstantValue value, LabelSymbol label) right) 715var x = left.value; 716var y = right.value; 736static bool isNaN(ConstantValue value) => 787ImmutableArray<(ConstantValue value, LabelSymbol label)> cases; 797cases = node.Cases.SelectAsArray(p => (ConstantValue.Create((long)p.value.Int32Value), p.label)); 807cases = node.Cases.SelectAsArray(p => (ConstantValue.Create((ulong)p.value.UInt32Value), p.label)); 1017if (whenExpression is not null && whenExpression.ConstantValueOpt != ConstantValue.True) 1169if (whenClause.WhenExpression != null && whenClause.WhenExpression.ConstantValueOpt != ConstantValue.True)
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.ValueDispatchNode.cs (6)
38public readonly ImmutableArray<(ConstantValue value, LabelSymbol label)> Cases; 40public SwitchDispatch(SyntaxNode syntax, ImmutableArray<(ConstantValue value, LabelSymbol label)> dispatches, LabelSymbol otherwise) : base(syntax) 80public readonly ConstantValue Value; 86private RelationalDispatch(SyntaxNode syntax, ConstantValue value, BinaryOperatorKind op, ValueDispatchNode left, ValueDispatchNode right) : base(syntax) 133public static ValueDispatchNode CreateBalanced(SyntaxNode syntax, ConstantValue value, BinaryOperatorKind op, ValueDispatchNode whenTrue, ValueDispatchNode whenFalse) 140private static ValueDispatchNode CreateBalancedCore(SyntaxNode syntax, ConstantValue value, BinaryOperatorKind op, ValueDispatchNode left, ValueDispatchNode right)
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (4)
408_factory.Convert(operandType, new BoundLiteral(syntax, ConstantValue.Null, objectType), Conversion.NullToPointer), 416protected BoundExpression MakeValueTest(SyntaxNode syntax, BoundExpression input, ConstantValue value) 430protected BoundExpression MakeRelationalTest(SyntaxNode syntax, BoundExpression input, BinaryOperatorKind operatorKind, ConstantValue value) 466private BoundExpression MakeSpanStringTest(BoundExpression input, ConstantValue value)
Lowering\StateMachineRewriter\ResumableStateMachineStateAllocator.cs (1)
98f.StringLiteral(ConstantValue.Create(errorCode.GetExceptionMessage())),
Lowering\SyntheticBoundNodeFactory.cs (21)
256return new BoundFieldAccess(Syntax, receiver, f, ConstantValue.NotAvailable, LookupResultKind.Viable, f.Type) { WasCompilerGenerated = true }; 581expression = BoundConversion.Synthesized(Syntax, expression, conversion, false, explicitCastInCode: false, conversionGroupOpt: null, InConversionGroupFlags.Unspecified, ConstantValue.NotAvailable, CurrentFunction.ReturnType); 650return new BoundBinaryOperator(this.Syntax, kind, ConstantValue.NotAvailable, methodOpt: null, constrainedToTypeOpt: null, LookupResultKind.Viable, left, right, type) { WasCompilerGenerated = true }; 744return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Byte)) { WasCompilerGenerated = true }; 749return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Int32)) { WasCompilerGenerated = true }; 757return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_UInt32)) { WasCompilerGenerated = true }; 760public BoundLiteral Literal(ConstantValue value, TypeSymbol type) 1115var caseBuilder = ArrayBuilder<(ConstantValue Value, LabelSymbol label)>.GetInstance(); 1126caseBuilder.Add((ConstantValue.Create(value), sectionLabel)); 1166return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean)) { WasCompilerGenerated = true }; 1171var stringConst = ConstantValue.Create(value); 1175public BoundLiteral StringLiteral(ConstantValue stringConst) 1183return StringLiteral(ConstantValue.Create(stringValue)); 1186public BoundLiteral CharLiteral(ConstantValue charConst) 1194return CharLiteral(ConstantValue.Create(charValue)); 1271BoundExpression nullLiteral = new BoundLiteral(syntax, ConstantValue.Null, type) { WasCompilerGenerated = true }; 1782return Literal(ConstantValue.Create(rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType); 1784return Literal(ConstantValue.Create(rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType); 1804return RewriteNullableNullEquality(syntax, operatorKind, rewrittenExpr, Literal(ConstantValue.Null, objectType), boolType); 1889new BoundUnaryOperator(syntax, UnaryOperatorKind.BoolLogicalNegation, call, ConstantValue.NotAvailable, methodOpt: null, constrainedToTypeOpt: null, LookupResultKind.Viable, returnType);
Operations\CSharpOperationFactory.cs (21)
306ConstantValue? constantValue = (boundNode as BoundExpression)?.ConstantValueOpt; 452ConstantValue? constantValue = boundCall.ConstantValueOpt; 565ConstantValue? constantValue = boundLocal.ConstantValueOpt; 585ConstantValue? constantValue = boundFieldAccess.ConstantValueOpt; 685ConstantValue? constantValue = boundLiteral.ConstantValueOpt; 715ConstantValue? constantValue = boundObjectCreationExpression.ConstantValueOpt; 945ConstantValue? constantValue = boundCollectionElementInitializer.ConstantValueOpt; 1155ConstantValue? constantValue = boundConversion.ConstantValueOpt; 1229ConstantValue? constantValue = boundSizeOfOperator.ConstantValueOpt; 1362ConstantValue? constantValue = boundDefaultLiteral.ConstantValueOpt; 1371ConstantValue? constantValue = ((BoundExpression)boundDefaultExpression).ConstantValueOpt; 1414ConstantValue? constantValue = boundAssignmentOperator.ConstantValueOpt; 1513ConstantValue? constantValue = boundUnaryOperator.ConstantValueOpt; 1567ConstantValue? constantValue = boundBinaryOperator.ConstantValueOpt; 1590ConstantValue? constantValue = boundBinaryOperator.ConstantValueOpt; 1646ConstantValue? constantValue = boundConditionalOperator.ConstantValueOpt; 1657ConstantValue? constantValue = boundNullCoalescingOperator.ConstantValueOpt; 1739ConstantValue constantValue = boundNameOfOperator.ConstantValueOpt; 1899ConstantValue? constantValue = null; 2332ConstantValue? constantValue = boundInterpolatedString.ConstantValueOpt; 2966var constantValue = field.GetConstantValue(ConstantFieldsInProgress.Empty, earlyDecodingWellKnownAttributes: false);
Symbols\AnonymousTypes\AnonymousTypeField.cs (2)
27public readonly ConstantValue? DefaultValue; 42ConstantValue? defaultValue = null,
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.FieldSymbol.cs (1)
102internal override ConstantValue GetConstantValue(ConstantFieldsInProgress inProgress, bool earlyDecodingWellKnownAttributes)
Symbols\ConstantValueUtils.cs (9)
17public readonly ConstantValue Value; 20public EvaluatedConstant(ConstantValue value, ReadOnlyBindingDiagnostic<AssemblySymbol> diagnostics) 29public static ConstantValue EvaluateFieldConstant( 49var value = GetAndValidateConstantValue(boundValue.Value, symbol, symbol.Type, equalsValueNode.Value, diagnostics); 78internal static ConstantValue GetAndValidateConstantValue( 85var value = ConstantValue.Bad; 106var constantValue = boundValue.ConstantValueOpt; 108var unconvertedConstantValue = unconvertedBoundValue.ConstantValueOpt;
Symbols\FieldSymbol.cs (3)
158ConstantValue constantValue = GetConstantValue(ConstantFieldsInProgress.Empty, earlyDecodingWellKnownAttributes: false); 176ConstantValue constantValue = GetConstantValue(ConstantFieldsInProgress.Empty, earlyDecodingWellKnownAttributes: false); 181internal abstract ConstantValue GetConstantValue(ConstantFieldsInProgress inProgress, bool earlyDecodingWellKnownAttributes);
Symbols\FunctionPointers\FunctionPointerParameterSymbol.cs (2)
83internal override ConstantValue? ExplicitDefaultConstantValue => null; 84internal override ConstantValue? DefaultValueFromAttributes => null;
Symbols\LocalSymbol.cs (3)
340ConstantValue constantValue = this.GetConstantValue(null, null, null); 358ConstantValue constantValue = this.GetConstantValue(null, null, null); 371internal abstract ConstantValue GetConstantValue(SyntaxNode node, LocalSymbol inProgress, BindingDiagnosticBag diagnostics = null);
Symbols\Metadata\PE\PEFieldSymbol.cs (8)
143private ConstantValue _lazyConstantValue = Microsoft.CodeAnalysis.ConstantValue.Unset; // Indicates an uninitialized ConstantValue 504internal override ConstantValue GetConstantValue(ConstantFieldsInProgress inProgress, bool earlyDecodingWellKnownAttributes) 506if (_lazyConstantValue == Microsoft.CodeAnalysis.ConstantValue.Unset) 508ConstantValue value = null; 519ConstantValue defaultValue; 530Microsoft.CodeAnalysis.ConstantValue.Unset); 652ConstantValue value;
Symbols\Metadata\PE\PEParameterSymbol.cs (13)
161private ConstantValue? _lazyDefaultValue = ConstantValue.Unset; 273_lazyDefaultValue = ConstantValue.NotAvailable; 551internal ConstantValue? ImportConstantValue(bool ignoreAttributes = false) 558ConstantValue? value = null; 573internal sealed override ConstantValue? ExplicitDefaultConstantValue 578if (_lazyDefaultValue == ConstantValue.Unset) 583ConstantValue? value = ImportConstantValue(ignoreAttributes: !IsMetadataOptional); 584Interlocked.CompareExchange(ref _lazyDefaultValue, value, ConstantValue.Unset); 591internal sealed override ConstantValue? DefaultValueFromAttributes => null; 593private ConstantValue? GetDefaultDecimalOrDateTimeValue() 596ConstantValue? value = null; 1142ConstantValue defaultValue = this.ExplicitDefaultConstantValue;
Symbols\ParameterSymbol.cs (2)
256internal abstract ConstantValue? ExplicitDefaultConstantValue { get; } 263internal abstract ConstantValue? DefaultValueFromAttributes { get; }
Symbols\ReducedExtensionMethodSymbol.cs (2)
145var thisArgumentValue = new BoundLiteral(syntax, ConstantValue.Bad, thisType) { WasCompilerGenerated = true }; 147var otherArgumentValue = new BoundLiteral(syntax, ConstantValue.Bad, otherArgumentType) { WasCompilerGenerated = true };
Symbols\SignatureOnlyParameterSymbol.cs (2)
79internal override ConstantValue ExplicitDefaultConstantValue { get { throw ExceptionUtilities.Unreachable(); } } 81internal override ConstantValue DefaultValueFromAttributes { get { throw ExceptionUtilities.Unreachable(); } }
Symbols\Source\FieldSymbolWithAttributesAndModifiers.cs (4)
271private void VerifyConstantValueMatches(ConstantValue attrValue, ref DecodeWellKnownAttributeArguments<AttributeSyntax, CSharpAttributeData, AttributeLocation> arguments) 276ConstantValue constValue; 295if (data.ConstValue == CodeAnalysis.ConstantValue.Unset) 304if (constValue != CodeAnalysis.ConstantValue.Unset)
Symbols\Source\GlobalExpressionVariable.cs (1)
64protected override ConstantValue MakeConstantValue(
Symbols\Source\SourceClonedParameterSymbol.cs (2)
75internal override ConstantValue? ExplicitDefaultConstantValue 84internal override ConstantValue? DefaultValueFromAttributes
Symbols\Source\SourceComplexParameterSymbol.cs (31)
40protected ConstantValue? _lazyDefaultSyntaxValue; 82_lazyDefaultSyntaxValue = ConstantValue.Unset; 94internal sealed override ConstantValue? ExplicitDefaultConstantValue 112internal sealed override ConstantValue? DefaultValueFromAttributes 117return (data != null && data.DefaultParameterValue != ConstantValue.Unset) ? data.DefaultParameterValue : null; 247private ConstantValue? DefaultSyntaxValue 255var previousValue = Interlocked.CompareExchange( 258ConstantValue.Unset); 259Debug.Assert(previousValue == ConstantValue.Unset); 279DefaultValueFromAttributes == ConstantValue.NotAvailable) 338var defaultValue = DefaultValueFromAttributes; 367private ConstantValue? MakeDefaultExpression(BindingDiagnosticBag diagnostics, out Binder? binder, out BoundParameterEqualsValue? parameterEqualsValue) 394return ConstantValue.Bad; 401return ConstantValue.Bad; 418var value = convertedExpression.ConstantValueOpt ?? ConstantValue.Null; 739ConstantValue value; 742value = ConstantValue.Bad; 751if (paramData.DefaultParameterValue == ConstantValue.Unset) 925var value = DecodeDefaultParameterValueAttribute(description, attribute, syntax, diagnose: true, diagnosticsOpt: diagnostics); 943private void VerifyParamDefaultValueMatchesAttributeIfAny(ConstantValue value, SyntaxNode syntax, BindingDiagnosticBag diagnostics) 948var attrValue = data.DefaultParameterValue; 949if ((attrValue != ConstantValue.Unset) && 958private ConstantValue DecodeDefaultParameterValueAttribute(AttributeDescription description, CSharpAttributeData attribute, AttributeSyntax node, bool diagnose, BindingDiagnosticBag diagnosticsOpt) 977private ConstantValue DecodeDefaultParameterValueAttribute(CSharpAttributeData attribute, AttributeSyntax node, bool diagnose, BindingDiagnosticBag diagnosticsOpt) 988return ConstantValue.Bad; 1009var constantValueDiscriminator = ConstantValue.GetDiscriminator(specialType); 1026return ConstantValue.Bad; 1036return ConstantValue.Bad; 1047return ConstantValue.Bad; 1055return ConstantValue.Create(arg.ValueInternal, constantValueDiscriminator);
Symbols\Source\SourceEnumConstantSymbol.cs (9)
157protected override ConstantValue MakeConstantValue(HashSet<SourceFieldSymbolWithSyntaxReference> dependencies, bool earlyDecodingWellKnownAttributes, BindingDiagnosticBag diagnostics) 160return Microsoft.CodeAnalysis.ConstantValue.Default(constantType); 175protected override ConstantValue MakeConstantValue(HashSet<SourceFieldSymbolWithSyntaxReference> dependencies, bool earlyDecodingWellKnownAttributes, BindingDiagnosticBag diagnostics) 204protected override ConstantValue MakeConstantValue(HashSet<SourceFieldSymbolWithSyntaxReference> dependencies, bool earlyDecodingWellKnownAttributes, BindingDiagnosticBag diagnostics) 206var otherValue = _otherConstant.GetConstantValue(new ConstantFieldsInProgress(this, dependencies), earlyDecodingWellKnownAttributes); 209if (otherValue == Microsoft.CodeAnalysis.ConstantValue.Unset) 211return Microsoft.CodeAnalysis.ConstantValue.Unset; 215return Microsoft.CodeAnalysis.ConstantValue.Bad; 217ConstantValue value;
Symbols\Source\SourceFieldSymbol.cs (21)
175private ConstantValue _lazyConstantEarlyDecodingValue = Microsoft.CodeAnalysis.ConstantValue.Unset; 176private ConstantValue _lazyConstantValue = Microsoft.CodeAnalysis.ConstantValue.Unset; 237internal sealed override ConstantValue GetConstantValue(ConstantFieldsInProgress inProgress, bool earlyDecodingWellKnownAttributes) 239var value = this.GetLazyConstantValue(earlyDecodingWellKnownAttributes); 240if (value != Microsoft.CodeAnalysis.ConstantValue.Unset) 251return Microsoft.CodeAnalysis.ConstantValue.Unset; 282var value = this.GetLazyConstantValue(earlyDecodingWellKnownAttributes); 283if (value != Microsoft.CodeAnalysis.ConstantValue.Unset) 302(value != Microsoft.CodeAnalysis.ConstantValue.Unset) && 324if (this.GetLazyConstantValue(earlyDecodingWellKnownAttributes) != Microsoft.CodeAnalysis.ConstantValue.Unset) 336var value = MakeConstantValue(builder, earlyDecodingWellKnownAttributes, diagnostics); 346private ConstantValue GetLazyConstantValue(bool earlyDecodingWellKnownAttributes) 352ConstantValue value, 357Debug.Assert(value != Microsoft.CodeAnalysis.ConstantValue.Unset); 358Debug.Assert((GetLazyConstantValue(earlyDecodingWellKnownAttributes) == Microsoft.CodeAnalysis.ConstantValue.Unset) || 363Interlocked.CompareExchange(ref _lazyConstantEarlyDecodingValue, value, Microsoft.CodeAnalysis.ConstantValue.Unset); 367if (Interlocked.CompareExchange(ref _lazyConstantValue, value, Microsoft.CodeAnalysis.ConstantValue.Unset) == Microsoft.CodeAnalysis.ConstantValue.Unset) 381protected abstract ConstantValue MakeConstantValue(HashSet<SourceFieldSymbolWithSyntaxReference> dependencies, bool earlyDecodingWellKnownAttributes, BindingDiagnosticBag diagnostics);
Symbols\Source\SourceFixedFieldSymbol.cs (1)
98ConstantValue sizeConstant = ConstantValueUtils.GetAndValidateConstantValue(boundSizeExpression, this, intType, sizeExpression, diagnostics);
Symbols\Source\SourceLabelSymbol.cs (4)
21private readonly ConstantValue? _switchCaseLabelConstant; 29ConstantValue? switchCaseLabelConstant = null) 70ConstantValue switchCaseLabelConstant) 138public ConstantValue? SwitchCaseLabelConstant
Symbols\Source\SourceLocalSymbol.cs (5)
568internal override ConstantValue GetConstantValue(SyntaxNode node, LocalSymbol inProgress, BindingDiagnosticBag diagnostics) 675var value = Microsoft.CodeAnalysis.ConstantValue.Bad; 689internal override ConstantValue GetConstantValue(SyntaxNode node, LocalSymbol inProgress, BindingDiagnosticBag diagnostics = null) 698return Microsoft.CodeAnalysis.ConstantValue.Bad;
Symbols\Source\SourceMemberFieldSymbol.cs (4)
119var value = this.GetConstantValue(ConstantFieldsInProgress.Empty, earlyDecodingWellKnownAttributes: false); 127if (data == null || data.ConstValue == CodeAnalysis.ConstantValue.Unset) 166!(decodedData is FieldWellKnownAttributeData fieldData && fieldData.ConstValue != CodeAnalysis.ConstantValue.Unset)) 665protected sealed override ConstantValue MakeConstantValue(HashSet<SourceFieldSymbolWithSyntaxReference> dependencies, bool earlyDecodingWellKnownAttributes, BindingDiagnosticBag diagnostics)
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (1)
1227var receiverValue = new BoundLiteral(syntax, ConstantValue.Bad, receiverType) { WasCompilerGenerated = true };
Symbols\Source\SourceParameterSymbolBase.cs (3)
87var defaultValue = parameter.ExplicitDefaultConstantValue; 88if (defaultValue != ConstantValue.NotAvailable && 91sourceParameter.DefaultValueFromAttributes == ConstantValue.NotAvailable)
Symbols\Source\SourceSimpleParameterSymbol.cs (2)
48internal override ConstantValue? ExplicitDefaultConstantValue 160internal override ConstantValue? DefaultValueFromAttributes
Symbols\Source\ThisParameterSymbol.cs (2)
23internal sealed override ConstantValue? ExplicitDefaultConstantValue 28internal sealed override ConstantValue? DefaultValueFromAttributes
Symbols\Synthesized\SynthesizedBackingFieldSymbol.cs (1)
63internal override ConstantValue GetConstantValue(ConstantFieldsInProgress inProgress, bool earlyDecodingWellKnownAttributes)
Symbols\Synthesized\SynthesizedDelegateSymbol.cs (2)
35internal ParameterDescription(TypeWithAnnotations type, RefKind refKind, ScopedKind scope, ConstantValue? defaultValue, bool isParams, bool hasUnscopedRefAttribute) 48internal readonly ConstantValue? DefaultValue;
Symbols\Synthesized\SynthesizedFieldSymbolBase.cs (1)
137internal override ConstantValue GetConstantValue(ConstantFieldsInProgress inProgress, bool earlyDecodingWellKnownAttributes)
Symbols\Synthesized\SynthesizedIntrinsicOperatorSymbol.cs (1)
484internal override ConstantValue? DefaultValueFromAttributes => null;
Symbols\Synthesized\SynthesizedLocal.cs (1)
190internal sealed override ConstantValue GetConstantValue(SyntaxNode node, LocalSymbol inProgress, BindingDiagnosticBag diagnostics)
Symbols\Synthesized\SynthesizedParameterSymbol.cs (11)
83internal override ConstantValue? ExplicitDefaultConstantValue 206var defaultValue = this.ExplicitDefaultConstantValue; 207if (defaultValue != ConstantValue.NotAvailable && 208DefaultValueFromAttributes == ConstantValue.NotAvailable && 255internal override ConstantValue? DefaultValueFromAttributes => null; 264ConstantValue? defaultValue = null, 344private readonly ConstantValue? _defaultValue; 354ConstantValue? defaultValue, 417internal override ConstantValue? ExplicitDefaultConstantValue => _defaultValue; 419internal override ConstantValue? DefaultValueFromAttributes => _baseParameterForAttributes?.DefaultValueFromAttributes ?? ConstantValue.NotAvailable;
Symbols\Synthesized\TypeSubstitutedLocalSymbol.cs (1)
124internal override ConstantValue GetConstantValue(SyntaxNode node, LocalSymbol inProgress, BindingDiagnosticBag diagnostics)
Symbols\TypedConstantExtensions.cs (6)
56ConstantValue valueConstant = ConstantValue.Create(constant.ValueInternal, splType); 91ConstantValue memberConstant = ConstantValue.Create(field.ConstantValue, specialType); 169ConstantValue memberConstant = ConstantValue.Create(field.ConstantValue, specialType);
Symbols\TypeSymbolExtensions.cs (3)
661public static ConstantValue? GetDefaultValue(this TypeSymbol type) 678return ConstantValue.Null; 702return ConstantValue.Default(type.SpecialType);
Symbols\UpdatedContainingSymbolLocal.cs (1)
93internal override ConstantValue GetConstantValue(SyntaxNode node, LocalSymbol inProgress, BindingDiagnosticBag? diagnostics = null) =>
Symbols\Wrapped\WrappedFieldSymbol.cs (1)
181internal override ConstantValue GetConstantValue(ConstantFieldsInProgress inProgress, bool earlyDecodingWellKnownAttributes)
Symbols\Wrapped\WrappedParameterSymbol.cs (2)
76internal sealed override ConstantValue? ExplicitDefaultConstantValue 81internal sealed override ConstantValue? DefaultValueFromAttributes
Utilities\IConstantValueSetFactory.cs (4)
18IConstantValueSet Related(BinaryOperatorKind relation, ConstantValue value); 23bool Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right); 33ConstantValue RandomValue(Random random);
Utilities\IValueSet.cs (5)
42bool Any(BinaryOperatorKind relation, ConstantValue value); 46/// Because of that all four combinations of results from <see cref="Any(BinaryOperatorKind, ConstantValue)"/> and <see cref="All(BinaryOperatorKind, ConstantValue)"/> 51bool All(BinaryOperatorKind relation, ConstantValue value); 62ConstantValue? Sample { get; }
Utilities\TypeUnionValueSet.cs (5)
98ConstantValue? matches = DecisionDagBuilder.ExpressionOfTypeMatchesPatternTypeForLearningFromSuccessfulTypeTest(conversions, type, t.CaseType, ref useSiteInfo); 99if (matches == ConstantValue.False) 270ConstantValue? matches = DecisionDagBuilder.ExpressionOfTypeMatchesPatternTypeForLearningFromSuccessfulTypeTest(_conversions, t1, t2, ref useSiteInfo); 271if (matches == ConstantValue.False) 277else if (matches == ConstantValue.True)
Utilities\ValueSetFactory.BoolValueSet.cs (4)
41ConstantValue IConstantValueSet.Sample => ConstantValue.Create(_hasTrue ? true : _hasFalse ? false : throw new ArgumentException()); 56bool IConstantValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.BooleanValue); 71bool IConstantValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, value.BooleanValue);
Utilities\ValueSetFactory.BoolValueSetFactory.cs (5)
51ConstantValue IConstantValueSetFactory.RandomValue(Random random) => ConstantValue.Create(random.NextDouble() < 0.5); 53IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) 58bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.ByteTC.cs (3)
55byte INumericTC<byte>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? (byte)0 : constantValue.ByteValue; 57ConstantValue INumericTC<byte>.ToConstantValue(byte value) => ConstantValue.Create(value);
Utilities\ValueSetFactory.CharTC.cs (3)
49char INumericTC<char>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? (char)0 : constantValue.CharValue; 69ConstantValue INumericTC<char>.ToConstantValue(char value) => ConstantValue.Create(value);
Utilities\ValueSetFactory.DecimalTC.cs (3)
35public decimal FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? 0m : constantValue.DecimalValue; 37public ConstantValue ToConstantValue(decimal value) => ConstantValue.Create(value);
Utilities\ValueSetFactory.DecimalValueSetFactory.cs (5)
25ConstantValue IConstantValueSetFactory.RandomValue(Random random) => ConstantValue.Create(DecimalTC.Instance.Random(random)); 27IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 30bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right) => _underlying.Related(relation, left, right);
Utilities\ValueSetFactory.DoubleTC.cs (3)
83double INumericTC<double>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? 0.0 : constantValue.DoubleValue; 85ConstantValue INumericTC<double>.ToConstantValue(double value) => ConstantValue.Create(value);
Utilities\ValueSetFactory.EnumeratedValueSet.cs (3)
48ConstantValue IConstantValueSet.Sample 88bool IConstantValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, _tc.FromConstantValue(value)); 111bool IConstantValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value));
Utilities\ValueSetFactory.EnumeratedValueSetFactory.cs (4)
38IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 41bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right) 58ConstantValue IConstantValueSetFactory.RandomValue(Random random)
Utilities\ValueSetFactory.FloatingValueSet.cs (4)
51ConstantValue IConstantValueSet.Sample 60var sample = _numbers.Sample; 138bool IConstantValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => 148bool IConstantValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value));
Utilities\ValueSetFactory.FloatingValueSetFactory.cs (4)
30ConstantValue IConstantValueSetFactory.RandomValue(Random random) 35IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 40bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.IEqualableValueTC.cs (4)
18/// Get the constant value of type <typeparamref name="T"/> from a <see cref="ConstantValue"/>. This method is shared among all 21T FromConstantValue(ConstantValue constantValue); 24/// Translate a numeric value of type <typeparamref name="T"/> into a <see cref="ConstantValue"/>. 26ConstantValue ToConstantValue(T value);
Utilities\ValueSetFactory.IntTC.cs (3)
65public int FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? 0 : constantValue.Int32Value; 67public ConstantValue ToConstantValue(int value) => ConstantValue.Create(value);
Utilities\ValueSetFactory.INumericTC.cs (4)
18/// Get the constant value of type <typeparamref name="T"/> from a <see cref="ConstantValue"/>. This method is shared among all 21T FromConstantValue(ConstantValue constantValue); 24/// Translate a numeric value of type <typeparamref name="T"/> into a <see cref="ConstantValue"/>. 26ConstantValue ToConstantValue(T value);
Utilities\ValueSetFactory.LongTC.cs (3)
55long INumericTC<long>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? 0L : constantValue.Int64Value; 57ConstantValue INumericTC<long>.ToConstantValue(long value) => ConstantValue.Create(value);
Utilities\ValueSetFactory.NintValueSet.cs (3)
48ConstantValue? IConstantValueSet.Sample 74bool IConstantValueSet.All(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || All(relation, value.Int32Value); 85bool IConstantValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.Int32Value);
Utilities\ValueSetFactory.NintValueSetFactory.cs (5)
41ConstantValue IConstantValueSetFactory.RandomValue(Random random) => ConstantValue.CreateNativeInt(IntTC.DefaultInstance.Random(random)); 43IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) 48bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.NonNegativeIntValueSetFactory.cs (4)
55ConstantValue IConstantValueSetFactory.RandomValue(Random random) => s_underlying.RandomValue(random); 57IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 60bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right) => s_underlying.Related(relation, left, right);
Utilities\ValueSetFactory.NuintValueSet.cs (3)
39ConstantValue? IConstantValueSet.Sample 63bool IConstantValueSet.All(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || All(relation, value.UInt32Value); 72bool IConstantValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.UInt32Value);
Utilities\ValueSetFactory.NuintValueSetFactory.cs (5)
39ConstantValue IConstantValueSetFactory.RandomValue(Random random) => ConstantValue.CreateNativeUInt(UIntTC.Instance.Random(random)); 41IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) 46bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.NumericValueSet.cs (3)
56ConstantValue IConstantValueSet.Sample 107bool IConstantValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, _tc.FromConstantValue(value)); 129bool IConstantValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value));
Utilities\ValueSetFactory.NumericValueSetFactory.cs (4)
52IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 58ConstantValue IConstantValueSetFactory.RandomValue(Random random) 63bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.SByteTC.cs (3)
54sbyte INumericTC<sbyte>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? (sbyte)0 : constantValue.SByteValue; 56public ConstantValue ToConstantValue(sbyte value) => ConstantValue.Create(value);
Utilities\ValueSetFactory.ShortTC.cs (3)
55short INumericTC<short>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? (short)0 : constantValue.Int16Value; 57ConstantValue INumericTC<short>.ToConstantValue(short value) => ConstantValue.Create(value);
Utilities\ValueSetFactory.SingleTC.cs (3)
87float INumericTC<float>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? 0.0F : constantValue.SingleValue; 89ConstantValue INumericTC<float>.ToConstantValue(float value) => ConstantValue.Create(value);
Utilities\ValueSetFactory.StringTC.cs (3)
17string IEquatableValueTC<string>.FromConstantValue(ConstantValue constantValue) 44ConstantValue IEquatableValueTC<string>.ToConstantValue(string value) => ConstantValue.Create(value);
Utilities\ValueSetFactory.UIntTC.cs (3)
49public uint FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? (uint)0 : constantValue.UInt32Value; 51public ConstantValue ToConstantValue(uint value) => ConstantValue.Create(value);
Utilities\ValueSetFactory.ULongTC.cs (3)
55ulong INumericTC<ulong>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? 0UL : constantValue.UInt64Value; 57ConstantValue INumericTC<ulong>.ToConstantValue(ulong value) => ConstantValue.Create(value);
Utilities\ValueSetFactory.UShortTC.cs (3)
49ushort INumericTC<ushort>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? (ushort)0 : constantValue.UInt16Value; 51ConstantValue INumericTC<ushort>.ToConstantValue(ushort value) => ConstantValue.Create(value);