6 types derived from ConstantValue
Microsoft.CodeAnalysis (6)
ConstantValueSpecialized.cs (6)
28
private sealed class ConstantValueBad :
ConstantValue
68
private sealed class ConstantValueNull :
ConstantValue
134
private sealed class ConstantValueString :
ConstantValue
229
private sealed class ConstantValueDecimal :
ConstantValue
270
private sealed class ConstantValueDateTime :
ConstantValue
313
private abstract class ConstantValueDiscriminated :
ConstantValue
444 references to ConstantValue
Microsoft.CodeAnalysis (395)
CodeGen\ILBuilderEmit.cs (3)
230
KeyValuePair<
ConstantValue
, object>[] caseLabels,
261
KeyValuePair<
ConstantValue
, object>[] caseLabels,
566
internal void EmitConstantValue(
ConstantValue
value)
CodeGen\ITokenDeferral.cs (1)
22
Cci.IFieldReference GetArrayCachingFieldForConstants(ImmutableArray<
ConstantValue
> constants, Cci.IArrayTypeReference arrayType, SyntaxNode syntaxNode, DiagnosticBag diagnostics);
CodeGen\PrivateImplementationDetails.cs (9)
75
private readonly ConcurrentDictionary<(ImmutableArray<
ConstantValue
> Constants, ushort ElementType), CachedArrayField> _cachedArrayFieldsForConstants =
76
new ConcurrentDictionary<(ImmutableArray<
ConstantValue
> Constants, ushort ElementType), CachedArrayField>(ConstantValueAndUShortEqualityComparer.Instance);
215
internal Cci.IFieldReference CreateArrayCachingField(ImmutableArray<
ConstantValue
> constants, Cci.IArrayTypeReference arrayType, EmitContext emitContext)
458
private static string ConstantsToHex(ImmutableArray<
ConstantValue
> constants)
519
private sealed class ConstantValueAndUShortEqualityComparer : EqualityComparer<(ImmutableArray<
ConstantValue
> Constants, ushort Value)>
525
public override bool Equals((ImmutableArray<
ConstantValue
> Constants, ushort Value) x, (ImmutableArray<
ConstantValue
> Constants, ushort Value) y)
548
public override int GetHashCode((ImmutableArray<
ConstantValue
> Constants, ushort Value) obj)
551
foreach (
var
constant in obj.Constants)
CodeGen\SwitchIntegralJumpTableEmitter.cs (20)
40
private readonly ImmutableArray<KeyValuePair<
ConstantValue
, object>> _sortedCaseLabels;
51
KeyValuePair<
ConstantValue
, object>[] caseLabels,
109
if (sortedCaseLabels[0].Key !=
ConstantValue
.Null)
139
private static int CompareIntegralSwitchLabels(KeyValuePair<
ConstantValue
, object> first, KeyValuePair<
ConstantValue
, object> second)
141
ConstantValue
firstConstant = first.Key;
142
ConstantValue
secondConstant = second.Key;
296
ConstantValue
pivotConstant = switchBuckets[mid - 1].EndConstant;
327
ConstantValue
constant = c.Key;
364
ConstantValue
startConstant = switchBucket.StartConstant;
386
ConstantValue
caseLabelConstant = switchBucket[nextCaseIndex].Key;
414
private void EmitCondBranchForSwitch(ILOpCode branchCode,
ConstantValue
constant, object targetLabel)
430
private void EmitEqBranchForSwitch(
ConstantValue
constant, object targetLabel)
451
private void EmitRangeCheckedBranch(
ConstantValue
startConstant,
ConstantValue
endConstant, object targetLabel)
471
int Int32Value(
ConstantValue
value)
514
private void EmitNormalizedSwitchKey(
ConstantValue
startConstant,
ConstantValue
endConstant, object bucketFallThroughLabel)
535
private void EmitRangeCheckIfNeeded(
ConstantValue
startConstant,
ConstantValue
endConstant, object bucketFallThroughLabel)
CodeGen\SwitchIntegralJumpTableEmitter.SwitchBucket.cs (21)
18
private readonly ImmutableArray<KeyValuePair<
ConstantValue
, object>> _allLabels;
54
internal SwitchBucket(ImmutableArray<KeyValuePair<
ConstantValue
, object>> allLabels, int index)
62
private SwitchBucket(ImmutableArray<KeyValuePair<
ConstantValue
, object>> allLabels, int startIndex, int endIndex)
72
internal SwitchBucket(ImmutableArray<KeyValuePair<
ConstantValue
, object>> allLabels, int startIndex, int endIndex, bool isDegenerate)
91
internal KeyValuePair<
ConstantValue
, object> this[int i]
144
var
lastConst = this.StartConstant;
171
private bool IsContiguous(
ConstantValue
lastConst,
ConstantValue
nextConst)
181
private static ulong GetBucketSize(
ConstantValue
startConstant,
ConstantValue
endConstant)
203
private static bool BucketOverflowUInt64Limit(
ConstantValue
startConstant,
ConstantValue
endConstant)
223
private static bool BucketOverflow(
ConstantValue
startConstant,
ConstantValue
endConstant)
245
internal
ConstantValue
StartConstant
253
internal
ConstantValue
EndConstant
261
private static bool IsValidSwitchBucketConstant(
ConstantValue
constant)
269
private static bool IsValidSwitchBucketConstantPair(
ConstantValue
startConstant,
ConstantValue
endConstant)
284
var
startConstant = bucket1.StartConstant;
285
var
endConstant = bucket2.EndConstant;
CodeGen\SwitchStringJumpTableEmitter.cs (12)
16
using HashBucket = List<KeyValuePair<
ConstantValue
, object>>;
30
private readonly KeyValuePair<
ConstantValue
, object>[] _caseLabels;
43
public delegate void EmitStringCompareAndBranch(LocalOrParameter key,
ConstantValue
stringConstant, object targetLabel);
69
KeyValuePair<
ConstantValue
, object>[] caseLabels,
134
var jumpTableLabels = new KeyValuePair<
ConstantValue
, object>[count];
139
ConstantValue
hashConstant =
ConstantValue
.Create(hashValue);
142
jumpTableLabels[i] = new KeyValuePair<
ConstantValue
, object>(hashConstant, hashBucketLabel);
161
private void EmitNonHashTableSwitch(KeyValuePair<
ConstantValue
, object>[] labels)
172
private void EmitCondBranchForStringSwitch(
ConstantValue
stringConstant, object targetLabel)
184
KeyValuePair<
ConstantValue
, object>[] caseLabels,
192
ConstantValue
stringConstant = kvPair.Key;
Compilation\Compilation.cs (1)
1759
internal abstract IConvertibleConversion ClassifyConvertibleConversion(IOperation source, ITypeSymbol destination, out
ConstantValue
? constantValue);
Compilation\Expression.cs (15)
9
public static
ConstantValue
SynthesizeNumeric(ITypeSymbol type, int value)
14
return
ConstantValue
.Create(value);
16
return
ConstantValue
.Create((long)value);
18
return
ConstantValue
.Create((uint)value);
20
return
ConstantValue
.Create((ulong)value);
22
return
ConstantValue
.Create((ushort)value);
24
return
ConstantValue
.Create((short)value);
26
return
ConstantValue
.Create((sbyte)value);
28
return
ConstantValue
.Create((byte)value);
30
return
ConstantValue
.Create((char)value);
32
return
ConstantValue
.Create(value != 0);
34
return
ConstantValue
.Create((float)value);
36
return
ConstantValue
.Create((double)value);
38
return
ConstantValue
.Create(1, ConstantValueTypeDiscriminator.Int32);
46
return
ConstantValue
.Bad;
ConstantValue.cs (40)
39
internal abstract partial class ConstantValue : IEquatable<
ConstantValue
?>, IFormattable
89
public const
ConstantValue
NotAvailable = null;
91
public static
ConstantValue
Bad { get { return ConstantValueBad.Instance; } }
92
public static
ConstantValue
Null { get { return ConstantValueNull.Instance; } }
93
public static
ConstantValue
Nothing { get { return Null; } }
96
public static
ConstantValue
Unset { get { return ConstantValueNull.Uninitialized; } }
98
public static
ConstantValue
True { get { return ConstantValueOne.Boolean; } }
99
public static
ConstantValue
False { get { return ConstantValueDefault.Boolean; } }
101
public static
ConstantValue
Create(string? value)
111
internal static
ConstantValue
CreateFromRope(Rope value)
117
public static
ConstantValue
Create(char value)
131
public static
ConstantValue
Create(sbyte value)
145
public static
ConstantValue
Create(byte value)
159
public static
ConstantValue
Create(Int16 value)
173
public static
ConstantValue
Create(UInt16 value)
187
public static
ConstantValue
Create(Int32 value)
201
public static
ConstantValue
Create(UInt32 value)
215
public static
ConstantValue
Create(Int64 value)
229
public static
ConstantValue
Create(UInt64 value)
243
public static
ConstantValue
CreateNativeInt(Int32 value)
257
public static
ConstantValue
CreateNativeUInt(UInt32 value)
271
public static
ConstantValue
Create(bool value)
283
public static
ConstantValue
Create(float value)
297
public static
ConstantValue
CreateSingle(double value)
311
public static
ConstantValue
Create(double value)
325
public static
ConstantValue
Create(decimal value)
345
public static
ConstantValue
Create(DateTime value)
355
public static
ConstantValue
Create(object value, SpecialType st)
362
public static
ConstantValue
CreateSizeOf(SpecialType st)
365
return (size == 0) ?
ConstantValue
.NotAvailable :
ConstantValue
.Create(size);
368
public static
ConstantValue
Create(object value, ConstantValueTypeDiscriminator discriminator)
399
public static
ConstantValue
Default(SpecialType st)
406
public static
ConstantValue
Default(ConstantValueTypeDiscriminator discriminator)
864
public virtual bool Equals(
ConstantValue
? other)
879
public static bool operator ==(
ConstantValue
? left,
ConstantValue
? right)
894
public static bool operator !=(
ConstantValue
? left,
ConstantValue
? right)
906
return this.Equals(obj as
ConstantValue
);
ConstantValueSpecialized.cs (18)
48
public override bool Equals(
ConstantValue
? other)
105
public override bool Equals(
ConstantValue
? other)
205
public override bool Equals(
ConstantValue
? other)
264
public override bool Equals(
ConstantValue
? other)
305
public override bool Equals(
ConstantValue
? other)
426
public override bool Equals(
ConstantValue
? other)
454
public override bool Equals(
ConstantValue
? other)
477
public override bool Equals(
ConstantValue
? other)
500
public override bool Equals(
ConstantValue
? other)
652
public override bool Equals(
ConstantValue
? other)
670
public override bool Equals(
ConstantValue
? other)
723
public override bool Equals(
ConstantValue
? other)
780
public override bool Equals(
ConstantValue
? other)
823
public override bool Equals(
ConstantValue
? other)
866
public override bool Equals(
ConstantValue
? other)
910
public override bool Equals(
ConstantValue
? other)
944
public override bool Equals(
ConstantValue
? other)
990
public override bool Equals(
ConstantValue
? other)
CryptographicHashProvider.cs (3)
228
internal static ImmutableArray<byte> ComputeSourceHash(ImmutableArray<
ConstantValue
> constants, SourceHashAlgorithm hashAlgorithm = SourceHashAlgorithms.Default)
233
foreach (
var
constant in constants)
240
static byte[] getBytes(
ConstantValue
constant)
Emit\CommonPEModuleBuilder.cs (1)
1040
public Cci.IFieldReference GetArrayCachingFieldForConstants(ImmutableArray<
ConstantValue
> constants, Cci.IArrayTypeReference arrayType, SyntaxNode syntaxNode, DiagnosticBag diagnostics)
EnumConstantHelper.cs (11)
20
internal static EnumOverflowKind OffsetValue(
ConstantValue
constantValue, uint offset, out
ConstantValue
offsetValue)
25
offsetValue =
ConstantValue
.Bad;
36
offsetValue =
ConstantValue
.Create((sbyte)(previous + offset));
46
offsetValue =
ConstantValue
.Create((byte)(previous + offset));
56
offsetValue =
ConstantValue
.Create((short)(previous + offset));
66
offsetValue =
ConstantValue
.Create((ushort)(previous + offset));
76
offsetValue =
ConstantValue
.Create((int)(previous + offset));
86
offsetValue =
ConstantValue
.Create((uint)(previous + offset));
96
offsetValue =
ConstantValue
.Create((long)(previous + offset));
106
offsetValue =
ConstantValue
.Create((ulong)(previous + offset));
Generated\Operations.Generated.cs (143)
4051
internal override
ConstantValue
? OperationConstantValue => null;
4106
internal override
ConstantValue
? OperationConstantValue => null;
4176
internal override
ConstantValue
? OperationConstantValue => null;
4282
internal override
ConstantValue
? OperationConstantValue => null;
4374
internal override
ConstantValue
? OperationConstantValue => null;
4486
internal override
ConstantValue
? OperationConstantValue => null;
4510
internal override
ConstantValue
? OperationConstantValue => null;
4563
internal override
ConstantValue
? OperationConstantValue => null;
4583
internal override
ConstantValue
? OperationConstantValue => null;
4597
internal override
ConstantValue
? OperationConstantValue => null;
4649
internal override
ConstantValue
? OperationConstantValue => null;
4713
internal override
ConstantValue
? OperationConstantValue => null;
4792
internal override
ConstantValue
? OperationConstantValue => null;
4860
internal override
ConstantValue
? OperationConstantValue => null;
4911
internal override
ConstantValue
? OperationConstantValue => null;
4975
internal override
ConstantValue
? OperationConstantValue => null;
4989
internal override
ConstantValue
? OperationConstantValue => null;
5003
internal override
ConstantValue
? OperationConstantValue => null;
5069
internal override
ConstantValue
? OperationConstantValue => null;
5076
internal LiteralOperation(SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
5087
internal override
ConstantValue
? OperationConstantValue { get; }
5094
internal ConversionOperation(IOperation operand, IConvertibleConversion conversion, bool isTryCast, bool isChecked, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
5147
internal override
ConstantValue
? OperationConstantValue { get; }
5220
internal override
ConstantValue
? OperationConstantValue => null;
5287
internal override
ConstantValue
? OperationConstantValue => null;
5294
internal LocalReferenceOperation(ILocalSymbol local, bool isDeclaration, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
5309
internal override
ConstantValue
? OperationConstantValue { get; }
5328
internal override
ConstantValue
? OperationConstantValue => null;
5345
internal FieldReferenceOperation(IFieldSymbol field, bool isDeclaration, IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
5393
internal override
ConstantValue
? OperationConstantValue { get; }
5449
internal override
ConstantValue
? OperationConstantValue => null;
5518
internal override
ConstantValue
? OperationConstantValue => null;
5572
internal override
ConstantValue
? OperationConstantValue => null;
5579
internal UnaryOperation(UnaryOperatorKind operatorKind, IOperation operand, bool isLifted, bool isChecked, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
5635
internal override
ConstantValue
? OperationConstantValue { get; }
5642
internal 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)
5713
internal override
ConstantValue
? OperationConstantValue { get; }
5720
internal ConditionalOperation(IOperation condition, IOperation whenTrue, IOperation? whenFalse, bool isRef, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
5790
internal override
ConstantValue
? OperationConstantValue { get; }
5797
internal CoalesceOperation(IOperation value, IOperation whenNull, IConvertibleConversion valueConversion, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
5857
internal override
ConstantValue
? OperationConstantValue { get; }
5910
internal override
ConstantValue
? OperationConstantValue => null;
5917
internal ObjectCreationOperation(IMethodSymbol? constructor, IObjectOrCollectionInitializerOperation? initializer, ImmutableArray<IArgumentOperation> arguments, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
5980
internal override
ConstantValue
? OperationConstantValue { get; }
6032
internal override
ConstantValue
? OperationConstantValue => null;
6099
internal override
ConstantValue
? OperationConstantValue => null;
6118
internal override
ConstantValue
? OperationConstantValue => null;
6174
internal override
ConstantValue
? OperationConstantValue => null;
6226
internal override
ConstantValue
? OperationConstantValue => null;
6244
internal SimpleAssignmentOperation(bool isRef, IOperation target, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
6299
internal override
ConstantValue
? OperationConstantValue { get; }
6374
internal override
ConstantValue
? OperationConstantValue => null;
6381
internal ParenthesizedOperation(IOperation operand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
6427
internal override
ConstantValue
? OperationConstantValue { get; }
6492
internal override
ConstantValue
? OperationConstantValue => null;
6555
internal override
ConstantValue
? OperationConstantValue => null;
6572
internal override
ConstantValue
? OperationConstantValue => null;
6579
internal InterpolatedStringOperation(ImmutableArray<IInterpolatedStringContentOperation> parts, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
6629
internal override
ConstantValue
? OperationConstantValue { get; }
6685
internal override
ConstantValue
? OperationConstantValue => null;
6741
internal override
ConstantValue
? OperationConstantValue => null;
6804
internal override
ConstantValue
? OperationConstantValue => null;
6811
internal NameOfOperation(IOperation argument, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
6857
internal override
ConstantValue
? OperationConstantValue { get; }
6915
internal override
ConstantValue
? OperationConstantValue => null;
6973
internal override
ConstantValue
? OperationConstantValue => null;
7025
internal override
ConstantValue
? OperationConstantValue => null;
7077
internal override
ConstantValue
? OperationConstantValue => null;
7084
internal DefaultValueOperation(SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
7095
internal override
ConstantValue
? OperationConstantValue { get; }
7114
internal override
ConstantValue
? OperationConstantValue => null;
7121
internal SizeOfOperation(ITypeSymbol typeOperand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
7134
internal override
ConstantValue
? OperationConstantValue { get; }
7186
internal override
ConstantValue
? OperationConstantValue => null;
7249
internal override
ConstantValue
? OperationConstantValue => null;
7312
internal override
ConstantValue
? OperationConstantValue => null;
7364
internal override
ConstantValue
? OperationConstantValue => null;
7423
internal override
ConstantValue
? OperationConstantValue => null;
7475
internal override
ConstantValue
? OperationConstantValue => null;
7492
internal override
ConstantValue
? OperationConstantValue => null;
7554
internal override
ConstantValue
? OperationConstantValue => null;
7601
internal override
ConstantValue
? OperationConstantValue => null;
7652
internal override
ConstantValue
? OperationConstantValue => null;
7703
internal override
ConstantValue
? OperationConstantValue => null;
7758
internal override
ConstantValue
? OperationConstantValue => null;
7826
internal override
ConstantValue
? OperationConstantValue => null;
7907
internal override
ConstantValue
? OperationConstantValue => null;
7968
internal override
ConstantValue
? OperationConstantValue => null;
8045
internal override
ConstantValue
? OperationConstantValue => null;
8119
internal override
ConstantValue
? OperationConstantValue => null;
8143
internal override
ConstantValue
? OperationConstantValue => null;
8206
internal override
ConstantValue
? OperationConstantValue => null;
8268
internal override
ConstantValue
? OperationConstantValue => null;
8321
internal override
ConstantValue
? OperationConstantValue => null;
8372
internal override
ConstantValue
? OperationConstantValue => null;
8428
internal override
ConstantValue
? OperationConstantValue => null;
8501
internal override
ConstantValue
? OperationConstantValue => null;
8563
internal override
ConstantValue
? OperationConstantValue => null;
8585
internal override
ConstantValue
? OperationConstantValue => null;
8650
internal override
ConstantValue
? OperationConstantValue => null;
8717
internal override
ConstantValue
? OperationConstantValue => null;
8788
internal override
ConstantValue
? OperationConstantValue => null;
8807
internal override
ConstantValue
? OperationConstantValue => null;
8860
internal override
ConstantValue
? OperationConstantValue => null;
8867
internal FlowCaptureReferenceOperation(CaptureId id, bool isInitialization, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
8882
internal override
ConstantValue
? OperationConstantValue { get; }
8889
internal IsNullOperation(IOperation operand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit)
8935
internal override
ConstantValue
? OperationConstantValue { get; }
8952
internal override
ConstantValue
? OperationConstantValue => null;
8971
internal override
ConstantValue
? OperationConstantValue => null;
9030
internal override
ConstantValue
? OperationConstantValue => null;
9097
internal override
ConstantValue
? OperationConstantValue => null;
9154
internal override
ConstantValue
? OperationConstantValue => null;
9220
internal override
ConstantValue
? OperationConstantValue => null;
9296
internal override
ConstantValue
? OperationConstantValue => null;
9310
internal override
ConstantValue
? OperationConstantValue => null;
9379
internal override
ConstantValue
? OperationConstantValue => null;
9454
internal override
ConstantValue
? OperationConstantValue => null;
9516
internal override
ConstantValue
? OperationConstantValue => null;
9579
internal override
ConstantValue
? OperationConstantValue => null;
9643
internal override
ConstantValue
? OperationConstantValue => null;
9695
internal override
ConstantValue
? OperationConstantValue => null;
9714
internal override
ConstantValue
? OperationConstantValue => null;
9776
internal override
ConstantValue
? OperationConstantValue => null;
9831
internal override
ConstantValue
? OperationConstantValue => null;
9882
internal override
ConstantValue
? OperationConstantValue => null;
9946
internal override
ConstantValue
? OperationConstantValue => null;
9964
internal override
ConstantValue
? OperationConstantValue => null;
10017
internal override
ConstantValue
? OperationConstantValue => null;
10082
internal override
ConstantValue
? OperationConstantValue => null;
10149
internal override
ConstantValue
? OperationConstantValue => null;
10211
internal override
ConstantValue
? OperationConstantValue => null;
10263
internal override
ConstantValue
? OperationConstantValue => null;
10283
internal override
ConstantValue
? OperationConstantValue => null;
10350
internal override
ConstantValue
? OperationConstantValue => null;
10411
internal override
ConstantValue
? OperationConstantValue => null;
10464
internal override
ConstantValue
? OperationConstantValue => null;
10531
internal override
ConstantValue
? OperationConstantValue => null;
10550
internal override
ConstantValue
? OperationConstantValue => null;
10601
internal override
ConstantValue
? OperationConstantValue => null;
10664
internal override
ConstantValue
? OperationConstantValue => null;
10722
internal override
ConstantValue
? OperationConstantValue => null;
10778
internal override
ConstantValue
? OperationConstantValue => null;
MetadataReader\MetadataDecoder.cs (24)
987
internal void DecodeLocalConstantBlobOrThrow(ref BlobReader sigReader, out TypeSymbol type, out
ConstantValue
value)
1012
value =
ConstantValue
.Create(sigReader.ReadDecimal());
1016
value =
ConstantValue
.Create(sigReader.ReadDateTime());
1022
value = (type.IsReferenceType || type.TypeKind == TypeKind.Pointer || type.TypeKind == TypeKind.FunctionPointer) ?
ConstantValue
.Null :
ConstantValue
.Bad;
1026
value =
ConstantValue
.Bad;
1057
private static
ConstantValue
DecodePrimitiveConstantValue(ref BlobReader sigReader, SignatureTypeCode typeCode, out bool isEnumTypeCode)
1063
return
ConstantValue
.Create(sigReader.ReadBoolean());
1067
return
ConstantValue
.Create(sigReader.ReadChar());
1071
return
ConstantValue
.Create(sigReader.ReadSByte());
1075
return
ConstantValue
.Create(sigReader.ReadByte());
1079
return
ConstantValue
.Create(sigReader.ReadInt16());
1083
return
ConstantValue
.Create(sigReader.ReadUInt16());
1087
return
ConstantValue
.Create(sigReader.ReadInt32());
1091
return
ConstantValue
.Create(sigReader.ReadUInt32());
1095
return
ConstantValue
.Create(sigReader.ReadInt64());
1099
return
ConstantValue
.Create(sigReader.ReadUInt64());
1103
return
ConstantValue
.Create(sigReader.ReadSingle());
1107
return
ConstantValue
.Create(sigReader.ReadDouble());
1116
return
ConstantValue
.Bad;
1119
return
ConstantValue
.Null;
1124
return
ConstantValue
.Bad;
1127
return
ConstantValue
.Create(sigReader.ReadUTF16(sigReader.RemainingBytes));
1132
return
ConstantValue
.Null;
MetadataReader\PEModule.cs (27)
1575
internal bool HasDateTimeConstantAttribute(EntityHandle token, out
ConstantValue
defaultValue)
1584
defaultValue =
ConstantValue
.Bad;
1588
defaultValue =
ConstantValue
.Create(new DateTime(value));
1598
internal bool HasDecimalConstantAttribute(EntityHandle token, out
ConstantValue
defaultValue)
1604
defaultValue =
ConstantValue
.Create(value);
3575
internal
ConstantValue
GetParamDefaultValue(ParameterHandle param)
3584
return constantHandle.IsNil ?
ConstantValue
.Bad : GetConstantValueOrThrow(constantHandle);
3588
return
ConstantValue
.Bad;
3592
internal
ConstantValue
GetConstantFieldValue(FieldDefinitionHandle fieldDef)
3601
return constantHandle.IsNil ?
ConstantValue
.Bad : GetConstantValueOrThrow(constantHandle);
3605
return
ConstantValue
.Bad;
3696
private
ConstantValue
GetConstantValueOrThrow(ConstantHandle handle)
3703
return
ConstantValue
.Create(reader.ReadBoolean());
3706
return
ConstantValue
.Create(reader.ReadChar());
3709
return
ConstantValue
.Create(reader.ReadSByte());
3712
return
ConstantValue
.Create(reader.ReadInt16());
3715
return
ConstantValue
.Create(reader.ReadInt32());
3718
return
ConstantValue
.Create(reader.ReadInt64());
3721
return
ConstantValue
.Create(reader.ReadByte());
3724
return
ConstantValue
.Create(reader.ReadUInt16());
3727
return
ConstantValue
.Create(reader.ReadUInt32());
3730
return
ConstantValue
.Create(reader.ReadUInt64());
3733
return
ConstantValue
.Create(reader.ReadSingle());
3736
return
ConstantValue
.Create(reader.ReadDouble());
3739
return
ConstantValue
.Create(reader.ReadUTF16(reader.Length));
3747
return
ConstantValue
.Null;
3753
return
ConstantValue
.Bad;
Operations\ControlFlowGraphBuilder.cs (12)
2433
ConstantValue
constantValue =
ConstantValue
.Create(!isAndAlso);
2458
return new ConversionOperation(operand, _compilation.ClassifyConvertibleConversion(operand, type, out
ConstantValue
? constantValue), isTryCast: false, isChecked: false,
2692
var
constantValue =
ConstantValue
.Create(stopValue);
3315
ConstantValue
? constantValue = operand.GetConstantValue() is { IsNull: var isNull }
3316
?
ConstantValue
.Create(isNull)
3459
?
ConstantValue
.Null
4214
return new ConversionOperation(operand, _compilation.ClassifyConvertibleConversion(operand, iDisposable, out
var
constantValue), isTryCast, isChecked: false,
4948
isUp = new LiteralOperation(semanticModel: null, stepValue.Syntax, booleanType, constantValue:
ConstantValue
.Create(false), isImplicit: true);
4957
constantValue:
ConstantValue
.Default(stepValueEnumUnderlyingTypeOrSelf.SpecialType),
5244
constantValue:
ConstantValue
.Create(bits), isImplicit: true);
Operations\Operation.cs (1)
89
internal abstract CodeAnalysis.
ConstantValue
? OperationConstantValue { get; }
Operations\OperationExtensions.cs (1)
388
internal static
ConstantValue
? GetConstantValue(this IOperation operation)
Operations\OperationNodes.cs (10)
18
public NoneOperation(ImmutableArray<IOperation> children, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit) :
65
internal override
ConstantValue
? OperationConstantValue { get; }
87
public InvalidOperation(ImmutableArray<IOperation> children, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isImplicit) :
136
internal override
ConstantValue
? OperationConstantValue { get; }
170
internal override
ConstantValue
? OperationConstantValue => null;
259
internal override
ConstantValue
? OperationConstantValue => null;
401
internal override
ConstantValue
? OperationConstantValue => null;
423
internal override
ConstantValue
? OperationConstantValue => null;
641
public FlowCaptureReferenceOperation(int id, SyntaxNode syntax, ITypeSymbol? type,
ConstantValue
? constantValue, bool isInitialization = false) :
658
public IsNullOperation(SyntaxNode syntax, IOperation operand, ITypeSymbol type,
ConstantValue
? constantValue) :
SwitchConstantValueHelper.cs (9)
17
public static bool IsValidSwitchCaseLabelConstant(
ConstantValue
constant)
50
public static int CompareSwitchCaseLabelConstants(
ConstantValue
first,
ConstantValue
second)
103
var
firstConstant = first as
ConstantValue
;
106
var
secondConstant = second as
ConstantValue
;
132
var
constant = obj as
ConstantValue
;
Symbols\Attributes\CommonAttributeData.cs (5)
194
internal
ConstantValue
DecodeDecimalConstantValue()
237
return
ConstantValue
.Create(new decimal(low, mid, high, isNegative, scale));
240
internal
ConstantValue
DecodeDateTimeConstantValue()
247
return
ConstantValue
.Bad;
250
return
ConstantValue
.Create(new DateTime(value));
Symbols\Attributes\CommonFieldWellKnownAttributeData.cs (4)
45
private
ConstantValue
_constValue =
ConstantValue
.Unset;
47
public
ConstantValue
ConstValue
56
Debug.Assert(_constValue ==
ConstantValue
.Unset);
Symbols\Attributes\CommonParameterEarlyWellKnownAttributeData.cs (4)
17
private
ConstantValue
_defaultParameterValue =
ConstantValue
.Unset;
19
public
ConstantValue
DefaultParameterValue
28
Debug.Assert(_defaultParameterValue ==
ConstantValue
.Unset);
Microsoft.CodeAnalysis.CSharp (17)
Binder\Binder_InterpolatedString.cs (1)
167
var
constantValue = ConstantValue.Create(text, SpecialType.System_String);
Binder\Binder_Operators.cs (5)
3385
/// - <see cref="
ConstantValue
.False"/>
3386
/// - <see cref="
ConstantValue
.True"/>
3387
/// - <see cref="
ConstantValue
.Bad"/> - compiler doesn't support the type check, i.e. cannot perform it, even at runtime
3942
/// - <see cref="
ConstantValue
.Null"/>
3943
/// - <see cref="
ConstantValue
.Bad"/> - compiler doesn't support the type check, i.e. cannot perform it, even at runtime
Binder\Binder_Patterns.cs (3)
797
/// - <see cref="
ConstantValue
.True"/> if the matched type catches all of them
798
/// - <see cref="
ConstantValue
.False"/> if it catches none of them
799
/// - <see cref="
ConstantValue
.Bad"/> - compiler doesn't support the type check, i.e. cannot perform it, even at runtime
Lowering\SyntheticBoundNodeFactory.cs (1)
1132
var
stringConst = ConstantValue.Create(value);
Symbols\ConstantValueUtils.cs (1)
85
var
value = ConstantValue.Bad;
Utilities\IValueSet.cs (2)
43
/// Because of that all four combinations of results from <see cref="Any(BinaryOperatorKind,
ConstantValue
)"/> and <see cref="All(BinaryOperatorKind,
ConstantValue
)"/>
Utilities\ValueSetFactory.IEqualableValueTC.cs (2)
18
/// Get the constant value of type <typeparamref name="T"/> from a <see cref="
ConstantValue
"/>. This method is shared among all
24
/// Translate a numeric value of type <typeparamref name="T"/> into a <see cref="
ConstantValue
"/>.
Utilities\ValueSetFactory.INumericTC.cs (2)
18
/// Get the constant value of type <typeparamref name="T"/> from a <see cref="
ConstantValue
"/>. This method is shared among all
24
/// Translate a numeric value of type <typeparamref name="T"/> into a <see cref="
ConstantValue
"/>.
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
PDB\PdbHelpers.cs (1)
78
/// Translates the value of a constant returned by <see cref="ISymUnmanagedConstant.GetValue(out object)"/> to a <see cref="
ConstantValue
"/>.
Microsoft.CodeAnalysis.Test.Utilities (1)
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (1)
68
var
constantValue = ConstantValue.Create(1);
Microsoft.CodeAnalysis.UnitTests (30)
CorLibTypesTests.cs (30)
97
var
cv1 = ConstantValue.Create(1);
101
var
cv2 = ConstantValue.Create(2);
106
var
cvNull = ConstantValue.Create(null, ConstantValueTypeDiscriminator.Null);
118
var
cv1 = ConstantValue.Create(1);
159
var
cv1 = ConstantValue.Create((sbyte)-1);
162
var
cv2 = ConstantValue.Create(-0.12345f);
165
var
cv3 = ConstantValue.Create((double)-1.234);
168
var
cv4 = ConstantValue.Create((decimal)-12345m);
172
var
cv5 = ConstantValue.Create(null);
181
var
cv11 = ConstantValue.Create((sbyte)-1);
182
var
cv12 = ConstantValue.Create((sbyte)-1);
185
var
cv21 = ConstantValue.Create((byte)255);
186
var
cv22 = ConstantValue.Create((byte)255);
189
var
cv31 = ConstantValue.Create((short)-32768);
190
var
cv32 = ConstantValue.Create((short)-32768);
193
var
cv41 = ConstantValue.Create((ushort)65535);
194
var
cv42 = ConstantValue.Create((ushort)65535);
197
var
cv51 = ConstantValue.Create(12345);
198
var
cv52 = ConstantValue.Create(12345);
201
var
cv61 = ConstantValue.Create(uint.MinValue);
202
var
cv62 = ConstantValue.Create(uint.MinValue);
205
var
cv71 = ConstantValue.Create(long.MaxValue);
206
var
cv72 = ConstantValue.Create(long.MaxValue);
209
var
cv81 = ConstantValue.Create((ulong)123456789);
210
var
cv82 = ConstantValue.Create((ulong)123456789);
213
var
cv91 = ConstantValue.Create(1.1m);
214
var
cv92 = ConstantValue.Create(1.1m);
228
var
cv1 = ConstantValue.Create("1");
229
var
cv2 = ConstantValue.Create("2");
243
var
cv = ConstantValue.Create(null, ConstantValueTypeDiscriminator.Null);