mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-03 00:00:49 +08:00
重写脚本解释器的实现,提高其可读性。
This commit is contained in:
@@ -22,7 +22,7 @@ namespace Serein.Script.Node
|
||||
/// </summary>
|
||||
public ASTNode Value { get; }
|
||||
|
||||
public AssignmentNode(ASTNode targetObject, ASTNode value) => (Target, Value) = (targetObject, value);
|
||||
public AssignmentNode(ASTNode target, ASTNode value) => (Target, Value) = (target, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,8 +22,28 @@ namespace Serein.Script.Node
|
||||
/// <summary>
|
||||
/// 字段名称及字段类型
|
||||
/// </summary>
|
||||
[Obsolete("此属性已经过时,将会改为Dictionary<string, string>", false)]
|
||||
public Dictionary<string, Type> Fields { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 字段名称及字段类型(Kvp[fididName:fidleTypeName])
|
||||
/// </summary>
|
||||
public Dictionary<string, string> FieldInfos { get; }
|
||||
|
||||
public ClassTypeDefinitionNode(Dictionary<string, string> fields, string className)
|
||||
{
|
||||
this.FieldInfos = fields;
|
||||
this.ClassName = className;
|
||||
}
|
||||
|
||||
[Obsolete("此构造方法已经过时,可能在下一个版本中移除", false)]
|
||||
public ClassTypeDefinitionNode(Dictionary<string, Type> fields, string className)
|
||||
{
|
||||
this.Fields = fields;
|
||||
this.ClassName = className;
|
||||
}
|
||||
|
||||
[Obsolete("此构造方法已经过时,可能在下一个版本中移除", false)]
|
||||
public ClassTypeDefinitionNode(Dictionary<string, Type> fields, string className, bool isOverlay)
|
||||
{
|
||||
this.Fields = fields;
|
||||
|
||||
@@ -20,10 +20,33 @@ namespace Serein.Script.Node
|
||||
/// 索引来源
|
||||
/// </summary>
|
||||
public ASTNode Index { get; }
|
||||
public CollectionIndexNode(ASTNode TargetValue,ASTNode indexValue)
|
||||
|
||||
public CollectionIndexNode(ASTNode Collection, ASTNode indexValue)
|
||||
{
|
||||
this.Collection = TargetValue;
|
||||
this.Collection = Collection;
|
||||
this.Index = indexValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 集合赋值节点
|
||||
/// </summary>
|
||||
public class CollectionAssignmentNode : ASTNode
|
||||
{
|
||||
/// <summary>
|
||||
/// 集合来源
|
||||
/// </summary>
|
||||
public CollectionIndexNode Collection { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 索引来源
|
||||
/// </summary>
|
||||
public ASTNode Value { get; }
|
||||
|
||||
public CollectionAssignmentNode(CollectionIndexNode collection, ASTNode value)
|
||||
{
|
||||
this.Collection = collection;
|
||||
this.Value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
namespace Serein.Script.Node
|
||||
{
|
||||
public class ObjectMemberExpressionNode : ASTNode
|
||||
public class ExpressionNode : ASTNode
|
||||
{
|
||||
/// <summary>
|
||||
/// 对象成员(嵌套获取)
|
||||
/// </summary>
|
||||
public ASTNode Value { get; }
|
||||
|
||||
public ObjectMemberExpressionNode(ASTNode value)
|
||||
public ExpressionNode(ASTNode value)
|
||||
{
|
||||
this.Value = value;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Script.Node
|
||||
namespace Serein.Script.Node.FlowControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 条件节点
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Script.Node
|
||||
namespace Serein.Script.Node.FlowControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 程序入口
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Script.Node
|
||||
namespace Serein.Script.Node.FlowControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 返回值
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Script.Node
|
||||
namespace Serein.Script.Node.FlowControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 循环条件节点
|
||||
Reference in New Issue
Block a user