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


Java Branch.isConditional方法代码示例

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


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

示例1: apply

import com.google.javascript.jscomp.ControlFlowGraph.Branch; //导入方法依赖的package包/类
public boolean apply(DiGraphEdge<Node, ControlFlowGraph.Branch> input) {
  // First skill all exceptions.
  Branch branch = input.getValue();
  if (branch == Branch.ON_EX) {
    return false;
  } else if (branch.isConditional()) {
    Node condition = NodeUtil.getConditionExpression(
        input.getSource().getValue());
    // TODO(user): We CAN make this bit smarter just looking at
    // constants. We DO have a full blown ReverseAbstractInterupter and
    // type system that can evaluate some impressions' boolean value but
    // for now we will keep this pass lightweight.
    if (condition != null && NodeUtil.isLiteralValue(condition) ) {
      return NodeUtil.getBooleanValue(condition) ==
        (Branch.ON_TRUE == branch);
    }
  }
  return true;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:20,代码来源:CheckMissingReturn.java

示例2: apply

import com.google.javascript.jscomp.ControlFlowGraph.Branch; //导入方法依赖的package包/类
@Override
public boolean apply(EdgeTuple<Node, Branch> input) {
  Branch branch = input.edge;
  if (!branch.isConditional()) {
    return true;
  }
  Node predecessor = input.sourceNode;
  Node condition = NodeUtil.getConditionExpression(predecessor);

  // TODO(user): Handle more complicated expression like true == true,
  // etc....
  if (condition != null) {
    TernaryValue val = NodeUtil.getBooleanValue(condition);
    if (val != TernaryValue.UNKNOWN) {
      return val.toBoolean(true) == (branch == Branch.ON_TRUE);
    }
  }
  return true;
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:20,代码来源:CheckUnreachableCode.java

示例3: apply

import com.google.javascript.jscomp.ControlFlowGraph.Branch; //导入方法依赖的package包/类
public boolean apply(DiGraphEdge<Node, ControlFlowGraph.Branch> input) {
  // First skill all exceptions.
  Branch branch = input.getValue();
  if (branch == Branch.ON_EX) {
    return false;
  } else if (branch.isConditional()) {
    Node condition = NodeUtil.getConditionExpression(
        input.getSource().getValue());
    // TODO(user): We CAN make this bit smarter just looking at
    // constants. We DO have a full blown ReverseAbstractInterupter and
    // type system that can evaluate some impressions' boolean value but
    // for now we will keep this pass lightweight.
    if (condition != null) {
      TernaryValue val = NodeUtil.getBooleanValue(condition);
      if (val != TernaryValue.UNKNOWN) {
        return val.toBoolean(true) == (Branch.ON_TRUE == branch);
      }
    }
  }
  return true;
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:22,代码来源:CheckMissingReturn.java

示例4: apply

import com.google.javascript.jscomp.ControlFlowGraph.Branch; //导入方法依赖的package包/类
@Override
public boolean apply(EdgeTuple<Node, Branch> input) {
  Branch branch = input.edge;
  if (!branch.isConditional()) {
    return true;
  }
  Node predecessor = input.sourceNode;
  Node condition = NodeUtil.getConditionExpression(predecessor);

  // TODO(user): Handle more complicated expression like true == true,
  // etc....
  if (condition != null) {
    TernaryValue val = NodeUtil.getImpureBooleanValue(condition);
    if (val != TernaryValue.UNKNOWN) {
      return val.toBoolean(true) == (branch == Branch.ON_TRUE);
    }
  }
  return true;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:20,代码来源:CheckUnreachableCode.java

示例5: apply

import com.google.javascript.jscomp.ControlFlowGraph.Branch; //导入方法依赖的package包/类
@Override
public boolean apply(DiGraphEdge<Node, ControlFlowGraph.Branch> input) {
  // First skill all exceptions.
  Branch branch = input.getValue();
  if (branch == Branch.ON_EX) {
    return false;
  } else if (branch.isConditional()) {
    Node condition = NodeUtil.getConditionExpression(
        input.getSource().getValue());
    // TODO(user): We CAN make this bit smarter just looking at
    // constants. We DO have a full blown ReverseAbstractInterupter and
    // type system that can evaluate some impressions' boolean value but
    // for now we will keep this pass lightweight.
    if (condition != null) {
      TernaryValue val = NodeUtil.getImpureBooleanValue(condition);
      if (val != TernaryValue.UNKNOWN) {
        return val.toBoolean(true) == (Branch.ON_TRUE == branch);
      }
    }
  }
  return true;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:23,代码来源:CheckMissingReturn.java


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