2024-04-26 10:18:49 +08:00
|
|
|
|
using Canon.Core.Abstractions;
|
|
|
|
|
using Canon.Core.CodeGenerators;
|
2024-04-21 22:24:35 +08:00
|
|
|
|
using Canon.Core.Enums;
|
2024-04-26 10:18:49 +08:00
|
|
|
|
using Canon.Core.LexicalParser;
|
2024-04-07 16:47:28 +08:00
|
|
|
|
|
|
|
|
|
namespace Canon.Core.SyntaxNodes;
|
|
|
|
|
|
|
|
|
|
public class ValueParameter : NonTerminatedSyntaxNode
|
|
|
|
|
{
|
|
|
|
|
public override NonTerminatorType Type => NonTerminatorType.ValueParameter;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-04-26 10:18:49 +08:00
|
|
|
|
/// 是否为参数中的引用参数
|
2024-04-07 16:47:28 +08:00
|
|
|
|
/// </summary>
|
2024-04-26 10:18:49 +08:00
|
|
|
|
public bool IsReference { get; set; }
|
2024-04-07 16:47:28 +08:00
|
|
|
|
|
2024-04-26 10:18:49 +08:00
|
|
|
|
public IdentifierSemanticToken Token =>
|
|
|
|
|
Children[0].Convert<TerminatedSyntaxNode>().Token.Convert<IdentifierSemanticToken>();
|
2024-04-07 16:47:28 +08:00
|
|
|
|
|
2024-04-26 10:18:49 +08:00
|
|
|
|
public IdentifierList IdentifierList => Children[1].Convert<IdentifierList>();
|
|
|
|
|
|
|
|
|
|
public override void PreVisit(SyntaxNodeVisitor visitor)
|
2024-04-07 16:47:28 +08:00
|
|
|
|
{
|
2024-04-26 10:18:49 +08:00
|
|
|
|
visitor.PreVisit(this);
|
2024-04-07 16:47:28 +08:00
|
|
|
|
}
|
2024-04-21 22:24:35 +08:00
|
|
|
|
|
2024-04-26 10:18:49 +08:00
|
|
|
|
public override void PostVisit(SyntaxNodeVisitor visitor)
|
2024-04-21 22:24:35 +08:00
|
|
|
|
{
|
2024-04-26 10:18:49 +08:00
|
|
|
|
visitor.PostVisit(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ValueParameter Create(List<SyntaxNodeBase> children)
|
|
|
|
|
{
|
|
|
|
|
return new ValueParameter { Children = children };
|
2024-04-21 22:24:35 +08:00
|
|
|
|
}
|
2024-04-07 16:47:28 +08:00
|
|
|
|
}
|