mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-10 03:30:48 +08:00
重写脚本解释器的实现,提高其可读性。
This commit is contained in:
32
Serein.Script/Node/FlowControl/IfNode.cs
Normal file
32
Serein.Script/Node/FlowControl/IfNode.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Script.Node.FlowControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 条件节点
|
||||
/// </summary>
|
||||
public class IfNode : ASTNode
|
||||
{
|
||||
/// <summary>
|
||||
/// 条件来源
|
||||
/// </summary>
|
||||
public ASTNode Condition { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 条件为 true 时所执行的语句
|
||||
/// </summary>
|
||||
public List<ASTNode> TrueBranch { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 条件为 false 时所执行的语句
|
||||
/// </summary>
|
||||
public List<ASTNode> FalseBranch { get; }
|
||||
public IfNode(ASTNode condition, List<ASTNode> trueBranch, List<ASTNode> falseBranch)
|
||||
=> (Condition, TrueBranch, FalseBranch) = (condition, trueBranch, falseBranch);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user