56 instantiations of BoundLiteral
Microsoft.CodeAnalysis.CSharp (56)
Binder\Binder_Await.cs (1)
640var receiver = new BoundLiteral(node, ConstantValue.Null, awaiterType);
Binder\Binder_Expressions.cs (4)
4562sizeArray[i] = new BoundLiteral( 4799sizeOpt = new BoundLiteral( 5438lengthOrCount = new BoundLiteral(expression.Syntax, ConstantValue.Create(length), @this.GetSpecialType(SpecialType.System_Int32, diagnostics, expression.Syntax)) { WasCompilerGenerated = true }; 7592return new BoundLiteral(node, cv, type);
Binder\Binder_InterpolatedString.cs (5)
137format = new BoundLiteral(interpolation.FormatClause, ConstantValue.Create(text), stringType, hasErrors); 168builder.Add(new BoundLiteral(content, constantValue, stringType)); 414expressions[0] = new BoundLiteral(syntax, ConstantValue.Create(formatString.ToStringAndFree()), GetSpecialType(Microsoft.CodeAnalysis.SpecialType.System_String, diagnostics, syntax)) { WasCompilerGenerated = true }; 820argumentsBuilder.Add(new BoundLiteral(syntax, ConstantValue.Create(baseStringLength), intType) { WasCompilerGenerated = true }); 822argumentsBuilder.Add(new BoundLiteral(syntax, ConstantValue.Create(numFormatHoles), intType) { WasCompilerGenerated = true });
Binder\Binder_Invocation.cs (6)
1733defaultValue = new BoundLiteral(syntax, ConstantValue.Create(line), Compilation.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true }; 1738defaultValue = new BoundLiteral(syntax, ConstantValue.Create(path), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true }; 1743defaultValue = new BoundLiteral(syntax, ConstantValue.Create(memberName), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true }; 1751defaultValue = new BoundLiteral(syntax, ConstantValue.Create(argument.Syntax.ToString()), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true }; 1774defaultValue = new BoundLiteral(syntax, defaultConstantValue, constantType) { WasCompilerGenerated = true }; 1881BoundExpression arraySize = new BoundLiteral(node, ConstantValue.Create(collectionArgs.Length), int32Type) { WasCompilerGenerated = true };
Binder\Binder_Operators.cs (3)
973return new BoundLiteral(node, ConstantValue.Create(kind == BinaryOperatorKind.Equal), GetSpecialType(SpecialType.System_Boolean, diagnostics, node)); 4711return new BoundLiteral(node, ConstantValue.Create((int)-2147483648), GetSpecialType(SpecialType.System_Int32, diagnostics, node)); 4726return new BoundLiteral(node, ConstantValue.Create(-9223372036854775808), GetSpecialType(SpecialType.System_Int64, diagnostics, node));
Binder\Binder_Statements.cs (1)
2297ConversionsBase.HasImplicitConstantExpressionConversion(new BoundLiteral(syntax, ConstantValue.Bad, sourceType), targetType))
Binder\DecisionDagBuilder_CheckOrReachability.cs (1)
1168new BoundLiteral(node.Syntax, constantValueOpt: ConstantValue.Null, type: node.InputType, hasErrors: false),
Binder\Semantics\Conversions\ConversionsBase.cs (1)
1772BoundLiteral intMaxValueLiteral = new BoundLiteral(syntaxNode, ConstantValue.Create(int.MaxValue), expectedAttributeType);
Compilation\CSharpCompilation.cs (1)
2292var dumbInstance = new BoundLiteral(syntax, ConstantValue.Null, namedType);
Compiler\MethodBodySynthesizer.cs (3)
106ImmutableArray.Create<BoundExpression>(new BoundLiteral(syntax, ConstantValue.Create(slotIndex), intType) { WasCompilerGenerated = true }), 126ImmutableArray.Create<BoundExpression>(new BoundLiteral(syntax, ConstantValue.Create(0), intType) { WasCompilerGenerated = true }), 155ImmutableArray.Create<BoundExpression>(new BoundLiteral(syntax, ConstantValue.Create(targetSubmissionIndex), intType) { WasCompilerGenerated = true }),
Generated\BoundNodes.xml.Generated.cs (1)
4363var result = new BoundLiteral(this.Syntax, constantValueOpt, type, this.HasErrors);
Lowering\LocalRewriter\LocalRewriter_Call.cs (1)
1631new BoundLiteral(
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (1)
921new BoundLiteral(
Lowering\LocalRewriter\LocalRewriter_Literal.cs (11)
47return new BoundLiteral(syntax, constantValue, type, hasErrors: constantValue.IsBad); 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))); 148arguments.Add(new BoundLiteral(syntax, ConstantValue.Create(constantValue.DateTimeValue.Ticks), _compilation.GetSpecialType(SpecialType.System_Int64)));
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (3)
209return new BoundLiteral(expr.Syntax, ConstantValue.Null, expr.Type); 264return new BoundLiteral(left.Syntax, ConstantValue.Create(nullnull.Kind == BinaryOperatorKind.Equal), boolType); 576return new BoundLiteral(left.Syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.Equal), boolType);
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (1)
408_factory.Convert(operandType, new BoundLiteral(syntax, ConstantValue.Null, objectType), Conversion.NullToPointer),
Lowering\SyntheticBoundNodeFactory.cs (8)
765return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Byte)) { WasCompilerGenerated = true }; 770return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Int32)) { WasCompilerGenerated = true }; 778return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_UInt32)) { WasCompilerGenerated = true }; 783return new BoundLiteral(Syntax, value, type) { WasCompilerGenerated = true }; 1187return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean)) { WasCompilerGenerated = true }; 1199return new BoundLiteral(Syntax, stringConst, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_String)) { WasCompilerGenerated = true }; 1210return new BoundLiteral(Syntax, charConst, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Char)) { WasCompilerGenerated = true }; 1292BoundExpression nullLiteral = new BoundLiteral(syntax, ConstantValue.Null, type) { WasCompilerGenerated = true };
Symbols\ReducedExtensionMethodSymbol.cs (2)
145var thisArgumentValue = new BoundLiteral(syntax, ConstantValue.Bad, thisType) { WasCompilerGenerated = true }; 147var otherArgumentValue = new BoundLiteral(syntax, ConstantValue.Bad, otherArgumentType) { WasCompilerGenerated = true };
Symbols\Source\SourceComplexParameterSymbol.cs (1)
356new BoundLiteral(parameterSyntax, defaultValue, Type));
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (1)
1227var receiverValue = new BoundLiteral(syntax, ConstantValue.Bad, receiverType) { WasCompilerGenerated = true };
79 references to BoundLiteral
Microsoft.CodeAnalysis.CSharp (79)
Binder\Binder_Attributes.cs (1)
391(arguments[argIndex].IsParamsArrayOrCollection && arguments[argIndex] is BoundArrayCreation { Bounds: [BoundLiteral { ConstantValueOpt.Value: 0 }] }) ?
Binder\Binder_Await.cs (1)
640var receiver = new BoundLiteral(node, ConstantValue.Null, awaiterType);
Binder\Binder_Expressions.cs (2)
7539private BoundLiteral BindLiteralConstant(LiteralExpressionSyntax node, BindingDiagnosticBag diagnostics) 8023if (boundLeft.Kind == BoundKind.Literal && ((BoundLiteral)boundLeft).ConstantValueOpt == ConstantValue.Null)
Binder\Binder_InterpolatedString.cs (7)
98BoundLiteral? format = null; 407Debug.Assert(part is BoundLiteral && part.ConstantValueOpt?.StringValue != null); 436=> parts.All(p => p is BoundLiteral or BoundStringInsert { Value.Type.SpecialType: SpecialType.System_String, Alignment: null, Format: null }); 887Debug.Assert(part is BoundLiteral { Type: { SpecialType: SpecialType.System_String }, ConstantValueOpt.IsString: true }); 920Debug.Assert(part is BoundLiteral or BoundStringInsert); 951var boundLiteral = (BoundLiteral)part;
Binder\Binder_Operators.cs (2)
4336BoundLiteral constant = BindIntegralMinValConstants(node, operand, diagnostics); 4673private BoundLiteral BindIntegralMinValConstants(PrefixUnaryExpressionSyntax node, BoundExpression operand, BindingDiagnosticBag diagnostics)
Binder\Binder_TupleOperators.cs (1)
101case BoundLiteral _:
Binder\ForEachLoopBinder.cs (1)
951if (collectionExpr is BoundLiteral && collectionExpr.ConstantValueOpt is { IsNull: true })
Binder\Semantics\Conversions\ConversionsBase.cs (1)
1772BoundLiteral intMaxValueLiteral = new BoundLiteral(syntaxNode, ConstantValue.Create(int.MaxValue), expectedAttributeType);
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (1)
1410=> argument is BoundLiteral { Type.SpecialType: SpecialType.System_String } &&
BoundTree\BoundNode.cs (1)
362this is BoundArrayCreation { Bounds: [BoundLiteral { WasCompilerGenerated: true }], InitializerOpt: BoundArrayInitialization { WasCompilerGenerated: true }, WasCompilerGenerated: true } or
BoundTree\BoundTreeVisitors.cs (1)
98return VisitLiteral(node as BoundLiteral, arg);
Compilation\CSharpCompilation.cs (1)
2292var dumbInstance = new BoundLiteral(syntax, ConstantValue.Null, namedType);
Compiler\AnonymousTypeMethodBodySynthesizer.cs (1)
205BoundLiteral boundHashFactor = null;
Compiler\MethodBodySynthesizer.Lowered.cs (1)
356ref BoundLiteral? boundHashFactor,
FlowAnalysis\AbstractFlowPass.cs (1)
1671public override BoundNode VisitLiteral(BoundLiteral node)
FlowAnalysis\NullableWalker.cs (1)
13361public override BoundNode? VisitLiteral(BoundLiteral node)
Generated\BoundNodes.xml.Generated.cs (17)
4359public BoundLiteral Update(ConstantValue? constantValueOpt, TypeSymbol? type) 4363var result = new BoundLiteral(this.Syntax, constantValueOpt, type, this.HasErrors); 8036public BoundStringInsert(SyntaxNode syntax, BoundExpression value, BoundExpression? alignment, BoundLiteral? format, bool isInterpolatedStringHandlerAppendCall, bool hasErrors = false) 8051public BoundLiteral? Format { get; } 8057public BoundStringInsert Update(BoundExpression value, BoundExpression? alignment, BoundLiteral? format, bool isInterpolatedStringHandlerAppendCall) 9304return VisitLiteral((BoundLiteral)node, arg); 9673public virtual R VisitLiteral(BoundLiteral node, A arg) => this.DefaultVisit(node, arg); 9914public virtual BoundNode? VisitLiteral(BoundLiteral node) => this.DefaultVisit(node); 10508public override BoundNode? VisitLiteral(BoundLiteral node) => null; 11832public override BoundNode? VisitLiteral(BoundLiteral node) 12500BoundLiteral? format = (BoundLiteral?)this.Visit(node.Format); 13969public override BoundNode? VisitLiteral(BoundLiteral node) 13976BoundLiteral updatedNode = node.Update(node.ConstantValueOpt, infoAndType.Type); 15173BoundLiteral? format = (BoundLiteral?)this.Visit(node.Format); 16472public override TreeDumperNode VisitLiteral(BoundLiteral node, object? arg) => new TreeDumperNode("literal", null, new TreeDumperNode[]
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (2)
557var literal = operand as BoundLiteral;
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (1)
449Debug.Assert(index is BoundParameterId or BoundLocalId or BoundLiteral);
Lowering\IteratorRewriter\IteratorMethodToStateMachineRewriter.cs (1)
297BoundLiteral result = this.F.Literal(!finished);
Lowering\LocalRewriter\LocalRewriter_Call.cs (3)
1097(array is BoundLocal && indices.All(e => e is BoundLocal or BoundLiteral))); 1327if (possibleParamsArray.IsParamsArrayOrCollection && !_inExpressionLambda && ((BoundArrayCreation)possibleParamsArray).Bounds is [BoundLiteral { ConstantValueOpt.Value: 0 }]) 1495if (paramsArray is BoundArrayCreation { Bounds: [BoundLiteral] bounds, InitializerOpt: BoundArrayInitialization { Initializers: var elements } initialization } creation)
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (1)
1542var otherElements = _factory.Literal(initialLength);
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (1)
964Debug.Assert(loweredIndices[i] is BoundLiteral);
Lowering\LocalRewriter\LocalRewriter_Literal.cs (2)
17public override BoundNode VisitLiteral(BoundLiteral node) 23private BoundExpression MakeLiteral(SyntaxNode syntax, ConstantValue constantValue, TypeSymbol? type, BoundLiteral? oldNodeOpt = null)
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (1)
305else if (argument is BoundNullCoalescingOperator { LeftOperand: { Type.SpecialType: SpecialType.System_String } left, RightOperand: BoundLiteral { ConstantValueOpt: { IsString: true, RopeValue.IsEmpty: true } } })
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (1)
177Debug.Assert(part is BoundLiteral && part.ConstantValueOpt?.StringValue is not null);
Lowering\SyntheticBoundNodeFactory.cs (12)
763public BoundLiteral Literal(byte value) 768public BoundLiteral Literal(int value) 773public BoundLiteral Literal(StateMachineState value) 776public BoundLiteral Literal(uint value) 781public BoundLiteral Literal(ConstantValue value, TypeSymbol type) 1185public BoundLiteral Literal(Boolean value) 1190public BoundLiteral Literal(string? value) 1196public BoundLiteral StringLiteral(ConstantValue stringConst) 1202public BoundLiteral StringLiteral(String stringValue) 1207public BoundLiteral CharLiteral(ConstantValue charConst) 1213public BoundLiteral CharLiteral(Char charValue) 1902var whenNull = kind == BinaryOperatorKind.NullableNullEqual ? Literal(true) : null;
Operations\CSharpOperationFactory.cs (8)
57return CreateBoundLiteralOperation((BoundLiteral)boundNode); 681internal ILiteralOperation CreateBoundLiteralOperation(BoundLiteral boundLiteral, bool @implicit = false) 1032Debug.Assert(!forceOperandImplicitLiteral || boundConversion.Operand is BoundLiteral); 1191? CreateBoundLiteralOperation((BoundLiteral)correctedConversionNode.Operand, @implicit: true) 2371builder.Add(CreateBoundInterpolatedStringTextOperation((BoundLiteral)part)); 2439BoundLiteral l => CreateBoundLiteralOperation(l, @implicit: true), 2440BoundConversion { Operand: BoundLiteral } c => CreateBoundConversionOperation(c, forceOperandImplicitLiteral: true), 2494private IInterpolatedStringTextOperation CreateBoundInterpolatedStringTextOperation(BoundLiteral boundNode)
Symbols\ReducedExtensionMethodSymbol.cs (3)
145var thisArgumentValue = new BoundLiteral(syntax, ConstantValue.Bad, thisType) { WasCompilerGenerated = true }; 147var otherArgumentValue = new BoundLiteral(syntax, ConstantValue.Bad, otherArgumentType) { WasCompilerGenerated = true }; 154var argument = (i == 0) ? thisArgumentValue : otherArgumentValue;
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (1)
1227var receiverValue = new BoundLiteral(syntax, ConstantValue.Bad, receiverType) { WasCompilerGenerated = true };
Symbols\Synthesized\Records\SynthesizedRecordGetHashCode.cs (1)
99BoundLiteral? boundHashFactor = null;