This commit is contained in:
Mohammadreza Taikandi 2020-12-21 10:21:27 +00:00
parent 1968184e77
commit 4734b8170a
3 changed files with 6 additions and 7 deletions

View File

@ -34,7 +34,7 @@ namespace MapTo
continue;
}
var (source, hintName) = SourceProvider.GenerateSource(model);
var (source, hintName) = SourceBuilder.GenerateSource(model);
context.AddSource(hintName, source);
}
@ -74,7 +74,7 @@ namespace MapTo
private static ITypeSymbol? GetDestinationTypeSymbol(ClassDeclarationSyntax classSyntax, SemanticModel model)
{
var destinationTypeExpressionSyntax = classSyntax
.GetAttribute(SourceProvider.MapFromAttributeName)
.GetAttribute(SourceBuilder.MapFromAttributeName)
?.DescendantNodes()
.OfType<TypeOfExpressionSyntax>()
.SingleOrDefault();

View File

@ -20,12 +20,12 @@ namespace MapTo
var attributeSyntax = attributes
.SelectMany(a => a.Attributes)
.SingleOrDefault(a => a.Name is
IdentifierNameSyntax { Identifier: { ValueText: SourceProvider.MapFromAttributeName } } // For: [MapFrom]
IdentifierNameSyntax { Identifier: { ValueText: SourceBuilder.MapFromAttributeName } } // For: [MapFrom]
or
QualifiedNameSyntax // For: [MapTo.MapFrom]
{
Left: IdentifierNameSyntax { Identifier: { ValueText: SourceProvider.NamespaceName } },
Right: IdentifierNameSyntax { Identifier: { ValueText: SourceProvider.MapFromAttributeName } }
Left: IdentifierNameSyntax { Identifier: { ValueText: SourceBuilder.NamespaceName } },
Right: IdentifierNameSyntax { Identifier: { ValueText: SourceBuilder.MapFromAttributeName } }
}
);

View File

@ -5,11 +5,10 @@ using System.Text;
using MapTo.Extensions;
using MapTo.Models;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
namespace MapTo
{
internal static class SourceProvider
internal static class SourceBuilder
{
internal const string NamespaceName = "MapTo";
internal const string MapFromAttributeName = "MapFrom";