Skip to content

Commit be14dda

Browse files
authored
Update method modifiers to address CA1822 (#48551)
* Update method modifiers to address CA1822 * Fix upstream affected methods
1 parent 61286fd commit be14dda

File tree

4 files changed

+6
-30
lines changed

4 files changed

+6
-30
lines changed

src/Framework/AspNetCoreAnalyzers/src/Analyzers/Infrastructure/RoutePattern/RoutePatternParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ private static void ValidateNoConsecutiveSeparators(RoutePatternCompilationUnit
373373
}
374374
}
375375

376-
private void CollectDiagnostics(RoutePatternNode node, HashSet<EmbeddedDiagnostic> seenDiagnostics, IList<EmbeddedDiagnostic> diagnostics)
376+
private static void CollectDiagnostics(RoutePatternNode node, HashSet<EmbeddedDiagnostic> seenDiagnostics, IList<EmbeddedDiagnostic> diagnostics)
377377
{
378378
foreach (var child in node)
379379
{

src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/FrameworkParametersCompletionProvider.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -455,30 +455,6 @@ private static void ProvideCompletions(EmbeddedCompletionContext context, Syntax
455455
}
456456
}
457457

458-
private (RoutePatternNode parent, RoutePatternToken Token)? FindToken(RoutePatternNode parent, VirtualChar ch)
459-
{
460-
foreach (var child in parent)
461-
{
462-
if (child.IsNode)
463-
{
464-
var result = FindToken(child.Node, ch);
465-
if (result != null)
466-
{
467-
return result;
468-
}
469-
}
470-
else
471-
{
472-
if (child.Token.VirtualChars.Contains(ch))
473-
{
474-
return (parent, child.Token);
475-
}
476-
}
477-
}
478-
479-
return null;
480-
}
481-
482458
private readonly struct RoutePatternItem
483459
{
484460
public readonly string DisplayText;

src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/RoutePatternCompletionProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ not CompletionTriggerKind.InvokeAndCommitIfUnique and
163163
context.IsExclusive = true;
164164
}
165165

166-
private void ProvideCompletions(EmbeddedCompletionContext context)
166+
private static void ProvideCompletions(EmbeddedCompletionContext context)
167167
{
168168
var result = GetCurrentToken(context);
169169
if (result == null)
@@ -216,7 +216,7 @@ private void ProvideCompletions(EmbeddedCompletionContext context)
216216
}
217217
}
218218

219-
private (RoutePatternNode Parent, RoutePatternToken Token)? GetCurrentToken(EmbeddedCompletionContext context)
219+
private static (RoutePatternNode Parent, RoutePatternToken Token)? GetCurrentToken(EmbeddedCompletionContext context)
220220
{
221221
var previousVirtualCharOpt = context.RouteUsage.RoutePattern.Text.Find(context.Position - 1);
222222
if (previousVirtualCharOpt == null)
@@ -279,7 +279,7 @@ private static void ProvidePolicyNameCompletions(EmbeddedCompletionContext conte
279279
}
280280
}
281281

282-
private (RoutePatternNode Parent, RoutePatternToken Token)? FindToken(RoutePatternNode parent, VirtualChar ch)
282+
private static (RoutePatternNode Parent, RoutePatternToken Token)? FindToken(RoutePatternNode parent, VirtualChar ch)
283283
{
284284
foreach (var child in parent)
285285
{

src/Http/Routing/src/Tree/LinkGenerationDecisionTree.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public IList<OutboundMatchResult> GetMatches(RouteValueDictionary values, RouteV
104104
// match.
105105
//
106106
// The decision tree uses a tree data structure to execute these rules across all candidates at once.
107-
private void Walk(
107+
private static void Walk(
108108
List<OutboundMatchResult> results,
109109
RouteValueDictionary values,
110110
RouteValueDictionary ambientValues,
@@ -233,7 +233,7 @@ internal string DebuggerDisplayString
233233
}
234234
}
235235

236-
private void FlattenTree(Stack<string> branchStack, StringBuilder sb, DecisionTreeNode<OutboundMatch> node)
236+
private static void FlattenTree(Stack<string> branchStack, StringBuilder sb, DecisionTreeNode<OutboundMatch> node)
237237
{
238238
// leaf node
239239
if (node.Criteria.Count == 0)

0 commit comments

Comments
 (0)