Skip to content

Commit 6056808

Browse files
committed
resolve resolver
1 parent 49abeab commit 6056808

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed

src/MasterMemory.SourceGenerator/GeneratorCore/GenerationContext.cs

+5
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ public string BuildReturnTypeName(string elementName)
9494
return IsNonUnique ? "RangeView<" + elementName + ">" : elementName;
9595
}
9696

97+
public string BuildReturnTypeNameForClosest(string elementName)
98+
{
99+
return IsNonUnique ? "RangeView<" + elementName + ">" : elementName + "?";
100+
}
101+
97102
public string BuildComparer()
98103
{
99104
if (!IsStringType)

src/MasterMemory.SourceGenerator/GeneratorCore/TableTemplate.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ public virtual string TransformText()
199199
}
200200
}
201201
this.Write("\r\n public ");
202-
this.Write(this.ToStringHelper.ToStringWithCulture(item.BuildReturnTypeName(GenerationContext.ClassName)));
203-
this.Write("? FindClosestBy");
202+
this.Write(this.ToStringHelper.ToStringWithCulture(item.BuildReturnTypeNameForClosest(GenerationContext.ClassName)));
203+
this.Write(" FindClosestBy");
204204
this.Write(this.ToStringHelper.ToStringWithCulture(item.BuildMethodName()));
205205
this.Write("(");
206206
this.Write(this.ToStringHelper.ToStringWithCulture(item.BuildTypeName()));

src/MasterMemory.SourceGenerator/GeneratorCore/TableTemplate.tt

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ namespace <#= Namespace #>.Tables
9898
<# } #>
9999
<# } #>
100100

101-
public <#= item.BuildReturnTypeName(GenerationContext.ClassName) #>? FindClosestBy<#= item.BuildMethodName() #>(<#= item.BuildTypeName() #> key, bool selectLower = true)
101+
public <#= item.BuildReturnTypeNameForClosest(GenerationContext.ClassName) #> FindClosestBy<#= item.BuildMethodName() #>(<#= item.BuildTypeName() #> key, bool selectLower = true)
102102
{
103103
return <#= item.BuildFindPrefix() #>ClosestCore(<#= item.TableName #>, <#= item.SelectorName #>, <#= item.BuildComparer() #>, key, selectLower);
104104
}

src/MasterMemory.Unity/Assets/NuGet.config.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace MasterMemory;
6+
7+
[MessagePack.GeneratedMessagePackResolver]
8+
internal partial class _MessagePackResolver
9+
{
10+
}

0 commit comments

Comments
 (0)