Binder\Binder_InterpolatedString.cs (14)
438private bool TryBindUnconvertedBinaryOperatorToDefaultInterpolatedStringHandler(BoundBinaryOperator binaryOperator, BindingDiagnosticBag diagnostics, [NotNullWhen(true)] out BoundBinaryOperator? convertedBinaryOperator)
515private BoundBinaryOperator UpdateBinaryOperatorWithInterpolatedContents(BoundBinaryOperator originalOperator, ImmutableArray<ImmutableArray<BoundExpression>> appendCalls, InterpolatedStringHandlerData data, SyntaxNode rootSyntax, BindingDiagnosticBag diagnostics)
521Func<BoundBinaryOperator, BoundExpression, BoundExpression, (ImmutableArray<ImmutableArray<BoundExpression>>, TypeSymbol), BoundExpression> binaryOperatorFactory =
524var rewritten = (BoundBinaryOperator)originalOperator.RewriteInterpolatedStringAddition((appendCalls, @string), interpolationFactory, binaryOperatorFactory);
526return rewritten.Update(BoundBinaryOperator.UncommonData.InterpolatedStringHandlerAddition(data));
540static BoundBinaryOperator createBinaryOperator(BoundBinaryOperator original, BoundExpression left, BoundExpression right, (ImmutableArray<ImmutableArray<BoundExpression>> _, TypeSymbol @string) arg)
570BoundBinaryOperator binary => BindUnconvertedBinaryOperatorToInterpolatedStringHandlerType(binary, interpolatedStringHandlerType, diagnostics, additionalConstructorArguments, additionalConstructorRefKinds),
601private BoundBinaryOperator BindUnconvertedBinaryOperatorToInterpolatedStringHandlerType(
602BoundBinaryOperator binaryOperator,
628var result = UpdateBinaryOperatorWithInterpolatedContents(binaryOperator, appendCalls, data, binaryOperator.Syntax, diagnostics);
Binder\Binder_Operators.cs (9)
554&& left is BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true }
555&& right is BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true })
559return new BoundBinaryOperator(node, BinaryOperatorKind.StringConcatenation, BoundBinaryOperator.UncommonData.UnconvertedInterpolatedStringAddition(stringConstant), LookupResultKind.Empty, left, right, right.Type);
755private BoundExpression RebindSimpleBinaryOperatorAsConverted(BoundBinaryOperator unconvertedBinaryOperator, BindingDiagnosticBag diagnostics)
757if (TryBindUnconvertedBinaryOperatorToDefaultInterpolatedStringHandler(unconvertedBinaryOperator, diagnostics, out var convertedBinaryOperator))
765BoundExpression doRebind(BindingDiagnosticBag diagnostics, BoundBinaryOperator? current)
767var stack = ArrayBuilder<BoundBinaryOperator>.GetInstance();
772current = current.Left as BoundBinaryOperator;
783BoundBinaryOperator b => doRebind(diagnostics, b),
BoundTree\BoundNodeExtensions.cs (25)
108this BoundBinaryOperator binary,
111Action<BoundBinaryOperator, TArg>? binaryOperatorCallback = null)
114var stack = ArrayBuilder<BoundBinaryOperator>.GetInstance();
118while (stack.TryPop(out BoundBinaryOperator? current))
122case BoundBinaryOperator:
136case BoundBinaryOperator rightOperator:
154static void pushLeftNodes(BoundBinaryOperator binary, ArrayBuilder<BoundBinaryOperator> stack, TArg arg, Action<BoundBinaryOperator, TArg>? binaryOperatorCallback)
157BoundBinaryOperator? current = binary;
162current = current.Left as BoundBinaryOperator;
183this BoundBinaryOperator binary,
186Func<BoundBinaryOperator, TResult, TResult, TArg, TResult> binaryOperatorFactory)
196BoundBinaryOperator binary,
199Func<BoundBinaryOperator, TResult, TResult, TArg, TResult> binaryOperatorFactory,
203var originalStack = ArrayBuilder<BoundBinaryOperator>.GetInstance();
213BoundBinaryOperator => result!,
224BoundBinaryOperator binaryOperator => doRewrite(binaryOperator, arg, interpolatedStringFactory, binaryOperatorFactory, ref i),
237static void pushLeftNodes(BoundBinaryOperator binary, ArrayBuilder<BoundBinaryOperator> stack)
239BoundBinaryOperator? current = binary;
244current = current.Left as BoundBinaryOperator;
252BoundBinaryOperator { InterpolatedStringHandlerData: { } d } => d,
254BoundBinaryOperator or BoundInterpolatedString when !throwOnMissing => default,
255BoundBinaryOperator or BoundInterpolatedString => throw ExceptionUtilities.Unreachable(),
Generated\BoundNodes.xml.Generated.cs (11)
1660public BoundBinaryOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundBinaryOperator.UncommonData? data, LookupResultKind resultKind, BoundExpression left, BoundExpression right, TypeSymbol type, bool hasErrors = false)
1674public BoundBinaryOperator.UncommonData? Data { get; }
1680public BoundBinaryOperator Update(BinaryOperatorKind operatorKind, BoundBinaryOperator.UncommonData? data, LookupResultKind resultKind, BoundExpression left, BoundExpression right, TypeSymbol type)
1684var result = new BoundBinaryOperator(this.Syntax, operatorKind, data, resultKind, left, right, type, this.HasErrors);
8909return VisitBinaryOperator((BoundBinaryOperator)node, arg);
9342public virtual R VisitBinaryOperator(BoundBinaryOperator node, A arg) => this.DefaultVisit(node, arg);
9578public virtual BoundNode? VisitBinaryOperator(BoundBinaryOperator node) => this.DefaultVisit(node);
9906public override BoundNode? VisitBinaryOperator(BoundBinaryOperator node)
11016public override BoundNode? VisitBinaryOperator(BoundBinaryOperator node)
15290public override TreeDumperNode VisitBinaryOperator(BoundBinaryOperator node, object? arg) => new TreeDumperNode("binaryOperator", null, new TreeDumperNode[]
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (13)
16public override BoundNode VisitBinaryOperator(BoundBinaryOperator node)
113public BoundExpression VisitBinaryOperator(BoundBinaryOperator node, BoundUnaryOperator? applyParentUnaryOperator)
133var stack = ArrayBuilder<BoundBinaryOperator>.GetInstance();
135for (BoundBinaryOperator? current = node; current != null && current.ConstantValueOpt == null; current = current.Left as BoundBinaryOperator)
150BoundBinaryOperator original = stack.Pop();
160private static ImmutableArray<BoundExpression> CollectBinaryOperatorInterpolatedStringParts(BoundBinaryOperator node)
190BoundBinaryOperator? oldNode,
1995private BoundExpression RewriteStringEquality(BoundBinaryOperator? oldNode, SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, SpecialMember member)
2127BoundBinaryOperator? oldNode,
2189BoundBinaryOperator? oldNode,
2240var result = oldNode == null
2440var multiplication = _factory.Binary(multiplicationKind, multiplicationResultType, numericOperand, sizeOfExpression);
Lowering\SyntheticBoundNodeFactory.cs (11)
629public BoundBinaryOperator Binary(BinaryOperatorKind kind, TypeSymbol type, BoundExpression left, BoundExpression right)
648public BoundBinaryOperator LogicalAnd(BoundExpression left, BoundExpression right)
655public BoundBinaryOperator LogicalOr(BoundExpression left, BoundExpression right)
662public BoundBinaryOperator IntEqual(BoundExpression left, BoundExpression right)
667public BoundBinaryOperator ObjectEqual(BoundExpression left, BoundExpression right)
678public BoundBinaryOperator ObjectNotEqual(BoundExpression left, BoundExpression right)
683public BoundBinaryOperator IntNotEqual(BoundExpression left, BoundExpression right)
688public BoundBinaryOperator IntLessThan(BoundExpression left, BoundExpression right)
693public BoundBinaryOperator IntGreaterThanOrEqual(BoundExpression left, BoundExpression right)
698public BoundBinaryOperator IntSubtract(BoundExpression left, BoundExpression right)
703public BoundBinaryOperator IntMultiply(BoundExpression left, BoundExpression right)
Operations\CSharpOperationFactory.cs (8)
1448if (boundBinaryOperatorBase is BoundBinaryOperator { InterpolatedStringHandlerData: not null } binary)
1462} while (currentBinary is not null and not BoundBinaryOperator { InterpolatedStringHandlerData: not null });
1473BoundBinaryOperator binaryOp => CreateBoundBinaryOperatorOperation(binaryOp, left, right),
1507private IBinaryOperation CreateBoundBinaryOperatorOperation(BoundBinaryOperator boundBinaryOperator, IOperation left, IOperation right)
1536private IOperation CreateBoundInterpolatedStringBinaryOperator(BoundBinaryOperator boundBinaryOperator)
1542Func<BoundBinaryOperator, IOperation, IOperation, (CSharpOperationFactory, InterpolatedStringHandlerData), IOperation> createBinaryOperator
1554BoundBinaryOperator boundBinaryOperator,
2439case BoundBinaryOperator binaryOperator: