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

43 lines
1.4 KiB
C#

using System.Diagnostics;
using Microsoft.CodeAnalysis.CSharp.Symbols;
namespace Microsoft.CodeAnalysis.CSharp;
internal sealed class BoundObjectOrCollectionValuePlaceholder : BoundValuePlaceholderBase
{
public sealed override bool IsEquivalentToThisReference => false;
public new TypeSymbol Type => base.Type;
public bool IsNewInstance { get; }
public BoundObjectOrCollectionValuePlaceholder(SyntaxNode syntax, bool isNewInstance, TypeSymbol type, bool hasErrors)
: base(BoundKind.ObjectOrCollectionValuePlaceholder, syntax, type, hasErrors)
{
IsNewInstance = isNewInstance;
}
public BoundObjectOrCollectionValuePlaceholder(SyntaxNode syntax, bool isNewInstance, TypeSymbol type)
: base(BoundKind.ObjectOrCollectionValuePlaceholder, syntax, type)
{
IsNewInstance = isNewInstance;
}
[DebuggerStepThrough]
public override BoundNode? Accept(BoundTreeVisitor visitor)
{
return visitor.VisitObjectOrCollectionValuePlaceholder(this);
}
public BoundObjectOrCollectionValuePlaceholder Update(bool isNewInstance, TypeSymbol type)
{
if (isNewInstance != IsNewInstance || !TypeSymbol.Equals(type, Type, (TypeCompareKind)0))
{
BoundObjectOrCollectionValuePlaceholder boundObjectOrCollectionValuePlaceholder = new BoundObjectOrCollectionValuePlaceholder(Syntax, isNewInstance, type, base.HasErrors);
boundObjectOrCollectionValuePlaceholder.CopyAttributes(this);
return boundObjectOrCollectionValuePlaceholder;
}
return this;
}
}