Binder\Binder_Statements.cs (2)
2644return BoundConversion.Synthesized(node, BindToTypeForErrorRecovery(expr), Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true);
2710return BoundConversion.Synthesized(node, expr, Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true);
FlowAnalysis\NullableWalker.cs (41)
247/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations, TypeWithState, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, bool, Optional<LocalState>,bool, Location, ArrayBuilder<VisitResult>)"/>.
2035var conv = (BoundConversion)node;
2492var conversion = (BoundConversion)expr;
3829if (node.Conversion is BoundConversion { Conversion: var conversion })
4629var expression = GetConversionIfApplicable(expressions[i], expressionNoConversion);
5123expr as BoundConversion,
5161expr as BoundConversion,
5335operand = ((BoundConversion)operand).Operand;
5529var conversion = (BoundConversion)possiblyConversion;
5638if ((node.RightOperand as BoundConversion)?.ExplicitCastInCode != false &&
5692if (node is BoundConversion boundConversion)
5793Debug.Assert(innerCondAccess.Receiver is not (BoundConditionalAccess or BoundConversion));
6959TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
7017elements = ((BoundCollectionExpression)((BoundConversion)argument).Operand).UnconvertedCollectionExpression.Elements.CastArray<BoundExpression>();
7346BoundConversion? conversionOpt,
8053var conversion = (BoundConversion)expr;
8263public override BoundNode? VisitConversion(BoundConversion node)
8524BoundConversion? conversionOpt,
8748private static BoundConversion? GetConversionIfApplicable(BoundExpression? conversionOpt, BoundExpression convertedNode)
8755return conversionOpt == convertedNode ? null : (BoundConversion?)conversionOpt;
8778BoundConversion? conversionOpt,
8959if (useLegacyWarnings && conversionOperand is BoundConversion operandConversion && !operandConversion.ConversionKind.IsUserDefinedConversion())
9330BoundConversion? conversionOpt,
9482var conversionOpt = conversionExpression as BoundConversion;
9490conversionOpt = conversionOpt.Operand as BoundConversion;
9494private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
9510conversionOpt = conversionOpt.Operand as BoundConversion;
10109var right = node.Right;
10388var conv = (BoundConversion)expr;
10433if (node.OperandConversion is BoundConversion { Conversion: var operandConversion } && operandConversion.IsUserDefined && operandConversion.Method?.ParameterCount == 1)
10540node.LeftConversion as BoundConversion ?? node.Left,
11018if (!reportedDiagnostic && !(collectionExpression is BoundConversion { Operand: { IsSuppressed: true } }))
11106if (node.Expression is not BoundConversion { Operand.IsSuppressed: true } &&
11143isSuppressed: node.Expression is BoundConversion { Operand.IsSuppressed: true },
11268node.Operand as BoundConversion,
Generated\BoundNodes.xml.Generated.cs (17)
1858public BoundDeconstructionAssignmentOperator(SyntaxNode syntax, BoundTupleExpression left, BoundConversion right, bool isUsed, TypeSymbol type, bool hasErrors = false)
1873public BoundConversion Right { get; }
1879public BoundDeconstructionAssignmentOperator Update(BoundTupleExpression left, BoundConversion right, bool isUsed, TypeSymbol type)
2981public BoundConversion Update(BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, ImmutableArray<MethodSymbol> originalUserDefinedConversionsOpt, TypeSymbol type)
2985var result = new BoundConversion(this.Syntax, operand, conversion, isBaseConversion, @checked, explicitCastInCode, constantValueOpt, conversionGroupOpt, originalUserDefinedConversionsOpt, type, this.HasErrors);
8979return VisitConversion((BoundConversion)node, arg);
9377public virtual R VisitConversion(BoundConversion node, A arg) => this.DefaultVisit(node, arg);
9613public virtual BoundNode? VisitConversion(BoundConversion node) => this.DefaultVisit(node);
10039public override BoundNode? VisitConversion(BoundConversion node)
11059BoundConversion right = (BoundConversion)this.Visit(node.Right);
11238public override BoundNode? VisitConversion(BoundConversion node)
12807BoundConversion right = (BoundConversion)this.Visit(node.Right);
13265public override BoundNode? VisitConversion(BoundConversion node)
13269BoundConversion updatedNode;
15623public override TreeDumperNode VisitConversion(BoundConversion node, object? arg) => new TreeDumperNode("conversion", null, new TreeDumperNode[]
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (12)
18public override BoundNode VisitConversion(BoundConversion node)
251var conversion = (BoundConversion)rewrittenNode;
263BoundConversion? oldNodeOpt,
298BoundConversion? oldNodeOpt,
1007case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable }, Operand: var convertedArgument }
1012case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable, UnderlyingConversions: var underlying }, Operand: var convertedArgument } conversion
1119rewrittenOperand = BoundConversion.SynthesizedNonUserDefined(syntax, rewrittenOperand, Conversion.ImplicitEnumeration, rewrittenOperandType);
1132var result = new BoundConversion(syntax, rewrittenOperand, new Conversion(conversionKind, method, false), @checked, explicitCastInCode: explicitCastInCode, conversionGroup, constantValueOpt: null, rewrittenType);
1360return BoundConversion.Synthesized(syntax, rewrittenOperand, conversion, @checked: @checked, explicitCastInCode: true, conversionGroupOpt: null, constantValueOpt: null, rewrittenType);
1402return BoundConversion.Synthesized(syntax, rewrittenOperand, conv, @checked: @checked, explicitCastInCode: true, conversionGroupOpt: null, constantValueOpt: null, rewrittenType);
1523return BoundConversion.Synthesized(syntax, rewrittenOperand, conversion, @checked, explicitCastInCode: explicitCastInCode, conversionGroupOpt: null, constantValueOpt, rewrittenType);
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (18)
49case BoundConversion { Conversion: { Kind: ConversionKind.Identity }, Operand: var o }:
51case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitTupleLiteral }, Operand: var o }:
56case BoundConversion { Conversion: { Kind: var kind } c, Operand: var o } conversion when
70var newArgument = new BoundConversion(
88case BoundConversion { Conversion: { Kind: var kind }, Operand: var o } when
103if (expr is BoundConversion { ConversionKind: ConversionKind.ImplicitTuple, Conversion: var conversion } boundConversion)
120var convertedFieldAccess = new BoundConversion(
190case BoundConversion { Conversion: { Kind: ConversionKind.DefaultLiteral } }: // This conversion can be performed lazily, but need not be saved. It is treated as non-side-effecting.
191case BoundConversion { Conversion.IsTupleConversion: true }: // If we were not able to push this conversion down the tree before getting here, it must be performed early, otherwise it won't be properly lowered by this machinery.
193case BoundConversion { Conversion: { Kind: var conversionKind } conversion } when conversionMustBePerformedOnOriginalExpression(conversionKind):
196case BoundConversion { Conversion: { IsUserDefined: true } } conv when conv.ExplicitCastInCode || enclosingConversionWasExplicit:
199case BoundConversion conv:
401case BoundConversion { Conversion: { IsIdentity: true }, Operand: var o }:
403case BoundConversion { Conversion: { IsNullable: true, UnderlyingConversions: var underlying } conversion, Operand: var o }
435case BoundConversion { Conversion: { IsIdentity: true }, Operand: var o }:
437case BoundConversion { Conversion: { IsNullable: true, UnderlyingConversions: var nested }, Operand: var o } conv when
472BoundExpression MakeBoundConversion(BoundExpression expr, Conversion conversion, TypeWithAnnotations type, BoundConversion enclosing)
608return (expr is BoundConversion conv)
Lowering\SyntheticBoundNodeFactory.cs (2)
562expression = BoundConversion.Synthesized(Syntax, expression, conversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, CurrentFunction.ReturnType);
1234? BoundConversion.SynthesizedNonUserDefined(syntax, nullLiteral, Conversion.NullToPointer, type)