progress
This commit is contained in:
parent
16e76d6b31
commit
484dbfc9d9
529 changed files with 113694 additions and 0 deletions
92
AspClassic.Parser/ForEachBlockStatement.cs
Normal file
92
AspClassic.Parser/ForEachBlockStatement.cs
Normal file
|
@ -0,0 +1,92 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AspClassic.Parser;
|
||||
|
||||
/// <summary>
|
||||
/// A parse tree for a For Each statement.
|
||||
/// </summary>
|
||||
public sealed class ForEachBlockStatement : BlockStatement
|
||||
{
|
||||
private readonly Location _EachLocation;
|
||||
|
||||
private readonly Expression _ControlExpression;
|
||||
|
||||
private readonly VariableDeclarator _ControlVariableDeclarator;
|
||||
|
||||
private readonly Location _InLocation;
|
||||
|
||||
private readonly Expression _CollectionExpression;
|
||||
|
||||
private readonly NextStatement _NextStatement;
|
||||
|
||||
/// <summary>
|
||||
/// The location of the 'Each'.
|
||||
/// </summary>
|
||||
public Location EachLocation => _EachLocation;
|
||||
|
||||
/// <summary>
|
||||
/// The control expression.
|
||||
/// </summary>
|
||||
public Expression ControlExpression => _ControlExpression;
|
||||
|
||||
/// <summary>
|
||||
/// The control variable declarator, if any.
|
||||
/// </summary>
|
||||
public VariableDeclarator ControlVariableDeclarator => _ControlVariableDeclarator;
|
||||
|
||||
/// <summary>
|
||||
/// The location of the 'In'.
|
||||
/// </summary>
|
||||
public Location InLocation => _InLocation;
|
||||
|
||||
/// <summary>
|
||||
/// The collection expression.
|
||||
/// </summary>
|
||||
public Expression CollectionExpression => _CollectionExpression;
|
||||
|
||||
/// <summary>
|
||||
/// The Next statement, if any.
|
||||
/// </summary>
|
||||
public NextStatement NextStatement => _NextStatement;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new parse tree for a For Each statement.
|
||||
/// </summary>
|
||||
/// <param name="eachLocation">The location of the 'Each'.</param>
|
||||
/// <param name="controlExpression">The control expression.</param>
|
||||
/// <param name="controlVariableDeclarator">The control variable declarator, if any.</param>
|
||||
/// <param name="inLocation">The location of the 'In'.</param>
|
||||
/// <param name="collectionExpression">The collection expression.</param>
|
||||
/// <param name="statements">The statements in the block.</param>
|
||||
/// <param name="nextStatement">The Next statement, if any.</param>
|
||||
/// <param name="span">The location of the parse tree.</param>
|
||||
/// <param name="comments">The comments for the parse tree.</param>
|
||||
public ForEachBlockStatement(Location eachLocation, Expression controlExpression, VariableDeclarator controlVariableDeclarator, Location inLocation, Expression collectionExpression, StatementCollection statements, NextStatement nextStatement, Span span, IList<Comment> comments)
|
||||
: base(TreeType.ForEachBlockStatement, statements, span, comments)
|
||||
{
|
||||
if (controlExpression == null)
|
||||
{
|
||||
throw new ArgumentNullException("controlExpression");
|
||||
}
|
||||
SetParent(controlExpression);
|
||||
SetParent(controlVariableDeclarator);
|
||||
SetParent(collectionExpression);
|
||||
SetParent(nextStatement);
|
||||
_EachLocation = eachLocation;
|
||||
_ControlExpression = controlExpression;
|
||||
_ControlVariableDeclarator = controlVariableDeclarator;
|
||||
_InLocation = inLocation;
|
||||
_CollectionExpression = collectionExpression;
|
||||
_NextStatement = nextStatement;
|
||||
}
|
||||
|
||||
protected override void GetChildTrees(IList<Tree> childList)
|
||||
{
|
||||
Tree.AddChild(childList, ControlExpression);
|
||||
Tree.AddChild(childList, ControlVariableDeclarator);
|
||||
Tree.AddChild(childList, CollectionExpression);
|
||||
base.GetChildTrees(childList);
|
||||
Tree.AddChild(childList, NextStatement);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue