public int breakBlock = 0;//是否是块结束 public static Value FromICQ_Value(ICQ_Value value) { Value v = new Value(); v.type = value.type; v.value = value.value; return(v); }
ICQ_Expression OptimizeSingle(ICQ_Expression expr, CQ_Content content) { if (expr is CQ_Expression_Math2Value || expr is CQ_Expression_Math2ValueAndOr || expr is CQ_Expression_Math2ValueLogic) { if (expr.listParam[0] is ICQ_Value && expr.listParam[1] is ICQ_Value) { CQ_Content.Value result = expr.ComputeValue(content); if ((Type)result.type == typeof(bool)) { CQ_Value_Value <bool> value = new CQ_Value_Value <bool>(); value.value_value = (bool)result.value; value.tokenBegin = expr.listParam[0].tokenBegin; value.tokenEnd = expr.listParam[1].tokenEnd; value.lineBegin = expr.listParam[0].lineBegin; value.lineEnd = expr.listParam[1].lineEnd; return(value); } else { ICQ_Type v = content.environment.GetType(result.type); ICQ_Value value = v.MakeValue(result.value); value.tokenBegin = expr.listParam[0].tokenBegin; value.tokenEnd = expr.listParam[1].tokenEnd; value.lineBegin = expr.listParam[0].lineBegin; value.lineEnd = expr.listParam[1].lineEnd; return(value); } } } if (expr is CQ_Expression_Math3Value) { CQ_Content.Value result = expr.listParam[0].ComputeValue(content); if ((Type)result.type == typeof(bool)) { bool bv = (bool)result.value; if (bv) { return(expr.listParam[1]); } else { return(expr.listParam[2]); } } } return(expr); }