using System.Diagnostics; using Microsoft.CodeAnalysis.CSharp.Symbols; namespace Microsoft.CodeAnalysis.CSharp; internal sealed class BoundBlockInstrumentation : BoundNode { public LocalSymbol Local { get; } public BoundStatement Prologue { get; } public BoundStatement Epilogue { get; } public BoundBlockInstrumentation(SyntaxNode syntax, LocalSymbol local, BoundStatement prologue, BoundStatement epilogue, bool hasErrors = false) : base(BoundKind.BlockInstrumentation, syntax, hasErrors || prologue.HasErrors() || epilogue.HasErrors()) { Local = local; Prologue = prologue; Epilogue = epilogue; } [DebuggerStepThrough] public override BoundNode? Accept(BoundTreeVisitor visitor) { return visitor.VisitBlockInstrumentation(this); } public BoundBlockInstrumentation Update(LocalSymbol local, BoundStatement prologue, BoundStatement epilogue) { if (!SymbolEqualityComparer.ConsiderEverything.Equals(local, Local) || prologue != Prologue || epilogue != Epilogue) { BoundBlockInstrumentation boundBlockInstrumentation = new BoundBlockInstrumentation(Syntax, local, prologue, epilogue, base.HasErrors); boundBlockInstrumentation.CopyAttributes(this); return boundBlockInstrumentation; } return this; } }