16 instantiations of ConstVal
Microsoft.CSharp (16)
Microsoft\CSharp\RuntimeBinder\Semantics\ConstVal.cs (16)
112
ConstValKind.Int => new
ConstVal
(s_zeroInt32),
113
ConstValKind.Double => new
ConstVal
(0.0),
114
ConstValKind.Long => new
ConstVal
(0L),
115
ConstValKind.Decimal => new
ConstVal
(0M),
116
ConstValKind.Float => new
ConstVal
(0F),
117
ConstValKind.Boolean => new
ConstVal
(s_false),
121
public static ConstVal Get(bool value) => new
ConstVal
(value ? s_true : s_false);
123
public static ConstVal Get(int value) => new
ConstVal
(value == 0 ? s_zeroInt32 : value);
125
public static ConstVal Get(uint value) => new
ConstVal
(value);
127
public static ConstVal Get(decimal value) => new
ConstVal
(value);
129
public static ConstVal Get(string value) => new
ConstVal
(value);
131
public static ConstVal Get(float value) => new
ConstVal
(value);
133
public static ConstVal Get(double value) => new
ConstVal
(value);
135
public static ConstVal Get(long value) => new
ConstVal
(value);
137
public static ConstVal Get(ulong value) => new
ConstVal
(value);
139
public static ConstVal Get(object p) => new
ConstVal
(p);
75 references to ConstVal
Microsoft.CSharp (75)
Microsoft\CSharp\RuntimeBinder\RuntimeBinder.cs (3)
469
arg = ExprFactory.CreateConstant(SymbolTable.GetCTypeFromType(argument.Type), default(
ConstVal
));
478
arg = ExprFactory.CreateConstant(SymbolTable.GetCTypeFromType(argument.Type),
ConstVal
.Get(argument.Value));
1361
return ExprFactory.CreateConstant(boolType,
ConstVal
.Get(result));
Microsoft\CSharp\RuntimeBinder\Semantics\ConstVal.cs (11)
109
public static
ConstVal
GetDefaultValue(ConstValKind kind) =>
121
public static
ConstVal
Get(bool value) => new ConstVal(value ? s_true : s_false);
123
public static
ConstVal
Get(int value) => new ConstVal(value == 0 ? s_zeroInt32 : value);
125
public static
ConstVal
Get(uint value) => new ConstVal(value);
127
public static
ConstVal
Get(decimal value) => new ConstVal(value);
129
public static
ConstVal
Get(string value) => new ConstVal(value);
131
public static
ConstVal
Get(float value) => new ConstVal(value);
133
public static
ConstVal
Get(double value) => new ConstVal(value);
135
public static
ConstVal
Get(long value) => new ConstVal(value);
137
public static
ConstVal
Get(ulong value) => new ConstVal(value);
139
public static
ConstVal
Get(object p) => new ConstVal(p);
Microsoft\CSharp\RuntimeBinder\Semantics\Conversion.cs (19)
1195
ConstVal
cv =
ConstVal
.Get(constSrc.UInt64Value);
1311
ConstVal
cv;
1314
cv =
ConstVal
.Get((uint)valueInt);
1318
cv =
ConstVal
.Get((int)valueInt);
1322
cv =
ConstVal
.Get(valueInt);
1326
cv =
ConstVal
.Get(valueFlt);
1412
ConstVal
cv;
1452
cv =
ConstVal
.Get(result);
1473
cv =
ConstVal
.Get(Convert.ToSByte(decTrunc));
1476
cv =
ConstVal
.Get((uint)Convert.ToByte(decTrunc));
1479
cv =
ConstVal
.Get(Convert.ToInt16(decTrunc));
1482
cv =
ConstVal
.Get((uint)Convert.ToUInt16(decTrunc));
1485
cv =
ConstVal
.Get(Convert.ToInt32(decTrunc));
1488
cv =
ConstVal
.Get(Convert.ToUInt32(decTrunc));
1491
cv =
ConstVal
.Get(Convert.ToInt64(decTrunc));
1494
cv =
ConstVal
.Get(Convert.ToUInt64(decTrunc));
1497
cv =
ConstVal
.Get(Convert.ToSingle(src.Val.DecimalVal));
1500
cv =
ConstVal
.Get(Convert.ToDouble(src.Val.DecimalVal));
Microsoft\CSharp\RuntimeBinder\Semantics\ExprFactory.cs (6)
98
CreateConstant(TypeManager.GetPredefAgg(PredefinedType.PT_STRING).getThisType(),
ConstVal
.Get(str));
127
return CreateConstant(type,
ConstVal
.Get(Activator.CreateInstance(type.AssociatedSystemType)));
152
return CreateConstant(type,
ConstVal
.GetDefaultValue(type.ConstValKind));
156
public static ExprConstant CreateConstant(CType type,
ConstVal
constVal) => new ExprConstant(type, constVal);
161
CreateConstant(TypeManager.GetPredefAgg(PredefinedType.PT_INT).getThisType(),
ConstVal
.Get(x));
166
CreateConstant(TypeManager.GetPredefAgg(PredefinedType.PT_BOOL).getThisType(),
ConstVal
.Get(b));
Microsoft\CSharp\RuntimeBinder\Semantics\GroupToArgsBinder.cs (2)
497
ConstVal
cv = methprop.GetDefaultParameterValue(index);
506
optionalArgument = ExprFactory.CreateConstant(dateTimeType,
ConstVal
.Get(DateTime.FromBinary(cv.Int64Val)));
Microsoft\CSharp\RuntimeBinder\Semantics\ImplicitConversion.cs (1)
662
_exprDest = ExprFactory.CreateConstant(_typeDest,
ConstVal
.GetDefaultValue(_typeDest.ConstValKind));
Microsoft\CSharp\RuntimeBinder\Semantics\Operators.cs (7)
1668
ConstVal
cv;
1700
cv =
ConstVal
.Get(1);
1705
cv =
ConstVal
.Get(1);
1710
cv =
ConstVal
.Get((long)1);
1715
cv =
ConstVal
.Get(1.0);
1724
private Expr LScalar(ExpressionKind ek, EXPRFLAG flags, Expr exprVal, CType type,
ConstVal
cv, CType typeTmp)
1971
return ExprFactory.CreateConstant(typeBool,
ConstVal
.Get(((ExprConstant)argConst).Val.Int32Val == 0));
Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\MethodOrPropertySymbol.cs (5)
38
private
ConstVal
[] _defaultParameters;
67
_defaultParameters = Array.Empty<
ConstVal
>();
75
_defaultParameters = new
ConstVal
[count];
130
public void SetDefaultParameterValue(int index, CType type,
ConstVal
cv)
138
public
ConstVal
GetDefaultParameterValue(int index)
Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Constant.cs (2)
12
public ExprConstant(CType type,
ConstVal
value)
22
public
ConstVal
Val { get; }
Microsoft\CSharp\RuntimeBinder\SymbolTable.cs (19)
1514
ConstVal
cv =
ConstVal
.Get(((DateTime)dateAttr.Value).Ticks);
1524
ConstVal
cv =
ConstVal
.Get(decAttr.Value);
1533
ConstVal
cv = default(
ConstVal
);
1545
cv =
ConstVal
.Get((byte)defValue);
1550
cv =
ConstVal
.Get((short)defValue);
1555
cv =
ConstVal
.Get((int)defValue);
1560
cv =
ConstVal
.Get((long)defValue);
1565
cv =
ConstVal
.Get((float)defValue);
1570
cv =
ConstVal
.Get((double)defValue);
1575
cv =
ConstVal
.Get((char)defValue);
1580
cv =
ConstVal
.Get((bool)defValue);
1585
cv =
ConstVal
.Get((sbyte)defValue);
1590
cv =
ConstVal
.Get((ushort)defValue);
1595
cv =
ConstVal
.Get((uint)defValue);
1600
cv =
ConstVal
.Get((ulong)defValue);
1605
cv =
ConstVal
.Get((string)defValue);