Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.Statement


  @Override
  public boolean visit(Block node) {
    Iterator<Statement> itr = (Iterator<Statement>) node.statements().iterator();
    int startLine, endLine;
    Statement stmnt;
    FusionLattice<?> pair = null;
     
    while (itr.hasNext()) {
      stmnt = itr.next();
      startLine = getStartLine(stmnt);
      endLine = getEndLine(stmnt);
      pair = analysis.getResultsBeforeAST(stmnt);
      cache.addResult(startLine, endLine, new DebugInfo(stmnt.toString(), startLine, pair.getAliasContext(), pair.getRelContext()));
    }

    return true;
  }
View Full Code Here


   */
  public boolean visit(Block node) {
    this.buffer.append("{\n");//$NON-NLS-1$
    this.indent++;
    for (Iterator it = node.statements().iterator(); it.hasNext(); ) {
      Statement s = (Statement) it.next();
      s.accept(this);
    }
    this.indent--;
    printIndent();
    this.buffer.append("}\n");//$NON-NLS-1$
    return false;
View Full Code Here

    node.getExpression().accept(this);
    this.buffer.append(") ");//$NON-NLS-1$
    this.buffer.append("{\n");//$NON-NLS-1$
    this.indent++;
    for (Iterator it = node.statements().iterator(); it.hasNext(); ) {
      Statement s = (Statement) it.next();
      s.accept(this);
      this.indent--; // incremented in visit(SwitchCase)
    }
    this.indent--;
    printIndent();
    this.buffer.append("}\n");//$NON-NLS-1$
View Full Code Here

      printlni("{");

      indent++;

      for (Object o : node.statements()) {
        Statement s = (Statement) o;
        s.accept(this);
      }

      indent--;
      printlni("}");
      println();
View Full Code Here

  }

  @Override
  public boolean visit(ContinueStatement node) {
    if (node.getLabel() != null) {
      Statement loop = outerLoop(node);
      if (isLabeled(loop, node.getLabel())) {
        printlni("continue;");
      } else {
        printi("{ ");
        printLabelName(node.getLabel());
View Full Code Here

    println(TransformUtil.throwsDecl(node.thrownExceptions()));

    if (node.isConstructor()) {
      println("{");
      indent++;
      Statement first = null;
      List<Statement> statements = node.getBody().statements();
      if (!statements.isEmpty()) {
        first = statements.get(0);
      }

      if (!(first instanceof ConstructorInvocation)) {
        if (!(first instanceof SuperConstructorInvocation)) {
          if (type.getSuperclass() != null) {
            printi("super::");
            TransformUtil.printEmptyCtorCall(out, type);
            println(";");
          }
        } else {
          first.accept(this);
        }

        if (typeInfo.hasInit()) {
          printlni(CName.INSTANCE_INIT + "();");
        }
View Full Code Here

    println(") {");

    boolean indented = false;
    boolean wasCase = false;
    for (int i = 0; i < statements.size(); ++i) {
      Statement s = statements.get(i);

      if (s instanceof VariableDeclarationStatement) {
        if (wasCase) {
          println();
        }
        VariableDeclarationStatement vds = (VariableDeclarationStatement) s;

        for (VariableDeclarationFragment fragment : (Iterable<VariableDeclarationFragment>) vds
            .fragments()) {
          if (fragment.getInitializer() != null) {
            printi();
            fragment.getName().accept(this);
            print(" = ");
            fragment.getInitializer().accept(this);
            println(";");
          }
        }
      } else if (s instanceof SwitchCase) {
        if (wasCase) {
          println();
        }

        if (indented) {
          indent--;
        }

        s.accept(this);

        if (i == statements.size() - 1) {
          println(" { }");
        }
        indent++;
        indented = true;
      } else if (s instanceof Block) {
        if (wasCase) {
          print(" ");
        }
        s.accept(this);
        println();
      } else {
        if (wasCase) {
          println();
        }

        s.accept(this);
      }

      wasCase = s instanceof SwitchCase;
    }
View Full Code Here

    ArrayList<slot> jumpsStatements = new ArrayList<slot>();
    slot currentslot = new slot();
    jumpsStatements.add(currentslot);

    for (Iterator<Statement> iter = node.statements().iterator(); iter.hasNext();) {
      Statement statement = iter.next();
      if (statement instanceof SwitchCase) {
        SwitchCase switchCase = (SwitchCase) statement;
        if (switchCase.isDefault()) {
          jumpDefault = new Jump();
          push(jumpDefault);
View Full Code Here

      graph.createEmptyEdge(cleanVariables, context.nextVertice, switchBlock.variables);
      context = new ProcessingContext(afterVariables, cleanVariables, context.returnDetails);
    }
   
    for(Object obj: node.statements()) {
      Statement stmt = (Statement) obj;
      if (stmt.getNodeType() == ASTNode.SWITCH_CASE) {
        CFGVertice caseVertice = graph.addNewVertice(stmt, "Switch case: " + stmt);
        SwitchCase aCase = (SwitchCase) stmt;
        if (aCase.isDefault()) {
          if (defaultTarget !=null)
            throw new MethodCFGBuilderException("Two defaults??");
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.Statement

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.