Skip to content

Commit 29e3fbe

Browse files
author
kkin
committed
* call orign event
1 parent 7d846e3 commit 29e3fbe

File tree

4 files changed

+41
-17
lines changed

4 files changed

+41
-17
lines changed

BindGenerater/Generater/AOTGenerater.cs

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public static class AOTGenerater
1919
static string WorkDir;
2020
static string ManagedDir;
2121
static string AotDir;
22+
static bool needAOT;
2223
public static void Init(string workDir, Dictionary<string, List<string>> stripDic)
2324
{
2425
WorkDir = workDir;
@@ -30,6 +31,8 @@ public static void Init(string workDir, Dictionary<string, List<string>> stripDi
3031
NinjaWriter._eol = "";
3132
AotDir = Path.Combine(workDir, "aot");
3233
ModuleRegisterWriter = new CodeWriter(File.CreateText(Path.Combine(workDir, "generated", "aot_module_register.c")));
34+
35+
needAOT = !Utils.IsWin32();
3336
}
3437
public static void AddAOTAssembly(string file)
3538
{
@@ -40,28 +43,32 @@ public static void AddAOTAssembly(string file)
4043

4144
AOTDic[Path.GetFileName(file)] = assembly.Name.Name.Replace(".","_").Replace("-","_");
4245

43-
var fName = Path.GetFileName(file);
44-
if(StrpDic.TryGetValue(fName,out var sList))
46+
if (needAOT)
4547
{
46-
foreach(var strips in sList)
48+
var fName = Path.GetFileName(file);
49+
if (StrpDic.TryGetValue(fName, out var sList))
4750
{
48-
var info = strips.Split(':');
49-
var type = assembly.MainModule.GetType(info[0]);
50-
var method = type?.Methods.FirstOrDefault(m => m.Name == info[1]);
51-
if (method != null)
52-
type?.Methods.Remove(method);
53-
}
51+
foreach (var strips in sList)
52+
{
53+
var info = strips.Split(':');
54+
var type = assembly.MainModule.GetType(info[0]);
55+
var method = type?.Methods.FirstOrDefault(m => m.Name == info[1]);
56+
if (method != null)
57+
type?.Methods.Remove(method);
58+
}
5459

55-
assembly.Write(tmp);
56-
}
60+
assembly.Write(tmp);
61+
}
5762

58-
assembly.Dispose();
63+
assembly.Dispose();
5964

60-
if (File.Exists(tmp))
61-
{
62-
File.Copy(tmp, file, true);
63-
File.Delete(tmp);
65+
if (File.Exists(tmp))
66+
{
67+
File.Copy(tmp, file, true);
68+
File.Delete(tmp);
69+
}
6470
}
71+
6572
}
6673

6774
public static void End()
@@ -100,7 +107,7 @@ public static void End()
100107
CS.Writer.EndAll();
101108
}
102109

103-
if(!Utils.IsWin32())
110+
if(needAOT)
104111
{
105112
var res = Utils.RunCMD("ninja", new string[] { }, ManagedDir);
106113
if (res != 0)

BindGenerater/Generater/C/EventGenerater.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,23 @@ private static void ImplementEventMethod(MethodDefinition method,int index)
9999
}
100100

101101
CS.Writer.Write("&exc);");
102+
103+
//call orign
104+
CS.Writer.WriteLine("methods[index].orign(");
105+
if (!method.IsStatic)
106+
{
107+
CS.Writer.Write("thiz");
108+
//if (method.Parameters.Count > 0)
109+
CS.Writer.Write(",");
110+
}
111+
foreach (var p in method.Parameters)
112+
{
113+
CS.Writer.Write(p.Name);
114+
//if (lastP != p)
115+
CS.Writer.Write(",");
116+
}
117+
CS.Writer.Write("imethod);");
118+
102119
CS.Writer.WriteLine("check_mono_exception(exc)");
103120
if (!method.ReturnType.IsVoid())
104121
{

ScriptEngine/Tools/Binder.exe

512 Bytes
Binary file not shown.

ScriptEngine/Tools/Binder.pdb

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)