2024-12-20 23:39:29 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
2025-07-13 17:34:03 +08:00
|
|
|
|
namespace Serein.Script.Node.FlowControl
|
2024-12-20 23:39:29 +08:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 条件节点
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class IfNode : ASTNode
|
|
|
|
|
|
{
|
2025-07-11 20:52:21 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 条件来源
|
|
|
|
|
|
/// </summary>
|
2024-12-20 23:39:29 +08:00
|
|
|
|
public ASTNode Condition { get; }
|
2025-07-11 20:52:21 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 条件为 true 时所执行的语句
|
|
|
|
|
|
/// </summary>
|
2024-12-20 23:39:29 +08:00
|
|
|
|
public List<ASTNode> TrueBranch { get; }
|
2025-07-11 20:52:21 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 条件为 false 时所执行的语句
|
|
|
|
|
|
/// </summary>
|
2024-12-20 23:39:29 +08:00
|
|
|
|
public List<ASTNode> FalseBranch { get; }
|
|
|
|
|
|
public IfNode(ASTNode condition, List<ASTNode> trueBranch, List<ASTNode> falseBranch)
|
|
|
|
|
|
=> (Condition, TrueBranch, FalseBranch) = (condition, trueBranch, falseBranch);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|