public static MethodBuilder CompileMain(ModuleBuilder M, string Script, params Assembly[] References) { var T = M.DefineType("Autolithium-" + Script.GetHashCode()); MethodBuilder DelegateBinder = T.DefineMethod("&=.DelegateBinder", MethodAttributes.Static); ASMInclude.ResxLoader(T, DelegateBinder); var ASMScope = new AssemblyScope(M, T); var lambda = LiParser.Parse( Script, ASMScope, References); ASMInclude.GenerateDelegateBinder(DelegateBinder, ASMScope.ScopeFunctions); MethodBuilder Method = null; if (lambda != null) { Method = T.DefineMethod("Autolithium-Main", MethodAttributes.Public | MethodAttributes.Static, typeof(int), new Type[] { typeof(string[]) }); lambda.CompileToMethod(Method); } T.CreateType(); return Method; }
public static MethodBuilder CompileMain(ModuleBuilder M, string Script, params Assembly[] References) { var T = M.DefineType("Autolithium-" + Script.GetHashCode()); MethodBuilder DelegateBinder = T.DefineMethod("&=.DelegateBinder", MethodAttributes.Static); ASMInclude.ResxLoader(T, DelegateBinder); var ASMScope = new AssemblyScope(M, T); var lambda = LiParser.Parse( Script, ASMScope, References); ASMInclude.GenerateDelegateBinder(DelegateBinder, ASMScope.ScopeFunctions); MethodBuilder Method = null; if (lambda != null) { Method = T.DefineMethod("Autolithium-Main", MethodAttributes.Public | MethodAttributes.Static, typeof(int), new Type[] { typeof(string[]) }); lambda.CompileToMethod(Method); } T.CreateType(); return(Method); }