Skip to content

Commit 352b6b3

Browse files
committed
Remove unnecessary check on MakeLocalVariableConstWhenItIsPossibleAnalyzer
Also add `Fact` to missing test Related to #774
1 parent 4dc4707 commit 352b6b3

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

src/CSharp/CodeCracker/Performance/MakeLocalVariableConstWhenItIsPossibleAnalyzer.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ private static void AnalyzeNode(SyntaxNodeAnalysisContext context)
3636
var localDeclaration = (LocalDeclarationStatementSyntax)context.Node;
3737
var semanticModel = context.SemanticModel;
3838

39-
if (localDeclaration.GetType().IsPointer) return;
40-
4139
if (!localDeclaration.IsConst
4240
&& IsDeclarationConstFriendly(localDeclaration, semanticModel)
4341
&& AreVariablesOnlyWrittenInsideDeclaration(localDeclaration, semanticModel) )

test/CSharp/CodeCracker.Test/Performance/MakeLocalVariablesConstWhenItIsPossibleTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public async Task IgnoresVariablesThatChangesValueOutsideDeclaration()
5252
await VerifyCSharpHasNoDiagnosticsAsync(test);
5353
}
5454

55+
[Fact]
5556
public async Task IgnoresPointerDeclarations()
5657
{
5758
var test = @"void* value = null;".WrapInCSharpMethod();

0 commit comments

Comments
 (0)