From 0d3b82477ecbf7128340b6725a79413427c68748 Mon Sep 17 00:00:00 2001 From: Berkan Diler Date: Tue, 27 Dec 2022 20:27:11 +0100 Subject: Use new ArgumentNullException and ObjectDisposedException throw-helper API (#4163) --- ARMeilleure/IntermediateRepresentation/BasicBlock.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'ARMeilleure/IntermediateRepresentation/BasicBlock.cs') diff --git a/ARMeilleure/IntermediateRepresentation/BasicBlock.cs b/ARMeilleure/IntermediateRepresentation/BasicBlock.cs index 7cee52e5..07bd8b67 100644 --- a/ARMeilleure/IntermediateRepresentation/BasicBlock.cs +++ b/ARMeilleure/IntermediateRepresentation/BasicBlock.cs @@ -48,10 +48,7 @@ namespace ARMeilleure.IntermediateRepresentation public void AddSuccessor(BasicBlock block) { - if (block == null) - { - ThrowNull(nameof(block)); - } + ArgumentNullException.ThrowIfNull(block); if ((uint)_succCount + 1 > MaxSuccessors) { @@ -100,10 +97,7 @@ namespace ARMeilleure.IntermediateRepresentation public void SetSuccessor(int index, BasicBlock block) { - if (block == null) - { - ThrowNull(nameof(block)); - } + ArgumentNullException.ThrowIfNull(block); if ((uint)index >= (uint)_succCount) { @@ -144,7 +138,6 @@ namespace ARMeilleure.IntermediateRepresentation } } - private static void ThrowNull(string name) => throw new ArgumentNullException(name); private static void ThrowOutOfRange(string name) => throw new ArgumentOutOfRangeException(name); private static void ThrowSuccessorOverflow() => throw new OverflowException($"BasicBlock can only have {MaxSuccessors} successors."); -- cgit v1.2.3