private void Update(EvaluationContext context) { var a = Value1.GetValue(context); var b = Value2.GetValue(context); Result.Value = a + b; }
public override string GenerateCode() { return(string.Format("sr_bool {0} = {1} >= {2};\r\n", ExportVaribleName, Value1.GetValue(), Value2.GetValue())); }
public override IEnumerable <Instruction> Generate(ActionBlock curBlock) { var l = new List <Instruction>(); l.AddRange(Value1.GetValue()); l.AddRange(Value2.GetValue()); switch (Operation) { case Op.Add: l.Add(Instruction.Create(OpCodes.Add)); break; case Op.Sub: l.Add(Instruction.Create(OpCodes.Sub)); break; case Op.Mul: l.Add(Instruction.Create(OpCodes.Mul)); break; case Op.Div: l.Add(Instruction.Create(OpCodes.Div)); break; case Op.Rem: l.Add(Instruction.Create(OpCodes.Rem)); break; case Op.Shl: l.Add(Instruction.Create(OpCodes.Shl)); break; case Op.Shr: l.Add(Instruction.Create(OpCodes.Shr)); break; case Op.Ushr: l.Add(Instruction.Create(OpCodes.Shr_Un)); break; case Op.And: l.Add(Instruction.Create(OpCodes.And)); break; case Op.Or: l.Add(Instruction.Create(OpCodes.Or)); break; case Op.Xor: l.Add(Instruction.Create(OpCodes.Xor)); break; case Op.Lcmp: l.Add(Instruction.Create(OpCodes.Call, JavaAssemblyBuilder.Instance.Import(_lcmp))); break; case Op.Fcmpg: l.Add(Instruction.Create(OpCodes.Call, JavaAssemblyBuilder.Instance.Import(_fcmpg))); break; case Op.Fcmpl: l.Add(Instruction.Create(OpCodes.Call, JavaAssemblyBuilder.Instance.Import(_fcmpl))); break; default: throw new ArgumentOutOfRangeException(); } l.AddRange(Target.StoreValue()); return(l); }
public override string GenerateCode() { return(string.Format("if({0})\r\n{{\r\n{1}({2},{3});\r\n}}\r\n", ImportVaribleName, FunctionName, Value1.GetValue(), Value2.GetValue())); }