public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif CQ_Value result = new CQ_Value(); //if(mathop=="<"||mathop=="<="||mathop==">"||mathop==">="||mathop=="=="||mathop=="!=") { var left = _expressions[0].ComputeValue(content); var right = _expressions[1].ComputeValue(content); if (left.TypeIsEmpty || right.TypeIsEmpty) { if (mathop == LogicToken.equal) { result.SetBool(left.GetObject() == right.GetObject()); } if (mathop == LogicToken.not_equal) { result.SetBool(left.GetObject() != right.GetObject()); } } else if (left.m_type == typeof(bool) && right.m_type == typeof(bool)) { if (mathop == LogicToken.equal) { result.SetBool(left.GetBool() == right.GetBool()); //return result; } else if (mathop == LogicToken.not_equal) { result.SetBool(left.GetBool() != right.GetBool()); //return result; } else { throw new Exception("bool 不支持此运算符"); } } else { result.SetBool(CQuark.AppDomain.GetITypeByCQValue(left).MathLogic(mathop, left, right)); } } #if CQUARK_DEBUG content.OutStack(this); #endif return(result); }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif CQ_Value result = new CQ_Value(); //if (mathop == "&&" || mathop == "||") { bool bleft = _expressions[0].ComputeValue(content).GetBool(); if (mathop == '&') { if (!bleft) { result.SetBool(false); } else { bool bright = _expressions[1].ComputeValue(content).GetBool(); result.SetBool(bleft && bright); } } else if (mathop == '|') { if (bleft) { result.SetBool(true); } else { bool bright = _expressions[1].ComputeValue(content).GetBool(); result.SetBool(bleft || bright); } } } #if CQUARK_DEBUG content.OutStack(this); #endif return(result); }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif var right = _expressions[0].ComputeValue(content); IType type = CQuark.AppDomain.GetITypeByCQValue(right); CQ_Value value = new CQ_Value(); value.SetBool(type.ConvertTo(right.GetObject(), targettype) != null); #if CQUARK_DEBUG content.OutStack(this); #endif return(value); }
public CQ_Value ComputeValue(CQ_Content content) { #if CQUARK_DEBUG content.InStack(this); #endif CQ_Value r = _expressions[0].ComputeValue(content); CQ_Value r2 = new CQ_Value(); r2.SetBool(!r.GetBool()); r2.m_breakBlock = r.m_breakBlock; #if CQUARK_DEBUG content.OutStack(this); #endif return(r2); }