using System;
using System.Collections.Generic;
namespace AspClassic.Parser;
///
/// A parse tree for a dictionary lookup expression.
///
public sealed class DictionaryLookupExpression : Expression
{
private readonly Expression _Qualifier;
private readonly Location _BangLocation;
private readonly SimpleName _Name;
///
/// The dictionary expression.
///
public Expression Qualifier => _Qualifier;
///
/// The location of the '!'.
///
public Location BangLocation => _BangLocation;
///
/// The name to look up.
///
public SimpleName Name => _Name;
///
/// Constructs a new parse tree for a dictionary lookup expression.
///
/// The dictionary expression.
/// The location of the '!'.
/// The name to look up..
/// The location of the parse tree.
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 childList)
{
Tree.AddChild(childList, Qualifier);
Tree.AddChild(childList, Name);
}
}