This commit is contained in:
Jelle Luteijn 2022-05-15 11:19:49 +02:00
parent 16e76d6b31
commit 484dbfc9d9
529 changed files with 113694 additions and 0 deletions

View file

@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
namespace AspClassic.Parser;
/// <summary>
/// A parse tree to represent a variable name.
/// </summary>
/// <remarks>
/// A variable name can have an array modifier after it (e.g. 'x(10) As Integer').
/// </remarks>
public sealed class VariableName : Name
{
private readonly SimpleName _Name;
private readonly ArrayTypeName _ArrayType;
/// <summary>
/// The name.
/// </summary>
public SimpleName Name => _Name;
/// <summary>
/// The array modifier, if any.
/// </summary>
public ArrayTypeName ArrayType => _ArrayType;
/// <summary>
/// Constructs a new variable name parse tree.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="arrayType">The array modifier, if any.</param>
/// <param name="span">The location of the parse tree.</param>
public VariableName(SimpleName name, ArrayTypeName arrayType, Span span)
: base(TreeType.VariableName, span)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
SetParent(name);
SetParent(arrayType);
_Name = name;
_ArrayType = arrayType;
}
protected override void GetChildTrees(IList<Tree> childList)
{
Tree.AddChild(childList, Name);
Tree.AddChild(childList, ArrayType);
}
}