org.mozilla.javascript.ast.WhileLoop.getCondition()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 JavaScript  
字(3.0k)|赞(0)|评价(0)|浏览(223)

本文整理了Java中org.mozilla.javascript.ast.WhileLoop.getCondition()方法的一些代码示例,展示了WhileLoop.getCondition()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WhileLoop.getCondition()方法的具体详情如下:
包路径:org.mozilla.javascript.ast.WhileLoop
类名称:WhileLoop
方法名:getCondition

WhileLoop.getCondition介绍

[英]Returns loop condition
[中]返回循环条件

代码示例

代码示例来源:origin: konsoletyper/teavm

private void print(WhileLoop node) throws IOException {
  writer.append("while").ws().append('(');
  print(node.getCondition());
  writer.append(')').ws();
  print(node.getBody());
}

代码示例来源:origin: org.teavm/teavm-jso-impl

private void print(WhileLoop node) throws IOException {
  writer.append("while").ws().append('(');
  print(node.getCondition());
  writer.append(')').ws();
  print(node.getBody());
}

代码示例来源:origin: wala/WALA

@Override
public CAstNode visitWhileLoop(WhileLoop node, WalkContext arg) {
  AstNode breakStmt = makeEmptyLabelStmt("breakLabel");
  CAstNode breakLabel = visit(breakStmt, arg);
  AstNode contStmt = makeEmptyLabelStmt("contLabel");
  CAstNode contLabel = visit(contStmt, arg);
  WalkContext loopContext = makeLoopContext(node, arg, breakStmt, contStmt);

  CAstNode loop = Ast.makeNode(CAstNode.BLOCK_STMT, 
    contLabel,
    Ast.makeNode(CAstNode.LOOP, 
        visit(node.getCondition(), arg), 
        visit(node.getBody(), loopContext)),
    breakLabel);
  
  arg.cfg().map(node, loop);
  
  return loop;
}

代码示例来源:origin: io.apigee/rhino

private Node transformWhileLoop(WhileLoop loop) {
  decompiler.addToken(Token.WHILE);
  loop.setType(Token.LOOP);
  pushScope(loop);
  try {
    decompiler.addToken(Token.LP);
    Node cond = transform(loop.getCondition());
    decompiler.addToken(Token.RP);
    decompiler.addEOL(Token.LC);
    Node body = transform(loop.getBody());
    decompiler.addEOL(Token.RC);
    return createLoop(loop, LOOP_WHILE, body, cond, null, null);
  } finally {
    popScope();
  }
}

代码示例来源:origin: com.github.tntim96/rhino

private Node transformWhileLoop(WhileLoop loop) {
  decompiler.addToken(Token.WHILE);
  loop.setType(Token.LOOP);
  pushScope(loop);
  try {
    decompiler.addToken(Token.LP);
    Node cond = transform(loop.getCondition());
    decompiler.addToken(Token.RP);
    decompiler.addEOL(Token.LC);
    Node body = transform(loop.getBody());
    decompiler.addEOL(Token.RC);
    return createLoop(loop, LOOP_WHILE, body, cond, null, null);
  } finally {
    popScope();
  }
}

代码示例来源:origin: geogebra/geogebra

private Node transformWhileLoop(WhileLoop loop) {
  decompiler.addToken(Token.WHILE);
  loop.setType(Token.LOOP);
  pushScope(loop);
  try {
    decompiler.addToken(Token.LP);
    Node cond = transform(loop.getCondition());
    decompiler.addToken(Token.RP);
    decompiler.addEOL(Token.LC);
    Node body = transform(loop.getBody());
    decompiler.addEOL(Token.RC);
    return createLoop(loop, LOOP_WHILE, body, cond, null, null);
  } finally {
    popScope();
  }
}

代码示例来源:origin: ro.isdc.wro4j/rhino

private Node transformWhileLoop(WhileLoop loop) {
  decompiler.addToken(Token.WHILE);
  loop.setType(Token.LOOP);
  pushScope(loop);
  try {
    decompiler.addToken(Token.LP);
    Node cond = transform(loop.getCondition());
    decompiler.addToken(Token.RP);
    decompiler.addEOL(Token.LC);
    Node body = transform(loop.getBody());
    decompiler.addEOL(Token.RC);
    return createLoop(loop, LOOP_WHILE, body, cond, null, null);
  } finally {
    popScope();
  }
}

相关文章