Fixes
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Microsoft.CodeAnalysis;
|
||||
|
||||
namespace ProxyInterfaceSourceGenerator.Extensions
|
||||
{
|
||||
internal static class SymbolExtensions
|
||||
{
|
||||
public static string ToCode(this IPropertySymbol property)
|
||||
public static string ToPropertyTextForInterface(this IPropertySymbol property)
|
||||
{
|
||||
string get = property.GetMethod != null ? "get; " : string.Empty;
|
||||
string set = property.SetMethod != null ? "set; " : string.Empty;
|
||||
@@ -14,7 +13,7 @@ namespace ProxyInterfaceSourceGenerator.Extensions
|
||||
return $"{property.Type} {property.Name} {{ {get}{set}}}";
|
||||
}
|
||||
|
||||
public static string ToProxyCode(this IPropertySymbol property)
|
||||
public static string ToPropertyTextForClass(this IPropertySymbol property)
|
||||
{
|
||||
string get = property.GetMethod != null ? $"get => _instance.{property.Name}; " : string.Empty;
|
||||
string set = property.SetMethod != null ? $"set => _instance.{property.Name} = value; " : string.Empty;
|
||||
@@ -22,7 +21,7 @@ namespace ProxyInterfaceSourceGenerator.Extensions
|
||||
return $"{property.Type} {property.Name} {{ {get}{set}}}";
|
||||
}
|
||||
|
||||
public static string ToCode(this IMethodSymbol method)
|
||||
public static string ToMethodTextForInterface(this IMethodSymbol method)
|
||||
{
|
||||
var parameters = new List<string>();
|
||||
foreach (var ps in method.Parameters)
|
||||
@@ -33,7 +32,7 @@ namespace ProxyInterfaceSourceGenerator.Extensions
|
||||
return $"{method.ReturnType} {method.Name}({string.Join(", ", parameters)})";
|
||||
}
|
||||
|
||||
public static string ToProxyCode(this IMethodSymbol method)
|
||||
public static string ToMethodTextForClass(this IMethodSymbol method)
|
||||
{
|
||||
var parameters = new List<string>();
|
||||
foreach (var ps in method.Parameters)
|
||||
@@ -41,7 +40,7 @@ namespace ProxyInterfaceSourceGenerator.Extensions
|
||||
parameters.Add($"{ps.Name}");
|
||||
}
|
||||
|
||||
return $"{method.ToCode()} => _instance.{method.Name}({string.Join(", ", parameters)});";
|
||||
return $"{method.ToMethodTextForInterface()} => _instance.{method.Name}({string.Join(", ", parameters)});";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user