修复了脚本语言中构造器赋值的 bug

This commit is contained in:
fengjiayi
2025-07-16 16:16:19 +08:00
parent 01ab905155
commit 88a82046b8
16 changed files with 825 additions and 1376 deletions

View File

@@ -12,19 +12,31 @@ namespace Serein.Script.Node
public class ObjectInstantiationNode : ASTNode
{
/// <summary>
/// 类型名称
/// 类型来源
/// </summary>
public string TypeName { get; }
public TypeNode Type { get; }
/// <summary>
/// 构造方法的参数来源
/// </summary>
public List<ASTNode> Arguments { get; }
public ObjectInstantiationNode(string typeName, List<ASTNode> arguments)
/// <summary>
/// 构造器赋值
/// </summary>
public List<CtorAssignmentNode> CtorAssignments { get; private set; } = [];
public ObjectInstantiationNode(TypeNode type, List<ASTNode> arguments)
{
this.TypeName = typeName;
this.Type = type;
this.Arguments = arguments;
}
public ObjectInstantiationNode SetCtorAssignments(List<CtorAssignmentNode> ctorAssignments)
{
CtorAssignments = ctorAssignments;
return this;
}
}
}