Exemplo n.º 1
0
Arquivo: Log.cs Projeto: SealedSun/prx
 /// <summary>
 ///     Provides a custom compiler routine for emitting CIL byte code for a specific instruction.
 /// </summary>
 /// <param name = "state">The compiler state.</param>
 /// <param name = "ins">The instruction to compile.</param>
 void ICilCompilerAware.ImplementInCil(CompilerState state, Instruction ins)
 {
     var argc = ins.Arguments;
     if (ins.JustEffect)
     {
         state.EmitIgnoreArguments(argc);
     }
     else
     {
         if (argc > 2)
         {
             state.EmitIgnoreArguments(argc - 2);
             argc = 2;
         }
         switch (argc)
         {
             case 0:
                 state.EmitLdcI4(0);
                 state.EmitWrapInt();
                 goto case 1;
             case 1:
                 state.EmitLoadLocal(state.SctxLocal);
                 state.EmitCall(RunStaticallyNaturalMethod);
                 break;
             case 2:
                 state.EmitLoadLocal(state.SctxLocal);
                 state.EmitCall(RunStaticallyAnyMethod);
                 break;
         }
     }
 }