progress
This commit is contained in:
parent
16e76d6b31
commit
484dbfc9d9
529 changed files with 113694 additions and 0 deletions
76
AspClassic.Parser/CompoundAssignmentStatement.cs
Normal file
76
AspClassic.Parser/CompoundAssignmentStatement.cs
Normal file
|
@ -0,0 +1,76 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AspClassic.Parser;
|
||||
|
||||
/// <summary>
|
||||
/// A parse tree for a compound assignment statement.
|
||||
/// </summary>
|
||||
public sealed class CompoundAssignmentStatement : Statement
|
||||
{
|
||||
private readonly Expression _TargetExpression;
|
||||
|
||||
private readonly OperatorType _CompoundOperator;
|
||||
|
||||
private readonly Location _OperatorLocation;
|
||||
|
||||
private readonly Expression _SourceExpression;
|
||||
|
||||
/// <summary>
|
||||
/// The target of the assignment.
|
||||
/// </summary>
|
||||
public Expression TargetExpression => _TargetExpression;
|
||||
|
||||
/// <summary>
|
||||
/// The compound operator.
|
||||
/// </summary>
|
||||
public OperatorType CompoundOperator => _CompoundOperator;
|
||||
|
||||
/// <summary>
|
||||
/// The location of the operator.
|
||||
/// </summary>
|
||||
public Location OperatorLocation => _OperatorLocation;
|
||||
|
||||
/// <summary>
|
||||
/// The source of the assignment.
|
||||
/// </summary>
|
||||
public Expression SourceExpression => _SourceExpression;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new parse tree for a compound assignment statement.
|
||||
/// </summary>
|
||||
/// <param name="compoundOperator">The compound operator.</param>
|
||||
/// <param name="targetExpression">The target of the assignment.</param>
|
||||
/// <param name="operatorLocation">The location of the operator.</param>
|
||||
/// <param name="sourceExpression">The source of the assignment.</param>
|
||||
/// <param name="span">The location of the parse tree.</param>
|
||||
/// <param name="comments">The comments for the parse tree.</param>
|
||||
public CompoundAssignmentStatement(OperatorType compoundOperator, Expression targetExpression, Location operatorLocation, Expression sourceExpression, Span span, IList<Comment> comments)
|
||||
: base(TreeType.CompoundAssignmentStatement, span, comments)
|
||||
{
|
||||
if (compoundOperator < OperatorType.Plus || compoundOperator > OperatorType.Power)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("compoundOperator");
|
||||
}
|
||||
if (targetExpression == null)
|
||||
{
|
||||
throw new ArgumentNullException("targetExpression");
|
||||
}
|
||||
if (sourceExpression == null)
|
||||
{
|
||||
throw new ArgumentNullException("sourceExpression");
|
||||
}
|
||||
SetParent(targetExpression);
|
||||
SetParent(sourceExpression);
|
||||
_CompoundOperator = compoundOperator;
|
||||
_TargetExpression = targetExpression;
|
||||
_OperatorLocation = operatorLocation;
|
||||
_SourceExpression = sourceExpression;
|
||||
}
|
||||
|
||||
protected override void GetChildTrees(IList<Tree> childList)
|
||||
{
|
||||
Tree.AddChild(childList, TargetExpression);
|
||||
Tree.AddChild(childList, SourceExpression);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue