_Core/Lang/AST/Expressions/ConditionExpr.cs
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
namespace ComLib.Lang
{
/// <summary>
/// Condition expression less, less than equal, more, more than equal etc.
/// </summary>
public class ConditionExpr : Expr
{
/// <summary>
/// Initialize
/// </summary>
/// <param name="left">Left hand expression</param>
/// <param name="op">Operator</param>
/// <param name="right">Right expression</param>
public ConditionExpr(Expr left, Operator op, Expr right)
{
Left = left;
Right = right;
Op = op;
}
/// <summary>
/// Left hand expression
/// </summary>
public Expr Left;
/// <summary>
/// Operator > >= == != less less than
/// </summary>
public Operator Op;
/// <summary>
/// Right hand expression
/// </summary>
public Expr Right;
/// <summary>
/// Evaluate > >= != == less less than
/// </summary>
/// <returns></returns>
public override object DoEvaluate()
{
// Validate
if (Op != Operator.And && Op != Operator.Or)
throw new ArgumentException("Only && || supported");
bool result = false;
bool left = Left.EvaluateAs<bool>();
bool right = Right.EvaluateAs<bool>();
后面还有 13 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
