void ICilExtension.Implement(CompilerState state, Instruction ins, CompileTimeValue[] staticArgv, int dynamicArgc) { if (ins.JustEffect) return; // Usually for commands without side-effects you have to at least // pop dynamic arguments from the stack. // ValidateArguments proved that there are no arguments on the stack. string literal; int code; if (staticArgv[0].TryGetString(out literal)) code = literal[0]; else if (!staticArgv[0].TryGetInt(out code)) throw new ArgumentException( "char command requires one argument that is either a string or a 32-bit integer with the most significant bit cleared."); state.EmitLdcI4(code); state.EmitWrapChar(); }