Skip to content

Commit 6a37ec7

Browse files
Uses ArgHelper in legacy RazorSyntaxTreeExtensions
Replaces explicit null checks with `ArgHelper.ThrowIfNull` in `RazorSyntaxTreeExtensions` for conciseness.
1 parent e48227c commit 6a37ec7

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RazorSyntaxTreeExtensions.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
54
using System.Collections.Immutable;
65

76
namespace Microsoft.AspNetCore.Razor.Language.Legacy;
@@ -10,20 +9,14 @@ internal static class RazorSyntaxTreeExtensions
109
{
1110
public static ImmutableArray<ClassifiedSpanInternal> GetClassifiedSpans(this RazorSyntaxTree syntaxTree)
1211
{
13-
if (syntaxTree == null)
14-
{
15-
throw new ArgumentNullException(nameof(syntaxTree));
16-
}
12+
ArgHelper.ThrowIfNull(syntaxTree);
1713

1814
return ClassifiedSpanVisitor.VisitRoot(syntaxTree);
1915
}
2016

2117
public static ImmutableArray<TagHelperSpanInternal> GetTagHelperSpans(this RazorSyntaxTree syntaxTree)
2218
{
23-
if (syntaxTree == null)
24-
{
25-
throw new ArgumentNullException(nameof(syntaxTree));
26-
}
19+
ArgHelper.ThrowIfNull(syntaxTree);
2720

2821
return TagHelperSpanVisitor.VisitRoot(syntaxTree);
2922
}

0 commit comments

Comments
 (0)