58 lines
1.5 KiB
C#
58 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for a dictionary lookup expression.
|
|
/// </summary>
|
|
public sealed class DictionaryLookupExpression : Expression
|
|
{
|
|
private readonly Expression _Qualifier;
|
|
|
|
private readonly Location _BangLocation;
|
|
|
|
private readonly SimpleName _Name;
|
|
|
|
/// <summary>
|
|
/// The dictionary expression.
|
|
/// </summary>
|
|
public Expression Qualifier => _Qualifier;
|
|
|
|
/// <summary>
|
|
/// The location of the '!'.
|
|
/// </summary>
|
|
public Location BangLocation => _BangLocation;
|
|
|
|
/// <summary>
|
|
/// The name to look up.
|
|
/// </summary>
|
|
public SimpleName Name => _Name;
|
|
|
|
/// <summary>
|
|
/// Constructs a new parse tree for a dictionary lookup expression.
|
|
/// </summary>
|
|
/// <param name="qualifier">The dictionary expression.</param>
|
|
/// <param name="bangLocation">The location of the '!'.</param>
|
|
/// <param name="name">The name to look up..</param>
|
|
/// <param name="span">The location of the parse tree.</param>
|
|
public DictionaryLookupExpression(Expression qualifier, Location bangLocation, SimpleName name, Span span)
|
|
: base(TreeType.DictionaryLookupExpression, span)
|
|
{
|
|
if (name == null)
|
|
{
|
|
throw new ArgumentNullException("name");
|
|
}
|
|
SetParent(qualifier);
|
|
SetParent(name);
|
|
_Qualifier = qualifier;
|
|
_BangLocation = bangLocation;
|
|
_Name = name;
|
|
}
|
|
|
|
protected override void GetChildTrees(IList<Tree> childList)
|
|
{
|
|
Tree.AddChild(childList, Qualifier);
|
|
Tree.AddChild(childList, Name);
|
|
}
|
|
}
|