Files
2026-08-27 10:56:38 -06:00

41 lines
1.3 KiB
C#

using System.Collections.Immutable;
using System.Diagnostics;
using Microsoft.CodeAnalysis.CSharp.Symbols;
namespace Microsoft.CodeAnalysis.CSharp;
internal sealed class BoundNameOfOperator : BoundExpression
{
protected override ImmutableArray<BoundNode?> Children => ImmutableArray.Create((BoundNode)Argument);
public new TypeSymbol Type => base.Type;
public BoundExpression Argument { get; }
public override ConstantValue ConstantValueOpt { get; }
public BoundNameOfOperator(SyntaxNode syntax, BoundExpression argument, ConstantValue constantValueOpt, TypeSymbol type, bool hasErrors = false)
: base(BoundKind.NameOfOperator, syntax, type, hasErrors || argument.HasErrors())
{
Argument = argument;
ConstantValueOpt = constantValueOpt;
}
[DebuggerStepThrough]
public override BoundNode? Accept(BoundTreeVisitor visitor)
{
return visitor.VisitNameOfOperator(this);
}
public BoundNameOfOperator Update(BoundExpression argument, ConstantValue constantValueOpt, TypeSymbol type)
{
if (argument != Argument || constantValueOpt != ConstantValueOpt || !TypeSymbol.Equals(type, Type, (TypeCompareKind)0))
{
BoundNameOfOperator boundNameOfOperator = new BoundNameOfOperator(Syntax, argument, constantValueOpt, type, base.HasErrors);
boundNameOfOperator.CopyAttributes(this);
return boundNameOfOperator;
}
return this;
}
}