39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using System.Diagnostics;
|
|
using Microsoft.CodeAnalysis.CSharp.Symbols;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp;
|
|
|
|
internal sealed class BoundBinaryPattern : BoundPattern
|
|
{
|
|
public bool Disjunction { get; }
|
|
|
|
public BoundPattern Left { get; }
|
|
|
|
public BoundPattern Right { get; }
|
|
|
|
public BoundBinaryPattern(SyntaxNode syntax, bool disjunction, BoundPattern left, BoundPattern right, TypeSymbol inputType, TypeSymbol narrowedType, bool hasErrors = false)
|
|
: base(BoundKind.BinaryPattern, syntax, inputType, narrowedType, hasErrors || left.HasErrors() || right.HasErrors())
|
|
{
|
|
Disjunction = disjunction;
|
|
Left = left;
|
|
Right = right;
|
|
}
|
|
|
|
[DebuggerStepThrough]
|
|
public override BoundNode? Accept(BoundTreeVisitor visitor)
|
|
{
|
|
return visitor.VisitBinaryPattern(this);
|
|
}
|
|
|
|
public BoundBinaryPattern Update(bool disjunction, BoundPattern left, BoundPattern right, TypeSymbol inputType, TypeSymbol narrowedType)
|
|
{
|
|
if (disjunction != Disjunction || left != Left || right != Right || !TypeSymbol.Equals(inputType, base.InputType, (TypeCompareKind)0) || !TypeSymbol.Equals(narrowedType, base.NarrowedType, (TypeCompareKind)0))
|
|
{
|
|
BoundBinaryPattern boundBinaryPattern = new BoundBinaryPattern(Syntax, disjunction, left, right, inputType, narrowedType, base.HasErrors);
|
|
boundBinaryPattern.CopyAttributes(this);
|
|
return boundBinaryPattern;
|
|
}
|
|
return this;
|
|
}
|
|
}
|