2024-12-20 23:39:29 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Serein.Script.Node
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 动态类型定义
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class ClassTypeDefinitionNode : ASTNode
|
|
|
|
|
|
{
|
2025-07-11 20:52:21 +08:00
|
|
|
|
[Obsolete("此属性已经过时,可能在下一个版本中移除", false)]
|
2024-12-21 20:47:31 +08:00
|
|
|
|
public bool IsOverlay { get; set; }
|
2025-07-11 20:52:21 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2025-07-16 16:16:19 +08:00
|
|
|
|
/// 类型名称
|
2025-07-11 20:52:21 +08:00
|
|
|
|
/// </summary>
|
2025-07-16 16:16:19 +08:00
|
|
|
|
public TypeNode ClassType { get; }
|
2025-07-11 20:52:21 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2025-07-16 16:16:19 +08:00
|
|
|
|
/// 类型中的属性
|
2025-07-11 20:52:21 +08:00
|
|
|
|
/// </summary>
|
2025-07-16 16:16:19 +08:00
|
|
|
|
public Dictionary<string, TypeNode> Propertys { get; }
|
2025-07-13 17:34:03 +08:00
|
|
|
|
|
2025-07-16 16:16:19 +08:00
|
|
|
|
public ClassTypeDefinitionNode(Dictionary<string, TypeNode> propertys, TypeNode className)
|
2025-07-13 17:34:03 +08:00
|
|
|
|
{
|
2025-07-16 16:16:19 +08:00
|
|
|
|
this.Propertys = propertys;
|
|
|
|
|
|
this.ClassType = className;
|
2025-07-13 17:34:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-29 14:25:31 +08:00
|
|
|
|
public override string ToString()
|
|
|
|
|
|
{
|
|
|
|
|
|
var p = string.Join(",", Propertys.Select(p => $"{p.Value}"));
|
|
|
|
|
|
return $"{ClassType}({p})";
|
|
|
|
|
|
}
|
2025-07-16 16:16:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* /// <summary>
|
|
|
|
|
|
/// 字段名称及字段类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Obsolete("此属性已经过时,将会改为Dictionary<string, string>", false)]
|
|
|
|
|
|
public Dictionary<TypeNode, Type> Fields { get; }
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* /// <summary>
|
|
|
|
|
|
/// 字段名称及字段类型(Kvp[fididName:fidleTypeName])
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Dictionary<TypeNode, string> FieldInfos { get; }
|
|
|
|
|
|
*/
|
|
|
|
|
|
//[Obsolete("此构造方法已经过时,可能在下一个版本中移除", false)]
|
|
|
|
|
|
|
2024-12-20 23:39:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|