本文整理汇总了C#中AstNode.SetParent方法的典型用法代码示例。如果您正苦于以下问题:C# AstNode.SetParent方法的具体用法?C# AstNode.SetParent怎么用?C# AstNode.SetParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AstNode
的用法示例。
在下文中一共展示了AstNode.SetParent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: SetValue
/// <summary>Sets yielded expression, and sets its parent to this node.</summary>
/// <remarks>Sets yielded expression, and sets its parent to this node.</remarks>
/// <param name="expr">
/// the value to yield. Can be
/// <code>null</code>
/// .
/// </param>
public virtual void SetValue(AstNode expr)
{
this.value = expr;
if (expr != null)
{
expr.SetParent(this);
}
}
示例3: SetReturnValue
/// <summary>Sets return value expression, and sets its parent to this node.</summary>
/// <remarks>
/// Sets return value expression, and sets its parent to this node.
/// Can be
/// <code>null</code>
/// .
/// </remarks>
public virtual void SetReturnValue(AstNode returnValue)
{
this.returnValue = returnValue;
if (returnValue != null)
{
returnValue.SetParent(this);
}
}
示例4: SetResult
/// <summary>Sets result expression, and sets its parent to this node.</summary>
/// <remarks>Sets result expression, and sets its parent to this node.</remarks>
/// <exception cref="System.ArgumentException">
/// if result is
/// <code>null</code>
/// </exception>
public virtual void SetResult(AstNode result)
{
AssertNotNull(result);
this.result = result;
result.SetParent(this);
}
示例5: SetTarget
/// <summary>
/// Sets the variable name or destructuring form, and sets
/// its parent to this node.
/// </summary>
/// <remarks>
/// Sets the variable name or destructuring form, and sets
/// its parent to this node.
/// </remarks>
/// <exception cref="System.ArgumentException">
/// if target is
/// <code>null</code>
/// </exception>
public virtual void SetTarget(AstNode target)
{
// Don't throw exception if target is an "invalid" node type.
// See mozilla/js/tests/js1_7/block/regress-350279.js
if (target == null)
{
throw new ArgumentException("invalid target arg");
}
this.target = target;
target.SetParent(this);
}
示例6: SetExpression
/// <summary>
/// Sets the switch discriminant expression, and sets its parent
/// to this node.
/// </summary>
/// <remarks>
/// Sets the switch discriminant expression, and sets its parent
/// to this node.
/// </remarks>
/// <exception cref="System.ArgumentException">
/// } if expression is
/// <code>null</code>
/// </exception>
public virtual void SetExpression(AstNode expression)
{
AssertNotNull(expression);
this.expression = expression;
expression.SetParent(this);
}
示例7: SetMemberExprNode
/// <summary>
/// Rhino supports a nonstandard Ecma extension that allows you to
/// say, for instance, function a.b.c(arg1, arg) {...}, and it will
/// be rewritten at codegen time to: a.b.c = function(arg1, arg2) {...}
/// If we detect an expression other than a simple Name in the position
/// where a function name was expected, we record that expression here.
/// </summary>
/// <remarks>
/// Rhino supports a nonstandard Ecma extension that allows you to
/// say, for instance, function a.b.c(arg1, arg) {...}, and it will
/// be rewritten at codegen time to: a.b.c = function(arg1, arg2) {...}
/// If we detect an expression other than a simple Name in the position
/// where a function name was expected, we record that expression here.
/// <p>
/// This extension is only available by setting the CompilerEnv option
/// "isAllowMemberExprAsFunctionName" in the Parser.
/// </remarks>
public virtual void SetMemberExprNode(AstNode node)
{
memberExprNode = node;
if (node != null)
{
node.SetParent(this);
}
}
示例8: AddParam
/// <summary>Adds a parameter to the function parameter list.</summary>
/// <remarks>
/// Adds a parameter to the function parameter list.
/// Sets the parent of the param node to this node.
/// </remarks>
/// <param name="param">the parameter</param>
/// <exception cref="System.ArgumentException">
/// if param is
/// <code>null</code>
/// </exception>
public virtual void AddParam(AstNode param)
{
AssertNotNull(param);
if (@params == null)
{
@params = new List<AstNode>();
}
@params.Add(param);
param.SetParent(this);
}
示例9: SetFinallyBlock
/// <summary>Sets finally block, and sets its parent to this node.</summary>
/// <remarks>
/// Sets finally block, and sets its parent to this node.
/// May be
/// <code>null</code>
/// .
/// </remarks>
public virtual void SetFinallyBlock(AstNode finallyBlock)
{
this.finallyBlock = finallyBlock;
if (finallyBlock != null)
{
finallyBlock.SetParent(this);
}
}
示例10: AddNode
public void AddNode(AstNode node)
{
ChildNodes.Add(node);
node.SetParent(this);
}
示例11: SetOperand
/// <summary>Sets the operand, and sets its parent to be this node.</summary>
/// <remarks>Sets the operand, and sets its parent to be this node.</remarks>
/// <exception cref="System.ArgumentException">
/// } if
/// <code>operand</code>
/// is
/// <code>null</code>
/// </exception>
public virtual void SetOperand(AstNode operand)
{
AssertNotNull(operand);
this.operand = operand;
operand.SetParent(this);
}
示例12: SetThenPart
/// <summary>Sets statement to execute if condition is true</summary>
/// <exception cref="System.ArgumentException">
/// if thenPart is
/// <code>null</code>
/// </exception>
public virtual void SetThenPart(AstNode thenPart)
{
AssertNotNull(thenPart);
this.thenPart = thenPart;
thenPart.SetParent(this);
}
示例13: SetElsePart
/// <summary>Sets statement to execute if condition is false</summary>
/// <param name="elsePart">
/// statement to execute if condition is false.
/// Can be
/// <code>null</code>
/// .
/// </param>
public virtual void SetElsePart(AstNode elsePart)
{
this.elsePart = elsePart;
if (elsePart != null)
{
elsePart.SetParent(this);
}
}
示例14: SetIteratedObject
/// <summary>Sets object being iterated over, and sets its parent to this node.</summary>
/// <remarks>Sets object being iterated over, and sets its parent to this node.</remarks>
/// <exception cref="System.ArgumentException">
/// if
/// <code>object</code>
/// is
/// <code>null</code>
/// </exception>
public virtual void SetIteratedObject(AstNode @object)
{
AssertNotNull(@object);
this.iteratedObject = @object;
@object.SetParent(this);
}
示例15: SetIterator
/// <summary>Sets loop iterator expression: the part before the "in" keyword.</summary>
/// <remarks>
/// Sets loop iterator expression: the part before the "in" keyword.
/// Also sets its parent to this node.
/// </remarks>
/// <exception cref="System.ArgumentException">
/// if
/// <code>iterator</code>
/// is
/// <code>null</code>
/// </exception>
public virtual void SetIterator(AstNode iterator)
{
AssertNotNull(iterator);
this.iterator = iterator;
iterator.SetParent(this);
}