private static CompiledScript GenerateMethod(StatementNode r, ScriptSource Source) { DynamicMethod method = new DynamicMethod("GlobalCode", MethodAttributes.Static | MethodAttributes.Public, CallingConventions.Standard, typeof(JSValue), new Type[] { typeof(JSContext) }, typeof(JSContext), false); DMCompileContext ctx = new DMCompileContext(method.GetILGenerator()); ctx.Source = Source; ctx.GenerateGlobalCode(r); GlobalCodeDelegate _delegate = (GlobalCodeDelegate)method.CreateDelegate(typeof(GlobalCodeDelegate)); CompiledScript cs = new CompiledScript(_delegate); cs.Source = Source; return(cs); }
private static CompiledScript GenerateMethod(StatementNode r, ScriptSource Source) { DynamicMethod method = new DynamicMethod("GlobalCode", MethodAttributes.Static | MethodAttributes.Public, CallingConventions.Standard, typeof(JSValue), new Type[] { typeof(JSContext) }, typeof(JSContext), false); DMCompileContext ctx = new DMCompileContext(method.GetILGenerator()); ctx.Source = Source; ctx.GenerateGlobalCode(r); GlobalCodeDelegate _delegate = (GlobalCodeDelegate) method.CreateDelegate(typeof(GlobalCodeDelegate)); CompiledScript cs = new CompiledScript(_delegate); cs.Source = Source; return cs; }