Fix for Explicit DefaultValue is not defined (#31)
* Fix for Explicit DefaultValue is not defined * .
This commit is contained in:
@@ -26,8 +26,16 @@ internal static class ParameterSymbolExtensions
|
||||
public static string GetParamsPrefix(this IParameterSymbol ps) =>
|
||||
ps.IsParams ? "params " : string.Empty;
|
||||
|
||||
public static string GetDefaultValue(this IParameterSymbol ps) =>
|
||||
ps.HasExplicitDefaultValue ? $" = {ps.ExplicitDefaultValue}" : string.Empty;
|
||||
public static string GetDefaultValue(this IParameterSymbol ps)
|
||||
{
|
||||
if (!ps.HasExplicitDefaultValue)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var defaultValue = ps.ExplicitDefaultValue ?? "null";
|
||||
return $" = {defaultValue}";
|
||||
}
|
||||
|
||||
public static TypeEnum GetTypeEnum(this IParameterSymbol p) =>
|
||||
p.Type.GetTypeEnum();
|
||||
|
||||
+2
@@ -46,6 +46,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
|
||||
System.Threading.Tasks.Task<string?> Method3Async();
|
||||
|
||||
void CreateInvokeHttpClient(int i = 5, string? appId = null);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+7
@@ -105,6 +105,13 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
return result__57684656;
|
||||
}
|
||||
|
||||
public void CreateInvokeHttpClient(int i = 5, string? appId = null)
|
||||
{
|
||||
int i_ = i;
|
||||
string? appId_ = appId;
|
||||
_Instance.CreateInvokeHttpClient(i_, appId_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
@@ -67,5 +68,9 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
{
|
||||
return Task.FromResult((string?)"");
|
||||
}
|
||||
|
||||
public void CreateInvokeHttpClient(int i = 5, string? appId = null)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user