Skip to content

Commit

Permalink
Merge pull request #4650 from Youssef1313/patch-11
Browse files Browse the repository at this point in the history
MarkMembersAsStatic: Exclude indexers
  • Loading branch information
mavasani authored Jan 5, 2021
2 parents eb54287 + 902beca commit c49d111
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ private static bool ShouldAnalyze(
return false;
}

// Do not analyze constructors and finalizers.
if (methodSymbol.IsConstructor() || methodSymbol.IsFinalizer())
// Do not analyze constructors, finalizers, and indexers.
if (methodSymbol.IsConstructor() || methodSymbol.IsFinalizer() || methodSymbol.AssociatedSymbol.IsIndexer())
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ public void SomeEventHandler(object sender, System.EventArgs args) { }
public void SomeNotImplementedMethod() => throw new System.NotImplementedException();
public void SomeNotSupportedMethod() => throw new System.NotSupportedException();
public int this[int x] => 42;
}
public class Generic<T>
Expand Down Expand Up @@ -394,6 +396,12 @@ End Sub
Public Sub SomeNotSupportedMethod()
Throw New System.NotSupportedException()
End Sub
Default Public ReadOnly Property Item(x As Integer) As Integer
Get
Return 42
End Get
End Property
End Class
Public Class Generic(Of T)
Expand Down

0 comments on commit c49d111

Please sign in to comment.