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


Java Node.removeChildAfter方法代码示例

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


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

示例1: split

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
private void split(Node n) {
  Node c = n.getFirstChild();
  Node before = null;
  while (c != null) {
    Node next = c.getNext();
    if (shouldSplit.apply(c)) {
      Node placeHolder = placeHolderProvider.get();
      if (before == null) {
        forest.add(n.removeFirstChild());
        n.addChildToFront(placeHolder);
      } else {
        n.addChildAfter(placeHolder, c);
        n.removeChildAfter(before);
        forest.add(c);
      }
      recordSplitPoint(placeHolder, before, c);
      before = placeHolder;
    } else {
      split(c);
      before = c;
    }
    c = next;
  }
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:25,代码来源:AstParallelizer.java

示例2: moveNamedFunctions

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
/**
 * Move all the functions that are valid at the execution of the first
 * statement of the function to the beginning of the function definition.
 */
private void moveNamedFunctions(Node functionBody) {
  Preconditions.checkState(
      functionBody.getParent().getType() == Token.FUNCTION);
  Node previous = null;
  Node current = functionBody.getFirstChild();
  // Skip any declarations at the beginning of the function body, they
  // are already in the right place.
  while (current != null && NodeUtil.isFunctionDeclaration(current)) {
    previous = current;
    current = current.getNext();
  }

  // Find any remaining declarations and move them.
  Node insertAfter = previous;
  while (current != null) {
    // Save off the next node as the current node maybe removed.
    Node next = current.getNext();
    if (NodeUtil.isFunctionDeclaration(current)) {
      // Remove the declaration from the body.
      Preconditions.checkNotNull(previous);
      functionBody.removeChildAfter(previous);

      // Readd the function at the top of the function body (after any
      // previous declarations).
      insertAfter = addToFront(functionBody, current, insertAfter);
      reportCodeChange("Move function declaration not at top of function");
    } else {
      // Update the previous only if the current node hasn't been moved.
      previous = current;
    }
    current = next;
  }
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:38,代码来源:Normalize.java


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