From 271dc7062613f8d7aef3d911850ef69393d3cef9 Mon Sep 17 00:00:00 2001 From: walon Date: Wed, 7 Jun 2023 12:17:10 +0800 Subject: [PATCH] =?UTF-8?q?[opt]=20=E7=94=9F=E6=88=90AOTGenericReferences?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E8=A1=A5=E5=85=85=E5=85=83=E6=95=B0=E6=8D=AE?= =?UTF-8?q?assembly=E5=88=97=E8=A1=A8=E7=94=B1=E6=B3=A8=E9=87=8A=E6=94=B9?= =?UTF-8?q?=E6=88=90List=E5=88=97=E8=A1=A8=EF=BC=8C=E6=96=B9?= =?UTF-8?q?=E4=BE=BF=E5=9C=A8=E4=BB=A3=E7=A0=81=E4=B8=AD=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/AOT/GenericReferenceWriter.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Editor/AOT/GenericReferenceWriter.cs b/Editor/AOT/GenericReferenceWriter.cs index ccbebc6..559a5ec 100644 --- a/Editor/AOT/GenericReferenceWriter.cs +++ b/Editor/AOT/GenericReferenceWriter.cs @@ -64,18 +64,22 @@ namespace HybridCLR.Editor.AOT Directory.CreateDirectory(parentDir); List codes = new List(); + codes.Add("using System.Collections.Generic;"); codes.Add("public class AOTGenericReferences : UnityEngine.MonoBehaviour"); codes.Add("{"); codes.Add(""); codes.Add("\t// {{ AOT assemblies"); + codes.Add("\tpublic static readonly IReadOnlyList PatchedAOTAssemblyList = new List"); + codes.Add("\t{"); List modules = new HashSet( types.Select(t => t.Type.Module).Concat(methods.Select(m => m.Method.Module))).ToList(); modules.Sort((a, b) => a.Name.CompareTo(b.Name)); foreach (dnlib.DotNet.ModuleDef module in modules) { - codes.Add($"\t// {module.Name}"); + codes.Add($"\t\t\"{module.Name}\","); } + codes.Add("\t};"); codes.Add("\t// }}");