本文整理汇总了C#中EcmaScript.NET.Node.addChildAfter方法的典型用法代码示例。如果您正苦于以下问题:C# Node.addChildAfter方法的具体用法?C# Node.addChildAfter怎么用?C# Node.addChildAfter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EcmaScript.NET.Node
的用法示例。
在下文中一共展示了Node.addChildAfter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addBeforeCurrent
private static Node addBeforeCurrent(Node parent, Node previous, Node current, Node toAdd)
{
if (previous == null) {
if (!(current == parent.FirstChild))
Context.CodeBug ();
parent.addChildToFront (toAdd);
}
else {
if (!(current == previous.Next))
Context.CodeBug ();
parent.addChildAfter (toAdd, previous);
}
return toAdd;
}
示例2: closeSwitch
internal void closeSwitch(Node switchBlock)
{
if (switchBlock.Type != Token.BLOCK)
throw Context.CodeBug ();
Node.Jump switchNode = (Node.Jump)switchBlock.FirstChild;
if (switchNode.Type != Token.SWITCH)
throw Context.CodeBug ();
Node switchBreakTarget = Node.newTarget ();
// switchNode.target is only used by NodeTransformer
// to detect switch end
switchNode.target = switchBreakTarget;
Node defaultTarget = switchNode.Default;
if (defaultTarget == null) {
defaultTarget = switchBreakTarget;
}
switchBlock.addChildAfter (makeJump (Token.GOTO, defaultTarget), switchNode);
switchBlock.addChildToBack (switchBreakTarget);
}
示例3: CreateLoop
private Node CreateLoop(Node.Jump loop, int loopType, Node body, Node cond, Node init, Node incr)
{
Node bodyTarget = Node.newTarget ();
Node condTarget = Node.newTarget ();
if (loopType == LOOP_FOR && cond.Type == Token.EMPTY) {
cond = new Node (Token.TRUE);
}
Node.Jump IFEQ = new Node.Jump (Token.IFEQ, cond);
IFEQ.target = bodyTarget;
Node breakTarget = Node.newTarget ();
loop.addChildToBack (bodyTarget);
loop.addChildrenToBack (body);
if (loopType == LOOP_WHILE || loopType == LOOP_FOR) {
// propagate lineno to condition
loop.addChildrenToBack (new Node (Token.EMPTY, loop.Lineno));
}
loop.addChildToBack (condTarget);
loop.addChildToBack (IFEQ);
loop.addChildToBack (breakTarget);
loop.target = breakTarget;
Node continueTarget = condTarget;
if (loopType == LOOP_WHILE || loopType == LOOP_FOR) {
// Just add a GOTO to the condition in the do..while
loop.addChildToFront (makeJump (Token.GOTO, condTarget));
if (loopType == LOOP_FOR) {
if (init.Type != Token.EMPTY) {
if (init.Type != Token.VAR) {
init = new Node (Token.EXPR_VOID, init);
}
loop.addChildToFront (init);
}
Node incrTarget = Node.newTarget ();
loop.addChildAfter (incrTarget, body);
if (incr.Type != Token.EMPTY) {
incr = new Node (Token.EXPR_VOID, incr);
loop.addChildAfter (incr, incrTarget);
}
continueTarget = incrTarget;
}
}
loop.Continue = continueTarget;
return loop;
}