Package lombok.ast

Examples of lombok.ast.For


    if (tail != null) for (Node n : tail) if (n != null) result.expressions.add(n);
    return posify(result);
  }
 
  public Node createBasicFor(Node init, Node condition, Node update, Node statement) {
    For result = new For().rawCondition(condition).rawStatement(statement);
    List<Node> updates;
   
    if (update instanceof TemporaryNode.StatementExpressionList) {
      updates = ((TemporaryNode.StatementExpressionList)update).expressions;
    } else {
      updates = Collections.singletonList(update);
    }
   
    if (init instanceof TemporaryNode.StatementExpressionList) {
      for (Node n : ((TemporaryNode.StatementExpressionList)init).expressions) result.rawExpressionInits().addToEnd(n);
    } else {
      result.rawVariableDeclaration(init);
    }
   
    for (Node n : updates) if (n != null) result.rawUpdates().addToEnd(n);
    return posify(result);
  }
View Full Code Here


      Identifier lbl = new Identifier().astValue(node.getLabel().toString());
      set(node, new LabelledStatement().rawStatement(toTree(node.getStatement())).astLabel(lbl));
    }
   
    @Override public void visitForLoop(JCForLoop node) {
      For f = new For();
      f.rawCondition(toTree(node.getCondition()));
      f.rawStatement(toTree(node.getStatement()));
      for (JCExpressionStatement upd : node.getUpdate()) {
        Node updateNode = toTree(upd.getExpression());
        setConversionPositionInfo(updateNode, "exec", getPosition(upd));
        f.rawUpdates().addToEnd(updateNode);
      }
      List<JCStatement> initializers = node.getInitializer();
      // Multiple vardefs in a row need to trigger the JCVD version AND be washed through fillList to be turned into 1 VD.
      if (!initializers.isEmpty() && initializers.get(0) instanceof JCVariableDecl) {
        Block tmp = new Block();
        fillList(initializers, tmp.rawContents(), FlagKey.VARDEF_IS_DEFINITION);
        Node varDecl = tmp.rawContents().first();
        if (varDecl != null) varDecl.unparent();
        f.rawVariableDeclaration(varDecl);
      } else {
        for (JCStatement init : initializers) {
          if (init instanceof JCExpressionStatement) {
            Node initNode = toTree(((JCExpressionStatement) init).getExpression());
            setConversionPositionInfo(initNode, "exec", getPosition(init));
            f.rawExpressionInits().addToEnd(initNode);
          } else {
            f.rawExpressionInits().addToEnd(toTree(init));
          }
        }
      }
      set(node, f);
    }
View Full Code Here

TOP

Related Classes of lombok.ast.For

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.