35 lines
1.6 KiB
C#
35 lines
1.6 KiB
C#
using System.Collections.Immutable;
|
|||
|
|
using System.Diagnostics;
|
||
|
|
using Microsoft.CodeAnalysis.CSharp.Symbols;
|
||
|
|
|
||
|
|
namespace Microsoft.CodeAnalysis.CSharp;
|
||
|
|
|
||
|
|
internal sealed class BoundConvertedStackAllocExpression : BoundStackAllocArrayCreationBase
|
||
|
|
{
|
||
|
|
protected override ImmutableArray<BoundNode?> Children => StaticCast<BoundNode>.From<BoundExpression>(BoundStackAllocArrayCreationBase.GetChildInitializers(base.InitializerOpt).Insert(0, base.Count));
|
||
|
|
|
||
|
|
public new TypeSymbol Type => base.Type;
|
||
|
|
|
||
|
|
public BoundConvertedStackAllocExpression(SyntaxNode syntax, TypeSymbol elementType, BoundExpression count, BoundArrayInitialization? initializerOpt, TypeSymbol type, bool hasErrors = false)
|
||
|
|
: base(BoundKind.ConvertedStackAllocExpression, syntax, elementType, count, initializerOpt, type, hasErrors || count.HasErrors() || initializerOpt.HasErrors())
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
[DebuggerStepThrough]
|
||
|
|
public override BoundNode? Accept(BoundTreeVisitor visitor)
|
||
|
|
{
|
||
|
|
return visitor.VisitConvertedStackAllocExpression(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public BoundConvertedStackAllocExpression Update(TypeSymbol elementType, BoundExpression count, BoundArrayInitialization? initializerOpt, TypeSymbol type)
|
||
|
|
{
|
||
|
|
if (!TypeSymbol.Equals(elementType, base.ElementType, (TypeCompareKind)0) || count != base.Count || initializerOpt != base.InitializerOpt || !TypeSymbol.Equals(type, Type, (TypeCompareKind)0))
|
||
|
|
{
|
||
|
|
BoundConvertedStackAllocExpression boundConvertedStackAllocExpression = new BoundConvertedStackAllocExpression(Syntax, elementType, count, initializerOpt, type, base.HasErrors);
|
||
|
|
boundConvertedStackAllocExpression.CopyAttributes(this);
|
||
|
|
return boundConvertedStackAllocExpression;
|
||
|
|
}
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
}
|