using System.Collections.Immutable; using System.Diagnostics; using Microsoft.CodeAnalysis.CSharp.Symbols; namespace Microsoft.CodeAnalysis.CSharp; internal sealed class BoundFixedStatement : BoundStatement { protected override ImmutableArray Children => ImmutableArray.Create((BoundNode)Declarations, (BoundNode)Body); public ImmutableArray Locals { get; } public BoundMultipleLocalDeclarations Declarations { get; } public BoundStatement Body { get; } public BoundFixedStatement(SyntaxNode syntax, ImmutableArray locals, BoundMultipleLocalDeclarations declarations, BoundStatement body, bool hasErrors = false) : base(BoundKind.FixedStatement, syntax, hasErrors || declarations.HasErrors() || body.HasErrors()) { Locals = locals; Declarations = declarations; Body = body; } [DebuggerStepThrough] public override BoundNode? Accept(BoundTreeVisitor visitor) { return visitor.VisitFixedStatement(this); } public BoundFixedStatement Update(ImmutableArray locals, BoundMultipleLocalDeclarations declarations, BoundStatement body) { if (locals != Locals || declarations != Declarations || body != Body) { BoundFixedStatement boundFixedStatement = new BoundFixedStatement(Syntax, locals, declarations, body, base.HasErrors); boundFixedStatement.CopyAttributes(this); return boundFixedStatement; } return this; } }