Skip to content

Commit

Permalink
Don't exclude events for NameOf context
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Sep 15, 2020
1 parent 898c689 commit 58a97af
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Recommendations
End Function

''' <summary>
''' In MemberAccessExpression Contexts, filter out event symbols, except inside AddRemoveHandler Statements
''' In MemberAccessExpression Contexts, filter out event symbols (except for NameOf context), except inside AddRemoveHandler Statements
''' Also, filter out any implicitly declared members generated by event declaration or property declaration
''' </summary>
Private Shared Function FilterEventsAndGeneratedSymbols(node As MemberAccessExpressionSyntax, s As ISymbol) As Boolean
If s.Kind = SymbolKind.Event Then
Private Function FilterEventsAndGeneratedSymbols(node As MemberAccessExpressionSyntax, s As ISymbol) As Boolean
If s.Kind = SymbolKind.Event AndAlso Not _context.IsNameOfContext Then
Return node IsNot Nothing AndAlso node.GetAncestor(Of AddRemoveHandlerStatementSyntax) IsNot Nothing
ElseIf s.Kind = SymbolKind.Field AndAlso s.IsImplicitlyDeclared Then
Dim associatedSymbol = DirectCast(s, IFieldSymbol).AssociatedSymbol
Expand Down

0 comments on commit 58a97af

Please sign in to comment.