using System; using System.Collections.Generic; using System.Reflection.Emit; using System.Text; using Sunweaver.VM; namespace Sunweaver.Commands { [Attributes.BasePair("Reverses the top value of the boolean stack.")] public class not : Abstracts.UnaryBooleanLogic { public override void Operation(bool a) { VM.BoolStack.Push(!a); } public override void CompileOperation(ILGenerator il, Locals locals) { il.Emit(OpCodes.Ldloc, locals[typeof(VirtualMachine)]); il.Emit(OpCodes.Ldfld, typeof(VirtualMachine).GetField("BoolStack")); il.Emit(OpCodes.Ldloc, locals[typeof(bool), 0]); il.Emit(OpCodes.Ldc_I4_0); il.Emit(OpCodes.Ceq); il.Emit(OpCodes.Call, typeof(BoolStack).GetMethod("Push")); } } }