public static async Task ComputeRefactoringAsync(RefactoringContext context, EventDeclarationSyntax eventDeclaration)
        {
            if (!eventDeclaration.HasSingleLineDocumentationComment())
            {
                SemanticModel semanticModel = await context.GetSemanticModelAsync().ConfigureAwait(false);

                IEventSymbol eventSymbol = semanticModel.GetDeclaredSymbol(eventDeclaration);

                if (eventSymbol?.IsErrorType() == false)
                {
                    ComputeRefactoring <IEventSymbol>(context, eventDeclaration, eventSymbol, eventSymbol.OverriddenEvent);
                }
            }
        }
Exemple #2
0
        private static BaseDocumentationCommentInfo GenerateFromBase(IEventSymbol eventSymbol, SemanticModel semanticModel, int position, CancellationToken cancellationToken)
        {
            if (eventSymbol?.IsErrorType() == false)
            {
                SyntaxTrivia trivia = GenerateFromOverriddenEvents(eventSymbol, semanticModel, position, cancellationToken);

                if (trivia.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia))
                {
                    return(new BaseDocumentationCommentInfo(trivia, BaseDocumentationCommentOrigin.BaseMember));
                }

                trivia = GenerateFromInterfaceMember <IEventSymbol>(eventSymbol, semanticModel, position, cancellationToken);

                if (trivia.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia))
                {
                    return(new BaseDocumentationCommentInfo(trivia, BaseDocumentationCommentOrigin.InterfaceMember));
                }
            }

            return(default(BaseDocumentationCommentInfo));
        }