Binder\Binder_Conversions.cs (25)
249ConstantValue? constantValue = this.FoldConstantConversion(syntax, source, conversion, destination, diagnostics);
431var constantValue = FoldConditionalOperator(condition, trueExpr, falseExpr);
503constantValueOpt: ConstantValue.NotAvailable,
585constantValueOpt: ConstantValue.NotAvailable,
622constantValueOpt: ConstantValue.NotAvailable,
672expr = new BoundConversion(syntax, source, conversion, @checked: false, explicitCastInCode: isCast, conversionGroup, constantValueOpt: ConstantValue.NotAvailable, type: delegateType, hasErrors: true) { WasCompilerGenerated = source.WasCompilerGenerated };
715constantValueOpt: ConstantValue.NotAvailable,
736return new BoundConversion(syntax, group, conversion, @checked: false, explicitCastInCode: isCast, conversionGroup, constantValueOpt: ConstantValue.NotAvailable, type: destination, hasErrors: hasErrors) { WasCompilerGenerated = group.WasCompilerGenerated };
799DefaultValueFromAttributes: ConstantValue.NotAvailable
835var delegateParamDefault = delegateParameter.HasExplicitDefaultValue ? delegateParameter.ExplicitDefaultConstantValue : null;
979constantValueOpt: ConstantValue.NotAvailable,
994constantValueOpt: ConstantValue.NotAvailable,
1530public ConstantValue? FoldConstantConversion(
1565var sourceConstantValue = source.ConstantValueOpt;
1596return ConstantValue.Create(sourceConstantValue.SingleValue);
1598return ConstantValue.Create(sourceConstantValue.DoubleValue);
1632private ConstantValue? FoldConstantNumericConversion(
1634ConstantValue sourceValue,
1665return ConstantValue.Bad;
1673return ConstantValue.Bad;
1689return ConstantValue.Bad;
1702return ConstantValue.Create(DoUncheckedConversion(destinationType, sourceValue), destinationType);
1705private static object DoUncheckedConversion(SpecialType destinationType, ConstantValue value)
2008public static bool CheckConstantBounds(SpecialType destinationType, ConstantValue value, out bool maySucceedAtRuntime)
2085private static object CanonicalizeConstant(ConstantValue value)
Binder\Binder_Invocation.cs (11)
1215defaultValue = new BoundFieldAccess(syntax, null, fieldSymbol, ConstantValue.NotAvailable) { WasCompilerGenerated = true };
1356var parameterDefaultValue = parameter.ExplicitDefaultConstantValue;
1363var defaultConstantValue = parameterDefaultValue switch
1366{ IsBad: true } => ConstantValue.Null,
1369Debug.Assert((object?)defaultConstantValue != ConstantValue.Unset);
1377defaultValue = new BoundLiteral(syntax, ConstantValue.Create(line), Compilation.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true };
1382defaultValue = new BoundLiteral(syntax, ConstantValue.Create(path), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true };
1387defaultValue = new BoundLiteral(syntax, ConstantValue.Create(memberName), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true };
1396defaultValue = new BoundLiteral(syntax, ConstantValue.Create(argument.Syntax.ToString()), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true };
1398else if (defaultConstantValue == ConstantValue.NotAvailable)
1911return new BoundNameOfOperator(node, boundArgument, ConstantValue.Create(name), Compilation.GetSpecialType(SpecialType.System_String));
Binder\Binder_Operators.cs (110)
415constantValueOpt: ConstantValue.NotAvailable,
518return new BoundBinaryOperator(node, kind, ConstantValue.NotAvailable, methodOpt: null, constrainedToTypeOpt: null, LookupResultKind.Empty, left, right, GetBinaryOperatorErrorType(kind, diagnostics, node), true);
542return new BoundLiteral(node, ConstantValue.Create(kind == BinaryOperatorKind.Equal), GetSpecialType(SpecialType.System_Boolean, diagnostics, node));
558var stringConstant = FoldBinaryOperator(node, BinaryOperatorKind.StringConcatenation, left, right, right.Type, diagnostics);
633ConstantValue resultConstant = null;
908var constantValue = FoldBinaryOperator(node, kind | BinaryOperatorKind.Bool, left, right, left.Type, diagnostics);
921return new BoundBinaryOperator(node, kind, ConstantValue.NotAvailable, methodOpt: null, constrainedToTypeOpt: null,
1006ConstantValue.NotAvailable,
1017return new BoundBinaryOperator(node, kind, left, right, ConstantValue.NotAvailable, methodOpt: null, constrainedToTypeOpt: null, lookupResult, originalUserDefinedOperators, CreateErrorType(), true);
1456private static object FoldDecimalBinaryOperators(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight)
1487private static object FoldNativeIntegerOverflowingBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight)
1530private static object FoldUncheckedIntegralBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight)
1586private static object FoldCheckedIntegralBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight)
1676private ConstantValue? FoldEnumBinaryOperator(
1737var constantValue = FoldBinaryOperator(syntax, newKind, newLeftOperand, newRightOperand, resultTypeSymbol, diagnostics);
1751private ConstantValue? FoldBinaryOperator(
1768ConstantValue? nullableEqualityResult = TryFoldingNullableEquality(kind, left, right);
1774var valueLeft = left.ConstantValueOpt;
1775var valueRight = right.ConstantValueOpt;
1783return ConstantValue.Bad;
1795return ConstantValue.Bad;
1810return ConstantValue.Create(newValue, resultType);
1813ConstantValue? concatResult = FoldStringConcatenation(kind, valueLeft, valueRight);
1834return ConstantValue.Bad;
1839return ConstantValue.Create(newValue, resultType);
1858return ConstantValue.Create(newValue, resultType);
1870return ConstantValue.Bad;
1880return ConstantValue.Create(newValue, resultType);
1908private static ConstantValue? TryFoldingNullableEquality(BinaryOperatorKind kind, BoundExpression left, BoundExpression right)
1919ConstantValue? leftConstant = leftConv.Operand.ConstantValueOpt;
1920ConstantValue? rightConstant = rightConv.Operand.ConstantValueOpt;
1930return (leftIsNull == rightIsNull) == (op == BinaryOperatorKind.Equal) ? ConstantValue.True : ConstantValue.False;
1941private static object? FoldNeverOverflowBinaryOperators(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight)
2173private static ConstantValue? FoldStringConcatenation(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight)
2184return (newLength > int.MaxValue) ? ConstantValue.Bad : ConstantValue.CreateFromRope(Rope.Concat(leftValue, rightValue));
2696return new BoundUnaryOperator(node, kind, operand, ConstantValue.NotAvailable,
2717constantValueOpt: ConstantValue.NotAvailable,
2734ConstantValue.NotAvailable,
2748var resultConstant = FoldUnaryOperator(node, resultOperatorKind, resultOperand, resultType, diagnostics);
2764private ConstantValue? FoldEnumUnaryOperator(
2785var constantValue = FoldUnaryOperator(syntax, newKind, operand, upconvertType, diagnostics);
2799private ConstantValue? FoldUnaryOperator(
2814var value = operand.ConstantValueOpt;
2829return ConstantValue.Create(newValue, resultType);
2848return ConstantValue.Create(newValue, resultType);
2860return ConstantValue.Bad;
2870return ConstantValue.Create(newValue, resultType);
2876private static object? FoldNeverOverflowUnaryOperator(UnaryOperatorKind kind, ConstantValue value)
2916private static object? FoldUncheckedIntegralUnaryOperator(UnaryOperatorKind kind, ConstantValue value)
2932private static object? FoldCheckedIntegralUnaryOperator(UnaryOperatorKind kind, ConstantValue value)
2948private static object? FoldNativeIntegerOverflowingUnaryOperator(UnaryOperatorKind kind, ConstantValue value)
3061return new BoundLiteral(node, ConstantValue.Create((int)-2147483648), GetSpecialType(SpecialType.System_Int32, diagnostics, node));
3076return new BoundLiteral(node, ConstantValue.Create(-9223372036854775808), GetSpecialType(SpecialType.System_Int64, diagnostics, node));
3082private static bool IsDivisionByZero(BinaryOperatorKind kind, ConstantValue valueRight)
3199var convertedExpression = BindExpressionForPattern(operand.Type, node.Right, ref hasErrors, isPatternDiagnostics, out var constantValueOpt, out var wasExpression, out _);
3206node.Right, convertedExpression, constantValueOpt ?? ConstantValue.Bad, operand.Type, convertedExpression.Type ?? operand.Type, hasErrors)
3245if (operand.ConstantValueOpt == ConstantValue.Null ||
3311ConstantValue operandConstantValue)
3318ConstantValue constantValue = GetIsOperatorConstantResult(operandType, targetType, conversionKind, operandConstantValue);
3327Debug.Assert(constantValue == ConstantValue.True || constantValue == ConstantValue.False);
3329ErrorCode errorCode = constantValue == ConstantValue.True ? ErrorCode.WRN_IsAlwaysTrue : ErrorCode.WRN_IsAlwaysFalse;
3337/// - <see cref="ConstantValue.False"/>
3338/// - <see cref="ConstantValue.True"/>
3339/// - <see cref="ConstantValue.Bad"/> - compiler doesn't support the type check, i.e. cannot perform it, even at runtime
3342internal static ConstantValue GetIsOperatorConstantResult(
3346ConstantValue operandConstantValue,
3385if (operandConstantValue == ConstantValue.Null)
3387return ConstantValue.False;
3395(operandConstantValue == null || operandConstantValue == ConstantValue.Null); // a non-null constant is never null
3458return ConstantValue.False;
3468return ConstantValue.False;
3475return ConstantValue.Bad;
3509return ConstantValue.False;
3519return ConstantValue.False;
3535return ConstantValue.False;
3544return operandCouldBeNull ? null : ConstantValue.True;
3550return ConstantValue.False;
3553return operandCouldBeNull ? null : ConstantValue.True;
3568return operandCouldBeNull ? null : ConstantValue.True;
3585return operandCouldBeNull ? null : ConstantValue.True;
3597? ConstantValue.True : ConstantValue.False;
3721operand = new BoundDefaultExpression(operand.Syntax, targetType: null, constantValueOpt: ConstantValue.Null,
3779ConstantValue operandConstantValue)
3841ConstantValue operandConstantValue)
3848ConstantValue constantValue = GetAsOperatorConstantResult(operandType, targetType, conversionKind, operandConstantValue);
3865/// - <see cref="ConstantValue.Null"/>
3866/// - <see cref="ConstantValue.Bad"/> - compiler doesn't support the type check, i.e. cannot perform it, even at runtime
3869internal static ConstantValue GetAsOperatorConstantResult(TypeSymbol operandType, TypeSymbol targetType, ConversionKind conversionKind, ConstantValue operandConstantValue)
3876ConstantValue isOperatorConstantResult = GetIsOperatorConstantResult(operandType, targetType, conversionKind, operandConstantValue);
3886return ConstantValue.Null;
4226ConstantValue? constantValue = null;
4329private static ConstantValue FoldConditionalOperator(BoundExpression condition, BoundExpression trueExpr, BoundExpression falseExpr)
4331ConstantValue trueValue = trueExpr.ConstantValueOpt;
4337ConstantValue falseValue = falseExpr.ConstantValueOpt;
4343ConstantValue conditionValue = condition.ConstantValueOpt;
4348else if (conditionValue == ConstantValue.True)
4352else if (conditionValue == ConstantValue.False)
4358return ConstantValue.Bad;
Binder\Binder_Patterns.cs (26)
424var convertedExpression = BindExpressionOrTypeForPattern(inputType, innerExpression, ref hasErrors, diagnostics, out var constantValueOpt, out bool wasExpression, out Conversion patternConversion);
440node, convertedExpression, constantValueOpt ?? ConstantValue.Bad, inputType, convertedType, hasErrors || constantValueOpt is null);
502out ConstantValue? constantValueOpt,
530out ConstantValue? constantValueOpt,
548out ConstantValue? constantValueOpt,
569if (convertedExpression.Type is null && constantValueOpt != ConstantValue.Null)
582out ConstantValue? constantValue,
598if (expression.ConstantValueOpt == ConstantValue.Null)
611ConstantValue match = ExpressionOfTypeMatchesPatternType(Conversions, inputType, expression.Type, ref useSiteInfo, out _, operandConstantValue: null);
612if (match == ConstantValue.False || match == ConstantValue.Bad)
662if (constantValue == ConstantValue.Null)
756ConstantValue matchPossible = ExpressionOfTypeMatchesPatternType(
759if (matchPossible != ConstantValue.False && matchPossible != ConstantValue.Bad)
788/// - <see cref="ConstantValue.True"/> if the matched type catches all of them
789/// - <see cref="ConstantValue.False"/> if it catches none of them
790/// - <see cref="ConstantValue.Bad"/> - compiler doesn't support the type check, i.e. cannot perform it, even at runtime
793internal static ConstantValue ExpressionOfTypeMatchesPatternType(
799ConstantValue? operandConstantValue = null,
809return ConstantValue.True;
819ConstantValue result = Binder.GetIsOperatorConstantResult(expressionType, patternType, conversion.Kind, operandConstantValue, operandCouldBeNull);
822Debug.Assert(!conversion.IsUserDefined || result == ConstantValue.False || result == ConstantValue.Bad);
1622BoundExpression value = BindExpressionForPattern(inputType, node.Expression, ref hasErrors, diagnostics, out var constantValueOpt, out _, out Conversion patternConversion);
1657constantValueOpt = ConstantValue.Bad;
Binder\Binder_Statements.cs (9)
2196Conversion conversion, TypeSymbol sourceType, TypeSymbol targetType, ConstantValue sourceConstantValueOpt = null)
2213else if (conversion.Kind == ConversionKind.ExplicitNumeric && sourceConstantValueOpt != null && sourceConstantValueOpt != ConstantValue.Bad &&
2214ConversionsBase.HasImplicitConstantExpressionConversion(new BoundLiteral(syntax, ConstantValue.Bad, sourceType), targetType))
2546return BoundConversion.Synthesized(node, BindToTypeForErrorRecovery(expr), Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true);
2558ConstantValue.NotAvailable,
2612return BoundConversion.Synthesized(node, expr, Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true);
2631return new BoundUnaryOperator(node, signature.Kind, resultOperand, ConstantValue.NotAvailable, signature.Method, signature.ConstrainedToTypeOpt, resultKind, originalUserDefinedOperators, signature.ReturnType)
3241exceptionSource = new BoundLocal(declaration, local, ConstantValue.NotAvailable, local.Type);
3253if (boundFilter.ConstantValueOpt != ConstantValue.NotAvailable)
Binder\DecisionDagBuilder.cs (16)
340tests.Add(new Tests.One(new BoundDagValueTest(syntax, ConstantValue.Create(patternLength), lengthTemp)));
484if (constant.ConstantValue == ConstantValue.Null)
1104resultForRelation(BinaryOperatorKind relation, ConstantValue value)
1252ConstantValue? matches = ExpressionOfTypeMatchesPatternTypeForLearningFromSuccessfulTypeTest(t1.Type, t2.Type, ref useSiteInfo);
1253if (matches == ConstantValue.False)
1259else if (matches == ConstantValue.True)
1269if (matches == ConstantValue.True)
1310ConstantValue value,
1453(conditions ??= ArrayBuilder<Tests>.GetInstance()).Add(new Tests.One(new BoundDagValueTest(syntax, ConstantValue.Create(lengthValue), s1LengthTemp)));
1490private ConstantValue? ExpressionOfTypeMatchesPatternTypeForLearningFromSuccessfulTypeTest(
1495ConstantValue result = Binder.ExpressionOfTypeMatchesPatternType(_conversions, expressionType, patternType, ref useSiteInfo, out Conversion conversion);
1856public bool IsFullyMatched => RemainingTests is Tests.True && (WhenClause is null || WhenClause.ConstantValueOpt == ConstantValue.True);
2098static Tests? knownResult(BinaryOperatorKind relation, ConstantValue constant, int offset)
2110static ConstantValue safeAdd(ConstantValue constant, int offset)
2117return ConstantValue.Create(offset > (int.MaxValue - value) ? int.MaxValue : value + offset);
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 (14)
17ConstantValue? constantValueOpt,
27ConstantValue? constantValueOpt,
39ConstantValue? constantValueOpt,
51ConstantValue? constantValueOpt,
271public static BoundConversion SynthesizedNonUserDefined(SyntaxNode syntax, BoundExpression operand, Conversion conversion, TypeSymbol type, ConstantValue? constantValueOpt = null)
299ConstantValue? constantValueOpt,
325ConstantValue? constantValueOpt,
349ConstantValue? constantValueOpt,
362ConstantValue? constantValueOpt,
375ConstantValue? constantValueOpt,
396ConstantValue? constantValueOpt,
409ConstantValue? constantValueOpt,
689ConstantValue? constantValueOpt,
701ConstantValue? constantValueOpt,
CodeGen\EmitStatement.cs (13)
1218dispatch.Cases.Select(p => new KeyValuePair<ConstantValue, object>(p.value, p.label)).ToArray(),
1225KeyValuePair<ConstantValue, object>[] switchCaseLabels,
1385lengthBasedSwitchInfo.LengthBasedJumpTable.LengthCaseLabels.Select(p => new KeyValuePair<ConstantValue, object>(ConstantValue.Create(p.value), p.label)).ToArray(),
1422charJumpTable.CharCaseLabels.Select(p => new KeyValuePair<ConstantValue, object>(ConstantValue.Create(p.value), p.label)).ToArray(),
1439stringJumpTable.StringCaseLabels.Select(p => new KeyValuePair<ConstantValue, object>(ConstantValue.Create(p.value), p.label)).ToArray(),
1455KeyValuePair<ConstantValue, object>[] switchCaseLabels,
1535if (stringConstant == ConstantValue.Null)
1660private void EmitStringCompareAndBranch(LocalOrParameter key, SyntaxNode syntaxNode, ConstantValue stringConstant, object targetLabel, Microsoft.Cci.IReference stringEqualityMethodRef)
1698private void EmitCharCompareAndBranch(LocalOrParameter key, SyntaxNode syntaxNode, ConstantValue stringConstant, object targetLabel, Cci.IReference sequenceEqualsRef, Cci.IReference asSpanRef)
1957var casesBuilder = ArrayBuilder<(ConstantValue, LabelSymbol)>.GetInstance();
Compiler\MethodBodySynthesizer.cs (8)
105ImmutableArray.Create<BoundExpression>(new BoundLiteral(syntax, ConstantValue.Create(slotIndex), intType) { WasCompilerGenerated = true }),
121new BoundFieldAccess(syntax, thisReference, hostObjectField, ConstantValue.NotAvailable) { WasCompilerGenerated = true },
125ImmutableArray.Create<BoundExpression>(new BoundLiteral(syntax, ConstantValue.Create(0), intType) { WasCompilerGenerated = true }),
131ConstantValue.NotAvailable,
149new BoundFieldAccess(syntax, thisReference, field, ConstantValue.NotAvailable) { WasCompilerGenerated = true },
153ImmutableArray.Create<BoundExpression>(new BoundLiteral(syntax, ConstantValue.Create(targetSubmissionIndex), intType) { WasCompilerGenerated = true }),
160ConstantValue.NotAvailable,
187var fieldAccess = new BoundFieldAccess(syntax, thisReference, field, ConstantValue.NotAvailable) { WasCompilerGenerated = true };
Generated\BoundNodes.xml.Generated.cs (56)
1170public BoundUnaryOperator(SyntaxNode syntax, UnaryOperatorKind operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type, bool hasErrors = false)
1189public override ConstantValue? ConstantValueOpt { get; }
1198public BoundUnaryOperator Update(UnaryOperatorKind operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
1953public BoundUnconvertedConditionalOperator(SyntaxNode syntax, BoundExpression condition, BoundExpression consequence, BoundExpression alternative, ConstantValue? constantValueOpt, ErrorCode noCommonTypeError, bool hasErrors = false)
1972public override ConstantValue? ConstantValueOpt { get; }
1978public BoundUnconvertedConditionalOperator Update(BoundExpression condition, BoundExpression consequence, BoundExpression alternative, ConstantValue? constantValueOpt, ErrorCode noCommonTypeError)
1992public BoundConditionalOperator(SyntaxNode syntax, bool isRef, BoundExpression condition, BoundExpression consequence, BoundExpression alternative, ConstantValue? constantValueOpt, TypeSymbol? naturalTypeOpt, bool wasTargetTyped, TypeSymbol type, bool hasErrors = false)
2015public override ConstantValue? ConstantValueOpt { get; }
2022public BoundConditionalOperator Update(bool isRef, BoundExpression condition, BoundExpression consequence, BoundExpression alternative, ConstantValue? constantValueOpt, TypeSymbol? naturalTypeOpt, bool wasTargetTyped, TypeSymbol type)
2705public BoundDefaultExpression(SyntaxNode syntax, BoundTypeExpression? targetType, ConstantValue? constantValueOpt, TypeSymbol type, bool hasErrors = false)
2717public override ConstantValue? ConstantValueOpt { get; }
2722public BoundDefaultExpression Update(BoundTypeExpression? targetType, ConstantValue? constantValueOpt, TypeSymbol type)
2808public BoundSizeOfOperator(SyntaxNode syntax, BoundTypeExpression sourceType, ConstantValue? constantValueOpt, TypeSymbol type, bool hasErrors = false)
2821public override ConstantValue? ConstantValueOpt { get; }
2826public BoundSizeOfOperator Update(BoundTypeExpression sourceType, ConstantValue? constantValueOpt, TypeSymbol type)
2840public BoundConversion(SyntaxNode syntax, BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, ImmutableArray<MethodSymbol> originalUserDefinedConversionsOpt, TypeSymbol type, bool hasErrors = false)
2863public override ConstantValue? ConstantValueOpt { get; }
2870public BoundConversion Update(BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, ImmutableArray<MethodSymbol> originalUserDefinedConversionsOpt, TypeSymbol type)
3704public BoundSwitchDispatch(SyntaxNode syntax, BoundExpression expression, ImmutableArray<(ConstantValue value, LabelSymbol label)> cases, LabelSymbol defaultLabel, LengthBasedStringSwitchData? lengthBasedStringSwitchDataOpt, bool hasErrors = false)
3719public ImmutableArray<(ConstantValue value, LabelSymbol label)> Cases { get; }
3726public BoundSwitchDispatch Update(BoundExpression expression, ImmutableArray<(ConstantValue value, LabelSymbol label)> cases, LabelSymbol defaultLabel, LengthBasedStringSwitchData? lengthBasedStringSwitchDataOpt)
4189public BoundLiteral(SyntaxNode syntax, ConstantValue? constantValueOpt, TypeSymbol? type, bool hasErrors)
4195public BoundLiteral(SyntaxNode syntax, ConstantValue? constantValueOpt, TypeSymbol? type)
4201public override ConstantValue? ConstantValueOpt { get; }
4206public BoundLiteral Update(ConstantValue? constantValueOpt, TypeSymbol? type)
4394public BoundLocal(SyntaxNode syntax, LocalSymbol localSymbol, BoundLocalDeclarationKind declarationKind, ConstantValue? constantValueOpt, bool isNullableUnknown, TypeSymbol type, bool hasErrors)
4407public BoundLocal(SyntaxNode syntax, LocalSymbol localSymbol, BoundLocalDeclarationKind declarationKind, ConstantValue? constantValueOpt, bool isNullableUnknown, TypeSymbol type)
4423public override ConstantValue? ConstantValueOpt { get; }
4429public BoundLocal Update(LocalSymbol localSymbol, BoundLocalDeclarationKind declarationKind, ConstantValue? constantValueOpt, bool isNullableUnknown, TypeSymbol type)
5201public BoundDagValueTest(SyntaxNode syntax, ConstantValue value, BoundDagTemp input, bool hasErrors = false)
5211public ConstantValue Value { get; }
5216public BoundDagValueTest Update(ConstantValue value, BoundDagTemp input)
5230public BoundDagRelationalTest(SyntaxNode syntax, BinaryOperatorKind operatorKind, ConstantValue value, BoundDagTemp input, bool hasErrors = false)
5242public ConstantValue Value { get; }
5247public BoundDagRelationalTest Update(BinaryOperatorKind operatorKind, ConstantValue value, BoundDagTemp input)
6228public 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)
6258public override ConstantValue? ConstantValueOpt { get; }
6265public 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)
6988public BoundFieldAccess(SyntaxNode syntax, BoundExpression? receiverOpt, FieldSymbol fieldSymbol, ConstantValue? constantValueOpt, LookupResultKind resultKind, bool isByValue, bool isDeclaration, TypeSymbol type, bool hasErrors = false)
7006public override ConstantValue? ConstantValueOpt { get; }
7014public BoundFieldAccess Update(BoundExpression? receiverOpt, FieldSymbol fieldSymbol, ConstantValue? constantValueOpt, LookupResultKind resultKind, bool isByValue, bool isDeclaration, TypeSymbol type)
7425public BoundNameOfOperator(SyntaxNode syntax, BoundExpression argument, ConstantValue constantValueOpt, TypeSymbol type, bool hasErrors = false)
7439public override ConstantValue ConstantValueOpt { get; }
7444public BoundNameOfOperator Update(BoundExpression argument, ConstantValue constantValueOpt, TypeSymbol type)
7458protected BoundInterpolatedStringBase(BoundKind kind, SyntaxNode syntax, ImmutableArray<BoundExpression> parts, ConstantValue? constantValueOpt, TypeSymbol? type, bool hasErrors = false)
7469public override ConstantValue? ConstantValueOpt { get; }
7474public BoundUnconvertedInterpolatedString(SyntaxNode syntax, ImmutableArray<BoundExpression> parts, ConstantValue? constantValueOpt, TypeSymbol? type, bool hasErrors = false)
7486public BoundUnconvertedInterpolatedString Update(ImmutableArray<BoundExpression> parts, ConstantValue? constantValueOpt, TypeSymbol? type)
7500public BoundInterpolatedString(SyntaxNode syntax, InterpolatedStringHandlerData? interpolationData, ImmutableArray<BoundExpression> parts, ConstantValue? constantValueOpt, TypeSymbol? type, bool hasErrors = false)
7514public BoundInterpolatedString Update(InterpolatedStringHandlerData? interpolationData, ImmutableArray<BoundExpression> parts, ConstantValue? constantValueOpt, TypeSymbol? type)
7699public BoundConstantPattern(SyntaxNode syntax, BoundExpression value, ConstantValue constantValue, TypeSymbol inputType, TypeSymbol narrowedType, bool hasErrors = false)
7713public ConstantValue ConstantValue { get; }
7718public BoundConstantPattern Update(BoundExpression value, ConstantValue constantValue, TypeSymbol inputType, TypeSymbol narrowedType)
8174public BoundRelationalPattern(SyntaxNode syntax, BinaryOperatorKind relation, BoundExpression value, ConstantValue constantValue, TypeSymbol inputType, TypeSymbol narrowedType, bool hasErrors = false)
8190public ConstantValue ConstantValue { get; }
8195public BoundRelationalPattern Update(BinaryOperatorKind relation, BoundExpression value, ConstantValue constantValue, TypeSymbol inputType, TypeSymbol narrowedType)
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (20)
590var cases = ArrayBuilder<(ConstantValue value, LabelSymbol label)>.GetInstance();
621ImmutableArray<(ConstantValue value, LabelSymbol label)> cases,
644(ImmutableArray<(ConstantValue value, LabelSymbol label)> whenTrueCases, ImmutableArray<(ConstantValue value, LabelSymbol label)> whenFalseCases)
645splitCases(ImmutableArray<(ConstantValue value, LabelSymbol label)> cases, BinaryOperatorKind op, ConstantValue value)
647var whenTrueBuilder = ArrayBuilder<(ConstantValue value, LabelSymbol label)>.GetInstance();
648var whenFalseBuilder = ArrayBuilder<(ConstantValue value, LabelSymbol label)>.GetInstance();
705private sealed class CasesComparer : IComparer<(ConstantValue value, LabelSymbol label)>
714int IComparer<(ConstantValue value, LabelSymbol label)>.Compare((ConstantValue value, LabelSymbol label) left, (ConstantValue value, LabelSymbol label) right)
716var x = left.value;
717var y = right.value;
737static bool isNaN(ConstantValue value) =>
787ImmutableArray<(ConstantValue value, LabelSymbol label)> cases;
793cases = node.Cases.SelectAsArray(p => (ConstantValue.Create((long)p.value.Int32Value), p.label));
799cases = node.Cases.SelectAsArray(p => (ConstantValue.Create((ulong)p.value.UInt32Value), p.label));
1009if (whenExpression is not null && whenExpression.ConstantValueOpt != ConstantValue.True)
1161if (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)
379_factory.Convert(operandType, new BoundLiteral(syntax, ConstantValue.Null, objectType)),
387protected BoundExpression MakeValueTest(SyntaxNode syntax, BoundExpression input, ConstantValue value)
401protected BoundExpression MakeRelationalTest(SyntaxNode syntax, BoundExpression input, BinaryOperatorKind operatorKind, ConstantValue value)
431private BoundExpression MakeSpanStringTest(BoundExpression input, ConstantValue value)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (48)
278if (loweredRight.ConstantValueOpt == ConstantValue.True) return loweredLeft;
279if (loweredLeft.ConstantValueOpt == ConstantValue.True) return loweredRight;
280if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredLeft;
290if (loweredRight.ConstantValueOpt == ConstantValue.False) return loweredLeft;
291if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredRight;
292if (loweredLeft.ConstantValueOpt == ConstantValue.True) return loweredLeft;
302if (loweredRight.ConstantValueOpt == ConstantValue.True) return loweredLeft;
303if (loweredLeft.ConstantValueOpt == ConstantValue.True) return loweredRight;
323if (loweredRight.ConstantValueOpt == ConstantValue.False) return loweredLeft;
324if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredRight;
328if (loweredLeft.ConstantValueOpt == ConstantValue.True) return loweredRight;
329if (loweredRight.ConstantValueOpt == ConstantValue.True) return loweredLeft;
333if (loweredLeft.ConstantValueOpt == ConstantValue.False)
336if (loweredRight.ConstantValueOpt == ConstantValue.False)
342if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredRight;
343if (loweredRight.ConstantValueOpt == ConstantValue.False) return loweredLeft;
347if (loweredLeft.ConstantValueOpt == ConstantValue.True)
350if (loweredRight.ConstantValueOpt == ConstantValue.True)
356if (loweredLeft.ConstantValueOpt == ConstantValue.False) return loweredRight;
357if (loweredRight.ConstantValueOpt == ConstantValue.False) return loweredLeft;
361if (loweredLeft.ConstantValueOpt == ConstantValue.True)
364if (loweredRight.ConstantValueOpt == ConstantValue.True)
623ConstantValue? constantLeft = loweredLeft.ConstantValueOpt ?? UnboxConstant(loweredLeft);
624if (testOperator == UnaryOperatorKind.DynamicFalse && constantLeft == ConstantValue.False ||
625testOperator == UnaryOperatorKind.DynamicTrue && constantLeft == ConstantValue.True)
667bool leftTestIsConstantFalse = testOperator == UnaryOperatorKind.DynamicFalse && constantLeft == ConstantValue.True ||
668testOperator == UnaryOperatorKind.DynamicTrue && constantLeft == ConstantValue.False;
709private static ConstantValue? UnboxConstant(BoundExpression expression)
745return new BoundUnaryOperator(syntax, UnaryOperatorKind.BoolLogicalNegation, converted, ConstantValue.NotAvailable, MethodSymbol.None, constrainedToTypeOpt: null, LookupResultKind.Viable, boolean)
803return MakeLiteral(syntax, ConstantValue.Create(kind.Operator() == BinaryOperatorKind.Equal), boolType);
830BoundExpression result = MakeLiteral(syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.NotEqual), boolType);
891return MakeLiteral(syntax, ConstantValue.Create(value), _compilation.GetSpecialType(SpecialType.System_Boolean));
1181rewrittenAlternative: MakeLiteral(syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.Equal), boolType),
1548ConstantValue.NotAvailable,
1871return MakeLiteral(syntax, ConstantValue.Create(kind == BinaryOperatorKind.NullableNullEqual), returnType);
1910new BoundUnaryOperator(syntax, UnaryOperatorKind.BoolLogicalNegation, call, ConstantValue.NotAvailable, null, constrainedToTypeOpt: null, LookupResultKind.Viable, returnType);
1917if (oldNode != null && (loweredLeft.ConstantValueOpt == ConstantValue.Null || loweredRight.ConstantValueOpt == ConstantValue.Null))
2011return MakeLiteral(syntax, ConstantValue.Create(rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType);
2013return MakeLiteral(syntax, ConstantValue.Create(!rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType);
2036MakeLiteral(syntax, ConstantValue.Null, objectType),
2056ConstantValue? rightConstantValue = loweredRight.ConstantValueOpt;
2069loweredRight = MakeLiteral(rightSyntax, ConstantValue.Create(shiftAmount), rightType);
2082MakeLiteral(rightSyntax, ConstantValue.Create(rightMask), rightType),
2128ConstantValue? rightConstantValue = loweredRight.ConstantValueOpt;
2202ConstantValue.NotAvailable,
2260var constVal = numericOperand.ConstantValueOpt;
2271var constVal = numericOperand.ConstantValueOpt;
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (9)
262ConstantValue? constantValueOpt,
297ConstantValue? constantValueOpt,
701ConstantValue? constantValueOpt = null)
1177MakeConversionNode(null, syntax, conditional.Consequence, conversion, @checked, explicitCastInCode: false, constantValueOpt: ConstantValue.NotAvailable, rewrittenType: type),
1178MakeConversionNode(null, syntax, conditional.Alternative, conversion, @checked, explicitCastInCode: false, constantValueOpt: ConstantValue.NotAvailable, rewrittenType: type),
1179ConstantValue.NotAvailable,
1328ConstantValue? constantValueOpt,
1542private BoundExpression RewriteDecimalConversion(SyntaxNode syntax, BoundExpression operand, TypeSymbol fromType, TypeSymbol toType, bool @checked, bool isImplicit, ConstantValue? constantValueOpt)
1573private BoundExpression RewriteDecimalConversionCore(SyntaxNode syntax, BoundExpression operand, TypeSymbol fromType, TypeSymbol toType, bool isImplicit, ConstantValue? constantValueOpt)
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (6)
390right: MakeLiteral(forEachSyntax, constantValue: ConstantValue.Null, type: null),
555MakeLiteral(forEachSyntax, ConstantValue.Default(SpecialType.System_Int32), intType));
734MakeLiteral(forEachSyntax, ConstantValue.Default(SpecialType.System_Int32), intType));
872constantValue: ConstantValue.Create(dimension, ConstantValueTypeDiscriminator.Int32),
927constantValue: ConstantValue.Create(dimension, ConstantValueTypeDiscriminator.Int32),
1040constantValue: ConstantValue.Create(1),
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_UnaryOperator.cs (17)
89var constant = UnboxConstant(loweredOperand);
90if (constant == ConstantValue.True || constant == ConstantValue.False)
337ConstantValue.NotAvailable,
722(TypeSymbol binaryOperandType, ConstantValue constantOne) = GetConstantOneForIncrement(_compilation, binaryOperatorKind);
835return RewriteConditionalOperator(syntax, condition, consequence, alternative, ConstantValue.NotAvailable, operand.Type, isRef: false);
1067private static (TypeSymbol, ConstantValue) GetConstantOneForIncrement(
1071ConstantValue constantOne;
1076constantOne = ConstantValue.Create(1);
1079constantOne = ConstantValue.Create(1U);
1082constantOne = ConstantValue.Create(1L);
1085constantOne = ConstantValue.Create(1LU);
1088constantOne = ConstantValue.Create(1);
1091constantOne = ConstantValue.Create(1U);
1094constantOne = ConstantValue.Create(1f);
1097constantOne = ConstantValue.Create(1.0);
1100constantOne = ConstantValue.Create(1m);
Lowering\SyntheticBoundNodeFactory.cs (21)
290return new BoundFieldAccess(Syntax, receiver, f, ConstantValue.NotAvailable, LookupResultKind.Viable, f.Type) { WasCompilerGenerated = true };
530expression = BoundConversion.Synthesized(Syntax, expression, conversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, CurrentFunction.ReturnType);
599return new BoundBinaryOperator(this.Syntax, kind, ConstantValue.NotAvailable, methodOpt: null, constrainedToTypeOpt: null, LookupResultKind.Viable, left, right, type) { WasCompilerGenerated = true };
672return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Byte)) { WasCompilerGenerated = true };
677return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Int32)) { WasCompilerGenerated = true };
685return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_UInt32)) { WasCompilerGenerated = true };
688public BoundLiteral Literal(ConstantValue value, TypeSymbol type)
1013var caseBuilder = ArrayBuilder<(ConstantValue Value, LabelSymbol label)>.GetInstance();
1024caseBuilder.Add((ConstantValue.Create(value), sectionLabel));
1064return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean)) { WasCompilerGenerated = true };
1069var stringConst = ConstantValue.Create(value);
1073public BoundLiteral StringLiteral(ConstantValue stringConst)
1081return StringLiteral(ConstantValue.Create(stringValue));
1084public BoundLiteral CharLiteral(ConstantValue charConst)
1092return CharLiteral(ConstantValue.Create(charValue));
1169BoundExpression nullLiteral = new BoundLiteral(syntax, ConstantValue.Null, type) { WasCompilerGenerated = true };
1639return Literal(ConstantValue.Create(rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType);
1641return Literal(ConstantValue.Create(rewrittenExpr.ConstantValueOpt.IsNull, ConstantValueTypeDiscriminator.Boolean), boolType);
1661return RewriteNullableNullEquality(syntax, operatorKind, rewrittenExpr, Literal(ConstantValue.Null, objectType), boolType);
1742new BoundUnaryOperator(syntax, UnaryOperatorKind.BoolLogicalNegation, call, ConstantValue.NotAvailable, methodOpt: null, constrainedToTypeOpt: null, LookupResultKind.Viable, returnType);
Symbols\Source\SourceComplexParameterSymbol.cs (34)
37protected ConstantValue _lazyDefaultSyntaxValue;
73_lazyDefaultSyntaxValue = ConstantValue.Unset;
84internal sealed override ConstantValue ExplicitDefaultConstantValue
102internal sealed override ConstantValue DefaultValueFromAttributes
107return (data != null && data.DefaultParameterValue != ConstantValue.Unset) ? data.DefaultParameterValue : ConstantValue.NotAvailable;
235private ConstantValue DefaultSyntaxValue
243var previousValue = Interlocked.CompareExchange(
246ConstantValue.Unset);
247Debug.Assert(previousValue == ConstantValue.Unset);
265DefaultValueFromAttributes == ConstantValue.NotAvailable)
324var defaultValue = DefaultValueFromAttributes;
353private ConstantValue MakeDefaultExpression(BindingDiagnosticBag diagnostics, out Binder? binder, out BoundParameterEqualsValue? parameterEqualsValue)
361return ConstantValue.NotAvailable;
367return ConstantValue.NotAvailable;
380return ConstantValue.Bad;
387return ConstantValue.Bad;
404var value = convertedExpression.ConstantValueOpt ?? ConstantValue.Null;
705ConstantValue value;
708value = ConstantValue.Bad;
717if (paramData.DefaultParameterValue == ConstantValue.Unset)
889var value = DecodeDefaultParameterValueAttribute(description, attribute, syntax, diagnose: true, diagnosticsOpt: diagnostics);
901private void VerifyParamDefaultValueMatchesAttributeIfAny(ConstantValue value, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
906var attrValue = data.DefaultParameterValue;
907if ((attrValue != ConstantValue.Unset) &&
916private ConstantValue DecodeDefaultParameterValueAttribute(AttributeDescription description, CSharpAttributeData attribute, AttributeSyntax node, bool diagnose, BindingDiagnosticBag diagnosticsOpt)
935private ConstantValue DecodeDefaultParameterValueAttribute(CSharpAttributeData attribute, AttributeSyntax node, bool diagnose, BindingDiagnosticBag diagnosticsOpt)
946return ConstantValue.Bad;
967var constantValueDiscriminator = ConstantValue.GetDiscriminator(specialType);
984return ConstantValue.Bad;
994return ConstantValue.Bad;
1005return ConstantValue.Bad;
1013return ConstantValue.Create(arg.ValueInternal, constantValueDiscriminator);
Symbols\Source\SourceFieldSymbol.cs (21)
174private ConstantValue _lazyConstantEarlyDecodingValue = Microsoft.CodeAnalysis.ConstantValue.Unset;
175private ConstantValue _lazyConstantValue = Microsoft.CodeAnalysis.ConstantValue.Unset;
248internal sealed override ConstantValue GetConstantValue(ConstantFieldsInProgress inProgress, bool earlyDecodingWellKnownAttributes)
250var value = this.GetLazyConstantValue(earlyDecodingWellKnownAttributes);
251if (value != Microsoft.CodeAnalysis.ConstantValue.Unset)
262return Microsoft.CodeAnalysis.ConstantValue.Unset;
293var value = this.GetLazyConstantValue(earlyDecodingWellKnownAttributes);
294if (value != Microsoft.CodeAnalysis.ConstantValue.Unset)
313(value != Microsoft.CodeAnalysis.ConstantValue.Unset) &&
335if (this.GetLazyConstantValue(earlyDecodingWellKnownAttributes) != Microsoft.CodeAnalysis.ConstantValue.Unset)
347var value = MakeConstantValue(builder, earlyDecodingWellKnownAttributes, diagnostics);
357private ConstantValue GetLazyConstantValue(bool earlyDecodingWellKnownAttributes)
363ConstantValue value,
368Debug.Assert(value != Microsoft.CodeAnalysis.ConstantValue.Unset);
369Debug.Assert((GetLazyConstantValue(earlyDecodingWellKnownAttributes) == Microsoft.CodeAnalysis.ConstantValue.Unset) ||
374Interlocked.CompareExchange(ref _lazyConstantEarlyDecodingValue, value, Microsoft.CodeAnalysis.ConstantValue.Unset);
378if (Interlocked.CompareExchange(ref _lazyConstantValue, value, Microsoft.CodeAnalysis.ConstantValue.Unset) == Microsoft.CodeAnalysis.ConstantValue.Unset)
392protected abstract ConstantValue MakeConstantValue(HashSet<SourceFieldSymbolWithSyntaxReference> dependencies, bool earlyDecodingWellKnownAttributes, BindingDiagnosticBag diagnostics);
Binding\Binder_Expressions.vb (15)
744Return New BoundNameOfOperator(node, argument, ConstantValue.Create(value), GetSpecialType(SpecialType.System_String, node, diagnostics))
1952Dim constVal As ConstantValue = Nothing
2026Dim constVal As ConstantValue
2122constantValueOpt As ConstantValue,
3720ConstantValue.Create(node.Name.Identifier.ValueText),
3740Dim arg = New BoundLiteral(name, ConstantValue.Create(node.Name.Identifier.ValueText), GetSpecialType(SpecialType.System_String, name, diagnostics))
3759Dim arg = New BoundLiteral(name, ConstantValue.Create(node.Name.Identifier.ValueText), GetSpecialType(SpecialType.System_String, name, diagnostics))
3801ConstantValue.Create(node.Name.Identifier.ValueText),
4111ConstantValue.Create(size.Size),
4295Dim lowerBoundConstantValueOpt As ConstantValue = lowerBound.ConstantValueOpt
4377Dim upperBoundConstantValueOpt As ConstantValue = upperBound.ConstantValueOpt
4387Dim one = New BoundLiteral(argumentSyntax, ConstantValue.Create(1), int32Type)
4425Dim cv As ConstantValue
4430cv = ConstantValue.Null
4441cv = ConstantValue.Create(value, specialType)
Binding\Binder_Invocation.vb (19)
902Dim constantValue As ConstantValue = Nothing
1088) As ConstantValue
1121Return ConstantValue.Create(AscW(argumentValue))
1135Return ConstantValue.Create(ChrW(argumentValue))
1164Return ConstantValue.Create(charValue)
1176Return ConstantValue.Create(ChrW(argumentValue))
2724ConstantValue.Create(items.Count),
3108Dim defaultConstantValue As ConstantValue = If(param.IsOptional, param.ExplicitDefaultConstantValue(DefaultParametersInProgress), Nothing)
3124Dim callerInfoValue As ConstantValue = Nothing
3127callerInfoValue = ConstantValue.Create(callerInfoOpt.SyntaxTree.GetDisplayLineNumber(GetCallerLocation(callerInfoOpt)))
3155callerInfoValue = ConstantValue.Create(container.Name)
3158callerInfoValue = ConstantValue.Create(callerInfoOpt.SyntaxTree.GetDisplayPath(callerInfoOpt.Span, Me.Compilation.Options.SourceReferenceResolver))
3174callerInfoValue = ConstantValue.Create(argumentSyntax.ToString())
3207defaultConstantValue = ConstantValue.Null
3223defaultConstantValue = ConstantValue.Create(1)
3225defaultConstantValue = ConstantValue.Default(SpecialType.System_Int32)
3260defaultArgument = New BoundLiteral(syntax, ConstantValue.Null, Nothing)
3272Dim argument = New BoundLiteral(syntax, ConstantValue.Null, param.Type).MakeCompilerGenerated()
3280defaultArgument = New BoundLiteral(syntax, ConstantValue.Null, Nothing)
Binding\Binder_Statements.vb (5)
771Dim nothingLiteral = New BoundLiteral(operand, ConstantValue.Nothing, Nothing).MakeCompilerGenerated()
3135ConstantValue.Create(1),
3470New BoundLiteral(collectionSyntax, ConstantValue.Nothing, Nothing),
3492New BoundLiteral(collectionSyntax, ConstantValue.Nothing, Nothing),
4592New BoundLiteral(syntaxNode, ConstantValue.Nothing, Nothing),
Binding\SyntheticBoundTrees\AnonymousTypeSyntheticMethods.vb (8)
131expression = New BoundLiteral(syntax, ConstantValue.Create(hashBase), integerType).MakeCompilerGenerated()
133Dim factorLiteral = New BoundLiteral(syntax, ConstantValue.Create(&HA5555529), integerType).MakeCompilerGenerated()
134Dim zeroLiteral = New BoundLiteral(syntax, ConstantValue.Create(0), integerType).MakeCompilerGenerated()
135Dim nothingLiteral = New BoundLiteral(syntax, ConstantValue.Nothing, objectType).MakeCompilerGenerated()
205Dim nothingLiteral = New BoundLiteral(syntax, ConstantValue.Nothing, objectType).MakeCompilerGenerated()
367New BoundLiteral(syntax, ConstantValue.Create(numberOfFields),
375New BoundLiteral(syntax, ConstantValue.Nothing,
377New BoundLiteral(syntax, ConstantValue.Create(formatString),
Binding\SyntheticBoundTrees\SynthesizedStringSwitchHashMethod.vb (4)
96F.Assignment(F.Local(hashCode, True), New BoundLiteral(Me.Syntax, ConstantValue.Create(CUInt(2166136261)), hashCode.Type)),
102F.Assignment(F.Local(i, True), New BoundLiteral(Me.Syntax, ConstantValue.Create(0), i.Type)),
111New BoundLiteral(Me.Syntax, ConstantValue.Create(CUInt(16777619)), hashCode.Type))),
116New BoundLiteral(Me.Syntax, ConstantValue.Create(1), i.Type))),
CodeGen\EmitStatement.vb (11)
504Dim constOp As ConstantValue = condition.Left.ConstantValueOpt
939Dim caseLabelsForEmit As KeyValuePair(Of ConstantValue, Object)() = GetCaseLabelsForEmitSwitchHeader(caseBlocks, caseBlockLabels, fallThroughLabel)
973) As KeyValuePair(Of ConstantValue, Object)()
979Dim labelsBuilder = ArrayBuilder(Of KeyValuePair(Of ConstantValue, Object)).GetInstance()
980Dim constantsSet = New HashSet(Of ConstantValue)(New SwitchConstantValueHelper.SwitchLabelsComparer())
990Dim constant As ConstantValue
1024labelsBuilder.Add(New KeyValuePair(Of ConstantValue, Object)(constant, caseBlockLabel))
1041Private Sub EmitSwitchTableHeader(selectExpression As BoundExpression, caseLabels As KeyValuePair(Of ConstantValue, Object)(), fallThroughLabel As LabelSymbol)
1086Private Sub EmitStringSwitchJumpTable(caseLabels As KeyValuePair(Of ConstantValue, Object)(), fallThroughLabel As LabelSymbol, key As LocalDefinition, syntaxNode As SyntaxNode)
1147Private Sub EmitStringCompareAndBranch(key As LocalOrParameter, syntaxNode As SyntaxNode, stringConstant As ConstantValue, targetLabel As Object, stringCompareMethodRef As Microsoft.Cci.IReference)
1176_builder.EmitConstantValue(ConstantValue.False)
Generated\BoundNodes.xml.Generated.vb (41)
1358Public Sub New(syntax As SyntaxNode, operatorKind As UnaryOperatorKind, operand As BoundExpression, checked As Boolean, constantValueOpt As ConstantValue, type As TypeSymbol, Optional hasErrors As Boolean = False)
1397Private ReadOnly _ConstantValueOpt As ConstantValue
1398Public Overrides ReadOnly Property ConstantValueOpt As ConstantValue
1409Public Function Update(operatorKind As UnaryOperatorKind, operand As BoundExpression, checked As Boolean, constantValueOpt As ConstantValue, type As TypeSymbol) As BoundUnaryOperator
1510Public Sub New(syntax As SyntaxNode, operatorKind As BinaryOperatorKind, left As BoundExpression, right As BoundExpression, checked As Boolean, constantValueOpt As ConstantValue, type As TypeSymbol, Optional hasErrors As Boolean = False)
1558Private ReadOnly _ConstantValueOpt As ConstantValue
1559Public Overrides ReadOnly Property ConstantValueOpt As ConstantValue
1570Public Function Update(operatorKind As BinaryOperatorKind, left As BoundExpression, right As BoundExpression, checked As Boolean, constantValueOpt As ConstantValue, type As TypeSymbol) As BoundBinaryOperator
1908Public Sub New(syntax As SyntaxNode, condition As BoundExpression, whenTrue As BoundExpression, whenFalse As BoundExpression, constantValueOpt As ConstantValue, type As TypeSymbol, Optional hasErrors As Boolean = False)
1949Private ReadOnly _ConstantValueOpt As ConstantValue
1950Public Overrides ReadOnly Property ConstantValueOpt As ConstantValue
1961Public Function Update(condition As BoundExpression, whenTrue As BoundExpression, whenFalse As BoundExpression, constantValueOpt As ConstantValue, type As TypeSymbol) As BoundTernaryConditionalExpression
1974Public Sub New(syntax As SyntaxNode, testExpression As BoundExpression, convertedTestExpression As BoundExpression, testExpressionPlaceholder As BoundRValuePlaceholder, elseExpression As BoundExpression, constantValueOpt As ConstantValue, type As TypeSymbol, Optional hasErrors As Boolean = False)
2022Private ReadOnly _ConstantValueOpt As ConstantValue
2023Public Overrides ReadOnly Property ConstantValueOpt As ConstantValue
2034Public Function Update(testExpression As BoundExpression, convertedTestExpression As BoundExpression, testExpressionPlaceholder As BoundRValuePlaceholder, elseExpression As BoundExpression, constantValueOpt As ConstantValue, type As TypeSymbol) As BoundBinaryConditionalExpression
2066Public Sub New(syntax As SyntaxNode, operand As BoundExpression, conversionKind As ConversionKind, checked As Boolean, explicitCastInCode As Boolean, constantValueOpt As ConstantValue, extendedInfoOpt As BoundExtendedConversionInfo, type As TypeSymbol, Optional hasErrors As Boolean = False)
2114Private ReadOnly _ConstantValueOpt As ConstantValue
2115Public Overrides ReadOnly Property ConstantValueOpt As ConstantValue
2133Public Function Update(operand As BoundExpression, conversionKind As ConversionKind, checked As Boolean, explicitCastInCode As Boolean, constantValueOpt As ConstantValue, extendedInfoOpt As BoundExtendedConversionInfo, type As TypeSymbol) As BoundConversion
2297Public Sub New(syntax As SyntaxNode, operand As BoundExpression, conversionKind As ConversionKind, suppressVirtualCalls As Boolean, constantValueOpt As ConstantValue, relaxationLambdaOpt As BoundLambda, type As TypeSymbol, Optional hasErrors As Boolean = False)
2337Private ReadOnly _ConstantValueOpt As ConstantValue
2338Public Overrides ReadOnly Property ConstantValueOpt As ConstantValue
2356Public Function Update(operand As BoundExpression, conversionKind As ConversionKind, suppressVirtualCalls As Boolean, constantValueOpt As ConstantValue, relaxationLambdaOpt As BoundLambda, type As TypeSymbol) As BoundDirectCast
2369Public Sub New(syntax As SyntaxNode, operand As BoundExpression, conversionKind As ConversionKind, constantValueOpt As ConstantValue, relaxationLambdaOpt As BoundLambda, type As TypeSymbol, Optional hasErrors As Boolean = False)
2401Private ReadOnly _ConstantValueOpt As ConstantValue
2402Public Overrides ReadOnly Property ConstantValueOpt As ConstantValue
2420Public Function Update(operand As BoundExpression, conversionKind As ConversionKind, constantValueOpt As ConstantValue, relaxationLambdaOpt As BoundLambda, type As TypeSymbol) As BoundTryCast
3017Public Sub New(syntax As SyntaxNode, method As MethodSymbol, methodGroupOpt As BoundMethodGroup, receiverOpt As BoundExpression, arguments As ImmutableArray(Of BoundExpression), defaultArguments As BitVector, constantValueOpt As ConstantValue, isLValue As Boolean, suppressObjectClone As Boolean, type As TypeSymbol, Optional hasErrors As Boolean = False)
3075Private ReadOnly _ConstantValueOpt As ConstantValue
3076Public Overrides ReadOnly Property ConstantValueOpt As ConstantValue
3101Public Function Update(method As MethodSymbol, methodGroupOpt As BoundMethodGroup, receiverOpt As BoundExpression, arguments As ImmutableArray(Of BoundExpression), defaultArguments As BitVector, constantValueOpt As ConstantValue, isLValue As Boolean, suppressObjectClone As Boolean, type As TypeSymbol) As BoundCall
5881Public Sub New(syntax As SyntaxNode, value As ConstantValue, type As TypeSymbol, hasErrors As Boolean)
5894Public Sub New(syntax As SyntaxNode, value As ConstantValue, type As TypeSymbol)
5905Private ReadOnly _Value As ConstantValue
5906Public ReadOnly Property Value As ConstantValue
5917Public Function Update(value As ConstantValue, type As TypeSymbol) As BoundLiteral
9119Public Sub New(syntax As SyntaxNode, argument As BoundExpression, constantValueOpt As ConstantValue, type As TypeSymbol, Optional hasErrors As Boolean = False)
9142Private ReadOnly _ConstantValueOpt As ConstantValue
9143Public Overrides ReadOnly Property ConstantValueOpt As ConstantValue
9154Public Function Update(argument As BoundExpression, constantValueOpt As ConstantValue, type As TypeSymbol) As BoundNameOfOperator
Lowering\LocalRewriter\LocalRewriter_BinaryOperators.vb (11)
496New BoundLiteral(node.Syntax, ConstantValue.Create(0I), memberSymbol.ReturnType),
535New BoundLiteral(node.Syntax, ConstantValue.Create(0I), memberSymbol.ReturnType),
705New BoundLiteral(node.Syntax, ConstantValue.Create(compareText), memberSymbol.Parameters(2).Type)),
710compare, New BoundLiteral(node.Syntax, ConstantValue.Create(0I), memberSymbol.ReturnType),
737New BoundLiteral(node.Syntax, ConstantValue.Create(compareText), memberSymbol.Parameters(2).Type)),
770New BoundLiteral(node.Syntax, ConstantValue.Create(If(compareText, 1I, 0I)), memberSymbol.Parameters(2).Type)),
1043Dim result = New BoundLiteral(node.Syntax, ConstantValue.False, node.Type.GetNullableUnderlyingType())
1332ConstantValue.True,
1333ConstantValue.False),
1339ConstantValue.False,
1340ConstantValue.True),
Lowering\LocalRewriter\LocalRewriter_Constant.vb (10)
16Private Function RewriteConstant(node As BoundExpression, constantValue As ConstantValue) As BoundExpression
31Private Shared Function RewriteDecimalConstant(node As BoundExpression, nodeValue As ConstantValue, currentMethod As MethodSymbol, diagnostics As BindingDiagnosticBag) As BoundExpression
97{New BoundLiteral(node.Syntax, ConstantValue.Create(value), decCtorInt64.Parameters(0).Type)}),
126New BoundLiteral(node.Syntax, ConstantValue.Create(UncheckedCInt(low)), decCtor.Parameters(0).Type),
127New BoundLiteral(node.Syntax, ConstantValue.Create(UncheckedCInt(mid)), decCtor.Parameters(1).Type),
128New BoundLiteral(node.Syntax, ConstantValue.Create(UncheckedCInt(high)), decCtor.Parameters(2).Type),
129New BoundLiteral(node.Syntax, ConstantValue.Create(isNegative), decCtor.Parameters(3).Type),
130New BoundLiteral(node.Syntax, ConstantValue.Create(scale), decCtor.Parameters(4).Type)),
138Private Shared Function RewriteDateConstant(node As BoundExpression, nodeValue As ConstantValue, currentMethod As MethodSymbol, diagnostics As BindingDiagnosticBag) As BoundExpression
175{New BoundLiteral(node.Syntax, ConstantValue.Create(dt.Ticks), dtCtorInt64.Parameters(0).Type)}),
Lowering\LocalRewriter\LocalRewriter_LateBindingHelpers.vb (12)
75Dim bounds As BoundExpression = New BoundLiteral(node, ConstantValue.Create(flags.Length), intType)
115Dim bounds As BoundExpression = New BoundLiteral(node, ConstantValue.Create(rewrittenArguments.Length), intType)
143Dim indexExpr As BoundExpression = New BoundLiteral(node, ConstantValue.Create(indexVal), intType)
204Dim bounds As BoundExpression = New BoundLiteral(node, ConstantValue.Create(rewrittenArguments.Length + 1), intType)
254Dim indexExpr As BoundExpression = New BoundLiteral(node, ConstantValue.Create(index), intType)
276Dim bounds As BoundExpression = New BoundLiteral(node, ConstantValue.Default(ConstantValueTypeDiscriminator.Int32), intType)
280Dim bounds As BoundExpression = New BoundLiteral(node, ConstantValue.Create(rewrittenArguments.Length), intType)
329Dim bounds As BoundExpression = New BoundLiteral(node, ConstantValue.Create(initializer.Initializers.Length), intType)
347Dim index As BoundExpression = New BoundLiteral(syntax, ConstantValue.Create(argNum), intType)
929Return New BoundLiteral(node, ConstantValue.Create(value), stringType)
937Return New BoundLiteral(node, ConstantValue.Create(value), booleanType)
953Dim bounds As BoundExpression = New BoundLiteral(node, ConstantValue.Create(types.Length), intType)
Lowering\LocalRewriter\LocalRewriter_LocalDeclaration.vb (5)
212New BoundLiteral(syntax, ConstantValue.Nothing, objectType),
226ImmutableArray.Create(Of BoundExpression)(flag, newFlagInstance, New BoundLiteral(syntax, ConstantValue.Nothing, flag.Type)),
266Dim two = New BoundLiteral(syntax, ConstantValue.Create(2S), flagState.Type)
270New BoundLiteral(syntax, ConstantValue.Default(ConstantValueTypeDiscriminator.Int16), flagState.Type),
320New BoundLiteral(syntax, ConstantValue.Create(1S), flagState.Type),
Lowering\LocalRewriter\LocalRewriter_NullableHelpers.vb (6)
67hasValueExpr = New BoundLiteral(operand.Syntax, ConstantValue.True, Me.GetSpecialType(SpecialType.System_Boolean))
186New BoundLiteral(expr.Syntax, ConstantValue.False, expr.Type.GetNullableUnderlyingType()))
300Return WrapInNullable(New BoundLiteral(syntax, ConstantValue.False, booleanType), nullableOfBoolean)
306Return WrapInNullable(New BoundLiteral(syntax, ConstantValue.True, booleanType), nullableOfBoolean)
484Return New BoundLiteral(syntax, ConstantValue.Nothing, type)
526Return MakeSequence(syntax, condition, If(ifConditionConst Is ConstantValue.True, whenTrue, whenFalse))
Lowering\SyntheticBoundNodeFactory.vb (8)
439Dim boundNode = New BoundLiteral(_syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean))
445Dim boundNode = New BoundLiteral(_syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Int32))
758Dim boundNode = New BoundLiteral(_syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_String))
763Public Function StringLiteral(value As ConstantValue) As BoundLiteral
814Dim nullLiteral As BoundExpression = New BoundLiteral(_syntax, ConstantValue.Null, Nothing)
821Dim nullLiteral As BoundExpression = New BoundLiteral(_syntax, ConstantValue.Null, type)
826Dim nullLiteral As BoundExpression = New BoundLiteral(_syntax, ConstantValue.Null, Nothing)
992Dim boundNode = New BoundConversion(_syntax, arg, convKind, isChecked, True, ConstantValue.NotAvailable, type)
Semantics\CompileTimeCalculations.vb (58)
146Friend Function GetConstantValueAsInt64(ByRef value As ConstantValue) As Long
163Friend Function GetConstantValue(type As ConstantValueTypeDiscriminator, value As Long) As ConstantValue
164Dim result As ConstantValue
167Case ConstantValueTypeDiscriminator.SByte : result = ConstantValue.Create(UncheckedCSByte(value))
168Case ConstantValueTypeDiscriminator.Byte : result = ConstantValue.Create(UncheckedCByte(value))
169Case ConstantValueTypeDiscriminator.Int16 : result = ConstantValue.Create(UncheckedCShort(value))
170Case ConstantValueTypeDiscriminator.UInt16 : result = ConstantValue.Create(UncheckedCUShort(value))
171Case ConstantValueTypeDiscriminator.Int32 : result = ConstantValue.Create(UncheckedCInt(value))
172Case ConstantValueTypeDiscriminator.UInt32 : result = ConstantValue.Create(UncheckedCUInt(value))
173Case ConstantValueTypeDiscriminator.Int64 : result = ConstantValue.Create(value)
174Case ConstantValueTypeDiscriminator.UInt64 : result = ConstantValue.Create(UncheckedCULng(value))
175Case ConstantValueTypeDiscriminator.Char : result = ConstantValue.Create(ChrW(UncheckedCInt(value)))
176Case ConstantValueTypeDiscriminator.Boolean : result = ConstantValue.Create(If(value = 0, False, True))
177Case ConstantValueTypeDiscriminator.DateTime : result = ConstantValue.Create(New DateTime(value))
232If Not ConstantValue.IsBooleanType(sourceType) AndAlso
233(ConstantValue.IsUnsignedIntegralType(sourceType) Xor ConstantValue.IsUnsignedIntegralType(resultType)) Then
237If Not ConstantValue.IsUnsignedIntegralType(sourceType) Then
242Debug.Assert(Not ConstantValue.IsUnsignedIntegralType(resultType), "Expected signed Target type!!!")
293) As ConstantValue
295Debug.Assert(ConstantValue.IsIntegralType(sourceType) OrElse ConstantValue.IsBooleanType(sourceType) OrElse ConstantValue.IsCharType(sourceType),
298If ConstantValue.IsIntegralType(targetType) OrElse ConstantValue.IsBooleanType(targetType) OrElse ConstantValue.IsCharType(targetType) Then
302If ConstantValue.IsStringType(targetType) Then
304If ConstantValue.IsCharType(sourceType) Then
305Return ConstantValue.Create(New String(ChrW(UncheckedCInt(sourceValue)), 1))
309If ConstantValue.IsFloatingType(targetType) Then
311If(ConstantValue.IsUnsignedIntegralType(sourceType), CType(UncheckedCULng(sourceValue), Double), CType(sourceValue, Double)),
316If ConstantValue.IsDecimalType(targetType) Then
322If Not ConstantValue.IsUnsignedIntegralType(sourceType) AndAlso sourceValue < 0 Then
350) As ConstantValue
354If (ConstantValue.IsBooleanType(targetType)) Then
362If ConstantValue.IsIntegralType(targetType) OrElse ConstantValue.IsCharType(targetType) Then
364overflow = DetectFloatingToIntegralOverflow(sourceValue, ConstantValue.IsUnsignedIntegralType(targetType))
401If ConstantValue.IsFloatingType(targetType) Then
408Return ConstantValue.Create(CType(resultValue, Single))
412Return ConstantValue.Create(resultValue)
415If ConstantValue.IsDecimalType(targetType) Then
430Return ConstantValue.Bad
440) As ConstantValue
444If ConstantValue.IsIntegralType(targetType) OrElse ConstantValue.IsCharType(targetType) Then
465If ConstantValue.IsUnsignedIntegralType(targetType) OrElse
496If ConstantValue.IsFloatingType(targetType) OrElse ConstantValue.IsBooleanType(targetType) Then
507If ConstantValue.IsDecimalType(targetType) Then
508Return ConstantValue.Create(sourceValue)
512Return ConstantValue.Bad
670Friend Function AdjustConstantValueFromMetadata(value As ConstantValue, targetType As TypeSymbol, isByRefParamValue As Boolean) As ConstantValue
710value = ConstantValue.Nothing
712value = ConstantValue.Bad
719value = ConstantValue.Create(New DateTime(value.Int64Value))
753If ConstantValue.IsUnsignedIntegralType(resultType) Then
Semantics\Operators.vb (45)
707) As ConstantValue
714Dim operandValue As ConstantValue = operand.ConstantValueOpt
722Dim result As ConstantValue = Nothing
779result = ConstantValue.Create(CType(value, Single))
781result = ConstantValue.Create(value)
797result = ConstantValue.Create(value)
802result = ConstantValue.Create(Not operandValue.BooleanValue)
1027) As ConstantValue
1037Dim leftConstantValue As ConstantValue = left.ConstantValueOpt
1038Dim rightConstantValue As ConstantValue = right.ConstantValueOpt
1051Dim result As ConstantValue = Nothing
1121left As ConstantValue,
1122right As ConstantValue,
1127) As ConstantValue
1133Dim result As ConstantValue
1175result = ConstantValue.Create(resultValue)
1285result = ConstantValue.Bad
1296left As ConstantValue,
1297right As ConstantValue,
1300) As ConstantValue
1304Dim result As ConstantValue
1336result = ConstantValue.Create(resultValue)
1407result = ConstantValue.Create(CType(resultValue, Single))
1409result = ConstantValue.Create(resultValue)
1419left As ConstantValue,
1420right As ConstantValue,
1423) As ConstantValue
1427Dim result As ConstantValue
1460result = ConstantValue.Create(resultValue)
1493result = ConstantValue.Bad
1495result = ConstantValue.Create(resultValue)
1507left As ConstantValue,
1508right As ConstantValue
1509) As ConstantValue
1512Dim result As ConstantValue
1523Return ConstantValue.Bad
1527result = ConstantValue.CreateFromRope(Rope.Concat(leftValue, rightValue))
1529Return ConstantValue.Bad
1567result = ConstantValue.Create(stringComparisonSucceeds)
1578left As ConstantValue,
1579right As ConstantValue
1580) As ConstantValue
1583Dim result As ConstantValue
1627result = ConstantValue.Create(operationSucceeds)
3321Friend Overrides ReadOnly Property ExplicitDefaultConstantValue(inProgress As SymbolsInProgress(Of ParameterSymbol)) As ConstantValue
Symbols\Source\SynthesizedSubmissionConstructorSymbol.vb (3)
79New BoundArrayAccess(syntax, submissionArrayReference, ImmutableArray.Create(Of BoundExpression)(New BoundLiteral(syntax, ConstantValue.Create(slotIndex), intType)), isLValue:=True, type:=objectType),
93New BoundArrayAccess(syntax, submissionArrayReference, ImmutableArray.Create(Of BoundExpression)(New BoundLiteral(syntax, ConstantValue.Create(0), intType)), isLValue:=False, type:=objectType),
113New BoundArrayAccess(syntax, submissionArrayReference, ImmutableArray.Create(Of BoundExpression)(New BoundLiteral(syntax, ConstantValue.Create(targetSubmissionId), intType)), isLValue:=False, type:=objectType),