Exemple #1
0
 void ICilCompilerAware.ImplementInCil(CompilerState state, Instruction ins)
 {
     switch (ins.Arguments)
     {
         case 0:
             if (!ins.JustEffect)
                 state.EmitLoadNullAsPValue();
             break;
         case 1:
             //Emit call to RunStatically(PValue, StackContext)
             state.EmitLoadLocal(state.SctxLocal);
             var run =
                 typeof (Dispose).GetMethod("RunStatically",
                     new[] {typeof (PValue), typeof (StackContext)});
             state.Il.EmitCall(OpCodes.Call, run, null);
             if (!ins.JustEffect)
                 state.EmitLoadNullAsPValue();
             break;
         default:
             //Emit call to RunStatically(StackContext, PValue[])
             state.EmitEarlyBoundCommandCall(typeof (Dispose), ins);
             break;
     }
 }