Cleanup.
This commit is contained in:
parent
1968184e77
commit
4734b8170a
|
@ -34,7 +34,7 @@ namespace MapTo
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var (source, hintName) = SourceProvider.GenerateSource(model);
|
var (source, hintName) = SourceBuilder.GenerateSource(model);
|
||||||
|
|
||||||
context.AddSource(hintName, source);
|
context.AddSource(hintName, source);
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ namespace MapTo
|
||||||
private static ITypeSymbol? GetDestinationTypeSymbol(ClassDeclarationSyntax classSyntax, SemanticModel model)
|
private static ITypeSymbol? GetDestinationTypeSymbol(ClassDeclarationSyntax classSyntax, SemanticModel model)
|
||||||
{
|
{
|
||||||
var destinationTypeExpressionSyntax = classSyntax
|
var destinationTypeExpressionSyntax = classSyntax
|
||||||
.GetAttribute(SourceProvider.MapFromAttributeName)
|
.GetAttribute(SourceBuilder.MapFromAttributeName)
|
||||||
?.DescendantNodes()
|
?.DescendantNodes()
|
||||||
.OfType<TypeOfExpressionSyntax>()
|
.OfType<TypeOfExpressionSyntax>()
|
||||||
.SingleOrDefault();
|
.SingleOrDefault();
|
||||||
|
|
|
@ -20,12 +20,12 @@ namespace MapTo
|
||||||
var attributeSyntax = attributes
|
var attributeSyntax = attributes
|
||||||
.SelectMany(a => a.Attributes)
|
.SelectMany(a => a.Attributes)
|
||||||
.SingleOrDefault(a => a.Name is
|
.SingleOrDefault(a => a.Name is
|
||||||
IdentifierNameSyntax { Identifier: { ValueText: SourceProvider.MapFromAttributeName } } // For: [MapFrom]
|
IdentifierNameSyntax { Identifier: { ValueText: SourceBuilder.MapFromAttributeName } } // For: [MapFrom]
|
||||||
or
|
or
|
||||||
QualifiedNameSyntax // For: [MapTo.MapFrom]
|
QualifiedNameSyntax // For: [MapTo.MapFrom]
|
||||||
{
|
{
|
||||||
Left: IdentifierNameSyntax { Identifier: { ValueText: SourceProvider.NamespaceName } },
|
Left: IdentifierNameSyntax { Identifier: { ValueText: SourceBuilder.NamespaceName } },
|
||||||
Right: IdentifierNameSyntax { Identifier: { ValueText: SourceProvider.MapFromAttributeName } }
|
Right: IdentifierNameSyntax { Identifier: { ValueText: SourceBuilder.MapFromAttributeName } }
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,10 @@ using System.Text;
|
||||||
using MapTo.Extensions;
|
using MapTo.Extensions;
|
||||||
using MapTo.Models;
|
using MapTo.Models;
|
||||||
using Microsoft.CodeAnalysis;
|
using Microsoft.CodeAnalysis;
|
||||||
using Microsoft.CodeAnalysis.Text;
|
|
||||||
|
|
||||||
namespace MapTo
|
namespace MapTo
|
||||||
{
|
{
|
||||||
internal static class SourceProvider
|
internal static class SourceBuilder
|
||||||
{
|
{
|
||||||
internal const string NamespaceName = "MapTo";
|
internal const string NamespaceName = "MapTo";
|
||||||
internal const string MapFromAttributeName = "MapFrom";
|
internal const string MapFromAttributeName = "MapFrom";
|
Loading…
Reference in New Issue