Permalink
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (26 sloc) 1.44 KB
// Copyright (c) Josef Pihrt. All rights reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace Roslynator.CSharp.Refactorings
{
internal static class EventDeclarationRefactoring
{
public static async Task ComputeRefactoringsAsync(RefactoringContext context, EventDeclarationSyntax eventDeclaration)
{
if (context.IsRefactoringEnabled(RefactoringIdentifiers.CopyDocumentationCommentFromBaseMember)
&& eventDeclaration.HeaderSpan().Contains(context.Span)
&& !eventDeclaration.HasDocumentationComment())
{
SemanticModel semanticModel = await context.GetSemanticModelAsync().ConfigureAwait(false);
CopyDocumentationCommentFromBaseMemberRefactoring.ComputeRefactoring(context, eventDeclaration, semanticModel);
}
if (context.IsRefactoringEnabled(RefactoringIdentifiers.AddMemberToInterface)
&& context.Span.IsEmptyAndContainedInSpanOrBetweenSpans(eventDeclaration.Identifier))
{
SemanticModel semanticModel = await context.GetSemanticModelAsync().ConfigureAwait(false);
AddMemberToInterfaceRefactoring.ComputeRefactoring(context, eventDeclaration, semanticModel);
}
}
}
}