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


Java Node.isSyntheticBlock方法代码示例

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


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

示例1: tryFoldBlock

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
/**
 * Try removing unneeded block nodes and their useless children
 */
void tryFoldBlock(NodeTraversal t, Node n, Node parent) {
  // Remove any useless children
  for (Node c = n.getFirstChild(); c != null; ) {
    Node next = c.getNext();  // save c.next, since 'c' may be removed
    if (!NodeUtil.mayHaveSideEffects(c)) {
      n.removeChild(c);  // lazy kids
      t.getCompiler().reportCodeChange();
    }
    c = next;
  }

  if (n.isSyntheticBlock() || parent == null) {
    return;
  }

  // Try to remove the block.
  if (NodeUtil.tryMergeBlock(n)) {
    t.getCompiler().reportCodeChange();
  }
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:24,代码来源:FoldConstants.java

示例2: handleStmtList

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
private void handleStmtList(Node node) {
  Node parent = node.getParent();
  // Special case, don't add a block of empty CATCH block to the graph.
  if (node.getType() == Token.BLOCK && parent != null &&
      parent.getType() == Token.TRY &&
      NodeUtil.getCatchBlock(parent) == node &&
      !NodeUtil.hasCatchHandler(node)) {
    return;
  }

  // A block transfer control to its first child if it is not empty.
  Node child = node.getFirstChild();

  // Function declarations are skipped since control doesn't go into that
  // function (unless it is called)
  while (child != null && child.getType() == Token.FUNCTION) {
    child = child.getNext();
  }

  if (child != null) {
    createEdge(node, Branch.UNCOND, computeFallThrough(child));
  } else {
    createEdge(node, Branch.UNCOND, computeFollowNode(node));
  }

  // Synthetic blocks
  if (parent != null) {
    switch (parent.getType()) {
      case Token.DEFAULT:
      case Token.CASE:
      case Token.TRY:
        break;
      default:
        if (node.getType() == Token.BLOCK && node.isSyntheticBlock()) {
          Node next = node.getLastChild();
          if (next != null) {
            createEdge(node, Branch.SYN_BLOCK, computeFallThrough(next));
          }
        }
        break;
    }
  }
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:44,代码来源:ControlFlowAnalysis.java


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