[opt] 生成的 AOTGenericReferences 文件中泛型类型和函数按名称排序

main
walon 2022-09-23 18:09:14 +08:00
parent c76e68411f
commit 830f0cca7d
1 changed files with 11 additions and 1 deletions

View File

@ -28,6 +28,7 @@ namespace HybridCLR.Editor.AOT
codes.Add(""); codes.Add("");
codes.Add("\t// {{ AOT generic type"); codes.Add("\t// {{ AOT generic type");
types.Sort((a, b) => a.Type.FullName.CompareTo(b.Type.FullName));
foreach(var type in types) foreach(var type in types)
{ {
codes.Add($"\t//{type.ToTypeSig()}"); codes.Add($"\t//{type.ToTypeSig()}");
@ -38,7 +39,16 @@ namespace HybridCLR.Editor.AOT
codes.Add(""); codes.Add("");
codes.Add("\tpublic void RefMethods()"); codes.Add("\tpublic void RefMethods()");
codes.Add("\t{"); codes.Add("\t{");
methods.Sort((a, b) =>
{
int c = a.Method.DeclaringType.FullName.CompareTo(b.Method.DeclaringType.FullName);
if (c != 0)
{
return c;
}
c = a.Method.Name.CompareTo(b.Method.Name);
return c;
});
foreach(var method in methods) foreach(var method in methods)
{ {
codes.Add($"\t\t// {method.ToMethodSpec()}"); codes.Add($"\t\t// {method.ToMethodSpec()}");