Files

41 lines
1.5 KiB
C#
Raw Permalink Normal View History

2026-08-27 10:56:38 -06:00
using System.Diagnostics;
using Microsoft.CodeAnalysis.CSharp.Symbols;
namespace Microsoft.CodeAnalysis.CSharp;
internal sealed class BoundRangeExpression : BoundExpression
{
public new TypeSymbol Type => base.Type;
public BoundExpression? LeftOperandOpt { get; }
public BoundExpression? RightOperandOpt { get; }
public MethodSymbol? MethodOpt { get; }
public BoundRangeExpression(SyntaxNode syntax, BoundExpression? leftOperandOpt, BoundExpression? rightOperandOpt, MethodSymbol? methodOpt, TypeSymbol type, bool hasErrors = false)
: base(BoundKind.RangeExpression, syntax, type, hasErrors || leftOperandOpt.HasErrors() || rightOperandOpt.HasErrors())
{
LeftOperandOpt = leftOperandOpt;
RightOperandOpt = rightOperandOpt;
MethodOpt = methodOpt;
}
[DebuggerStepThrough]
public override BoundNode? Accept(BoundTreeVisitor visitor)
{
return visitor.VisitRangeExpression(this);
}
public BoundRangeExpression Update(BoundExpression? leftOperandOpt, BoundExpression? rightOperandOpt, MethodSymbol? methodOpt, TypeSymbol type)
{
if (leftOperandOpt != LeftOperandOpt || rightOperandOpt != RightOperandOpt || !SymbolEqualityComparer.ConsiderEverything.Equals(methodOpt, MethodOpt) || !TypeSymbol.Equals(type, Type, (TypeCompareKind)0))
{
BoundRangeExpression boundRangeExpression = new BoundRangeExpression(Syntax, leftOperandOpt, rightOperandOpt, methodOpt, type, base.HasErrors);
boundRangeExpression.CopyAttributes(this);
return boundRangeExpression;
}
return this;
}
}