Prepare for Add/Update generators

This commit is contained in:
Wvader 2022-08-23 17:48:47 +01:00
parent 7de9b48c69
commit 1400bd08e0
3 changed files with 12 additions and 3 deletions

View File

@ -6,6 +6,7 @@ using System.Text;
using System.Collections.Immutable;
using System.Diagnostics;
using Microsoft.CodeAnalysis;
#pragma warning disable CS8602
namespace MapTo.Extensions
{
@ -207,7 +208,9 @@ namespace MapTo.Extensions
private static void HandleEnumerable(SourceBuilder builder, MappedMember property)
{
var symbol = property.ActualSymbol as IPropertySymbol;
#pragma warning disable CS8602
builder.WriteCommentArray(symbol.Parameters, nameof(symbol.Parameters));
#pragma warning restore CS8602
builder.WriteCommentArray(symbol.TypeCustomModifiers, nameof(symbol.TypeCustomModifiers));
builder.WriteComment($"Is enumerable {(property.ActualSymbol as IPropertySymbol).Parameters}");

View File

@ -6,6 +6,7 @@ using MapTo.Extensions;
using MapTo.Sources;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
#pragma warning disable CS8602
namespace MapTo
{
@ -52,7 +53,7 @@ namespace MapTo
protected INamedTypeSymbol UseUpdateAttributeTypeSymbol { get; }
public static INamedTypeSymbol JsonExtensionAttributeSymbol { get; set; }
public static INamedTypeSymbol JsonExtensionAttributeSymbol { get; set; } = null!;
protected INamedTypeSymbol MappingContextTypeSymbol { get; }
@ -269,7 +270,7 @@ namespace MapTo
return new MappedMember(
property.Name,
property.GetTypeSymbol().ToString(),
property.GetTypeSymbol()?.ToString() ?? throw new InvalidOperationException(),
ToQualifiedDisplayName(propertyType) ?? propertyType.Name,
converterFullyQualifiedName,
converterParameters.ToImmutableArray(),
@ -315,7 +316,9 @@ namespace MapTo
property,
namedType,
isEnumerable,
(property as IPropertySymbol).IsReadOnly);
#pragma warning disable CS8602
(property as IPropertySymbol).IsReadOnly);
#pragma warning restore CS8602
;
}

View File

@ -2,6 +2,9 @@ using static MapTo.Sources.Constants;
namespace MapTo.Sources
{
/// <summary>
/// UpdateData Attribute Source
/// </summary>
public class UpdateDataAttributeSource
{
internal const string AttributeName = "UpdateData";