Example #1
0
 public Assembly(Assembly a)
 {
     _template = new List<Instruction>(a._template);
 }
 public ErrorList Compile(Assembly a)
 {
     var e = new ErrorList();
     try
     {
         _template = new DynamicMethod(
             string.Format("__template_{0}", Name),
             typeof (void),
             new[] {typeof (VirtualTemplate)},
             typeof (VirtualTemplate),
             true);
         var ctx = new AssemblyContext {Generator = _template.GetILGenerator()};
         a.Copmile(ctx);
         _image = (RunTemplate) _template.CreateDelegate(typeof (RunTemplate));
         Assembly = new Assembly(a);
     }
     catch (Exception ex)
     {
         e.ErrorUnhandledCompileError(ex);
     }
     return e;
 }