Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 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;
 }