当前位置: 首页>>代码示例>>C#>>正文


C# AstNode.GetLength方法代码示例

本文整理汇总了C#中AstNode.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# AstNode.GetLength方法的具体用法?C# AstNode.GetLength怎么用?C# AstNode.GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AstNode的用法示例。


在下文中一共展示了AstNode.GetLength方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ThrowStatement

		public ThrowStatement(int pos, AstNode expr) : base(pos, expr.GetLength())
		{
			{
				type = Token.THROW;
			}
			SetExpression(expr);
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:7,代码来源:ThrowStatement.cs

示例2: SetBody

		/// <summary>Sets loop body.</summary>
		/// <remarks>
		/// Sets loop body.  Sets the parent of the body to this loop node,
		/// and updates its offset to be relative.  Extends the length of this
		/// node to include the body.
		/// </remarks>
		public virtual void SetBody(AstNode body)
		{
			this.body = body;
			int end = body.GetPosition() + body.GetLength();
			this.SetLength(end - this.GetPosition());
			body.SetParent(this);
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:13,代码来源:Loop.cs

示例3: SetLeftAndRight

		public virtual void SetLeftAndRight(AstNode left, AstNode right)
		{
			AssertNotNull(left);
			AssertNotNull(right);
			// compute our bounds while children have absolute positions
			int beg = left.GetPosition();
			int end = right.GetPosition() + right.GetLength();
			SetBounds(beg, end);
			// this updates their positions to be parent-relative
			SetLeft(left);
			SetRight(right);
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:12,代码来源:InfixExpression.cs

示例4: SetBody

		/// <summary>Sets function body, and sets its parent to this node.</summary>
		/// <remarks>
		/// Sets function body, and sets its parent to this node.
		/// Also sets the encoded source bounds based on the body bounds.
		/// Assumes the function node absolute position has already been set,
		/// and the body node's absolute position and length are set.<p>
		/// </remarks>
		/// <param name="body">
		/// function body.  Its parent is set to this node, and its
		/// position is updated to be relative to this node.
		/// </param>
		/// <exception cref="System.ArgumentException">
		/// if body is
		/// <code>null</code>
		/// </exception>
		public virtual void SetBody(AstNode body)
		{
			AssertNotNull(body);
			this.body = body;
			if (true.Equals(body.GetProp(Node.EXPRESSION_CLOSURE_PROP)))
			{
				SetIsExpressionClosure(true);
			}
			int absEnd = body.GetPosition() + body.GetLength();
			body.SetParent(this);
			this.SetLength(absEnd - this.position);
			SetEncodedSourceBounds(this.position, absEnd);
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:28,代码来源:FunctionNode.cs

示例5: ExpressionStatement

		/// <summary>
		/// Constructs a new
		/// <code>ExpressionStatement</code>
		/// wrapping
		/// the specified expression.  Sets this node's position to the
		/// position of the wrapped node, and sets the wrapped node's
		/// position to zero.  Sets this node's length to the length of
		/// the wrapped node.
		/// </summary>
		/// <param name="expr">the wrapped expression</param>
		public ExpressionStatement(AstNode expr) : this(expr.GetPosition(), expr.GetLength(), expr)
		{
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:13,代码来源:ExpressionStatement.cs

示例6: UnaryExpression

		/// <summary>
		/// Constructs a new UnaryExpression with the specified operator
		/// and operand.
		/// </summary>
		/// <remarks>
		/// Constructs a new UnaryExpression with the specified operator
		/// and operand.  It sets the parent of the operand, and sets its own bounds
		/// to encompass the operator and operand.
		/// </remarks>
		/// <param name="operator">the node type</param>
		/// <param name="operatorPosition">the absolute position of the operator.</param>
		/// <param name="operand">the operand expression</param>
		/// <param name="postFix">true if the operator follows the operand.  Int</param>
		/// <exception cref="System.ArgumentException">
		/// } if
		/// <code>operand</code>
		/// is
		/// <code>null</code>
		/// </exception>
		public UnaryExpression(int @operator, int operatorPosition, AstNode operand, bool postFix)
		{
			AssertNotNull(operand);
			int beg = postFix ? operand.GetPosition() : operatorPosition;
			// JavaScript only has ++ and -- postfix operators, so length is 2
			int end = postFix ? operatorPosition + 2 : operand.GetPosition() + operand.GetLength();
			SetBounds(beg, end);
			SetOperator(@operator);
			SetOperand(operand);
			isPostfix = postFix;
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:30,代码来源:UnaryExpression.cs

示例7: ParenthesizedExpression

		public ParenthesizedExpression(AstNode expr) : this(expr != null ? expr.GetPosition() : 0, expr != null ? expr.GetLength() : 1, expr)
		{
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:3,代码来源:ParenthesizedExpression.cs

示例8: AddStatement

		/// <summary>Adds a statement to the end of the statement list.</summary>
		/// <remarks>
		/// Adds a statement to the end of the statement list.
		/// Sets the parent of the new statement to this node, updates
		/// its start offset to be relative to this node, and sets the
		/// length of this node to include the new child.
		/// </remarks>
		/// <param name="statement">a child statement</param>
		/// <exception cref="System.ArgumentException">
		/// } if statement is
		/// <code>null</code>
		/// </exception>
		public virtual void AddStatement(AstNode statement)
		{
			AssertNotNull(statement);
			if (statements == null)
			{
				statements = new List<AstNode>();
			}
			int end = statement.GetPosition() + statement.GetLength();
			this.SetLength(end - this.GetPosition());
			statements.Add(statement);
			statement.SetParent(this);
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:24,代码来源:SwitchCase.cs


注:本文中的AstNode.GetLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。