using System.Collections.Immutable; using System.Diagnostics; namespace Microsoft.CodeAnalysis.CSharp; internal sealed class BoundBadStatement : BoundStatement, IBoundInvalidNode { protected override ImmutableArray Children => ChildBoundNodes; ImmutableArray IBoundInvalidNode.InvalidNodeChildren => ChildBoundNodes; public ImmutableArray ChildBoundNodes { get; } public BoundBadStatement(SyntaxNode syntax, ImmutableArray childBoundNodes, bool hasErrors = false) : base(BoundKind.BadStatement, syntax, hasErrors || childBoundNodes.HasErrors()) { ChildBoundNodes = childBoundNodes; } [DebuggerStepThrough] public override BoundNode? Accept(BoundTreeVisitor visitor) { return visitor.VisitBadStatement(this); } public BoundBadStatement Update(ImmutableArray childBoundNodes) { if (childBoundNodes != ChildBoundNodes) { BoundBadStatement boundBadStatement = new BoundBadStatement(Syntax, childBoundNodes, base.HasErrors); boundBadStatement.CopyAttributes(this); return boundBadStatement; } return this; } }