Files

38 lines
1.3 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 BoundConditionalAccess : BoundExpression
{
public new TypeSymbol Type => base.Type;
public BoundExpression Receiver { get; }
public BoundExpression AccessExpression { get; }
public BoundConditionalAccess(SyntaxNode syntax, BoundExpression receiver, BoundExpression accessExpression, TypeSymbol type, bool hasErrors = false)
: base(BoundKind.ConditionalAccess, syntax, type, hasErrors || receiver.HasErrors() || accessExpression.HasErrors())
{
Receiver = receiver;
AccessExpression = accessExpression;
}
[DebuggerStepThrough]
public override BoundNode? Accept(BoundTreeVisitor visitor)
{
return visitor.VisitConditionalAccess(this);
}
public BoundConditionalAccess Update(BoundExpression receiver, BoundExpression accessExpression, TypeSymbol type)
{
if (receiver != Receiver || accessExpression != AccessExpression || !TypeSymbol.Equals(type, Type, (TypeCompareKind)0))
{
BoundConditionalAccess boundConditionalAccess = new BoundConditionalAccess(Syntax, receiver, accessExpression, type, base.HasErrors);
boundConditionalAccess.CopyAttributes(this);
return boundConditionalAccess;
}
return this;
}
}