Package org.candle.decompiler.intermediate.code

Examples of org.candle.decompiler.intermediate.code.StatementIntermediate


       
       
        //now, the other GOTO lines coming in should all be CONTINUE statements...
        for(GoToIntermediate gotoIntermediate : incomingGotoNested) {
          Continue continueExpression = new Continue(gotoIntermediate.getInstruction());
          StatementIntermediate continueIntermediate = new StatementIntermediate(gotoIntermediate.getInstruction(), continueExpression);

          //add the node...
          igc.getGraph().addVertex(continueIntermediate);
          igc.redirectPredecessors(gotoIntermediate, continueIntermediate);
          //remove vertex.
View Full Code Here


          //probably an iterator.
          List<AbstractIntermediate> predecessors = Graphs.predecessorListOf(igc.getGraph(), line);
         
          //look at the predecessor lines;  validate there are only 2 predecessors.
          if(predecessors.size() == 2) {
            StatementIntermediate declaration = null;
           
            for(AbstractIntermediate predecessor : predecessors) {
              if(comparator.before(predecessor, line)) {
                //should be declaration.
               
                if(predecessor instanceof StatementIntermediate) {
                  declaration = (StatementIntermediate)predecessor;
                  break;
                }
              }
            }
           
            //check to see if the declaration is a temporary variable..
            if(declaration == null) {
              return;
            }
           
           
            //otherwise, let's see if the declaration is an iterator.
            if(declaration.getExpression() instanceof Declaration) {
              Declaration declarationExpression = (Declaration)declaration.getExpression();
              Variable v = (Variable)declarationExpression.getAssignment().getLeftHandSide();
             
              //check to see if the declaration is the same as the iterator's name.
              if(StringUtils.equals(iteratorName, v.getName())) {
                LOG.debug("Identified Likely Iterator: "+v.getName());
               
                //get the ".next()" statement, which should be the first child.
                AbstractIntermediate firstChild = igc.getTrueTarget(line);
               
                //see if this is a statement, if the statement is an assignment...
                //then check the right side to see if it is an invocation.. and the invocation has the method name "next"...
                if(firstChild instanceof StatementIntermediate) {
                  StatementIntermediate nextStatement = (StatementIntermediate)firstChild;
                  if(nextStatement.getExpression() instanceof Declaration) {
                    //the statement is indeed a declaration.
                    Declaration nextDeclaration = (Declaration)nextStatement.getExpression();
                   
                    if(nextDeclaration.getAssignment().getRightHandSide() instanceof MethodInvocation) {
                      MethodInvocation nextMethodInvocation = (MethodInvocation)nextDeclaration.getAssignment().getRightHandSide();
                     
                      if(StringUtils.equals("next", nextMethodInvocation.getMethodName())) {
View Full Code Here

   
    AbstractIntermediate throwsStatement = null;
    while(iter.hasNext()) {
      AbstractIntermediate i = iter.next();
      if(i instanceof StatementIntermediate) {
        StatementIntermediate s = (StatementIntermediate)i;
       
        if(s.getExpression() instanceof Throw) {
          throwsStatement = s;
          break;
        }
      }
    }
View Full Code Here

  public void visitReturnInstruction(ReturnInstruction instruction) {
    //fall through to typed expressions.
  }
 
  protected void processReturn(Return ret) {
    StatementIntermediate complete = new StatementIntermediate(context.getCurrentInstruction(), ret);
    context.pushIntermediateToInstruction(complete);
  }
View Full Code Here

      for(Field field : context.getJavaClass().getFields()) {
        LOG.debug(field);
      }
    }
   
    StatementIntermediate complete = new StatementIntermediate(context.getCurrentInstruction(), assignment);
   
    context.pushIntermediateToInstruction(complete);
  }
View Full Code Here

    Expression left = context.getExpressions().pop();
   
    FieldAccess fieldRef = new FieldAccess(context.getCurrentInstruction(), left, fieldName);
    Assignment assignment = new Assignment(context.getCurrentInstruction(), fieldRef, right);
   
    StatementIntermediate complete = new StatementIntermediate(context.getCurrentInstruction(), assignment);
   
    context.pushIntermediateToInstruction(complete);
  }
View Full Code Here

    else {
      incrementerBuilder.append(" += ").append(incrementBy);
    }
   
    Expression exp = new Increment(context.getCurrentInstruction(), variable, Type.INT, incrementerBuilder.toString());
    context.pushIntermediateToInstruction(new StatementIntermediate(context.getCurrentInstruction(), exp));
  }
View Full Code Here

   
    Type returned = instruction.getReturnType(context.getMethodGen().getConstantPool());
   
    if(returned == BasicType.VOID) {
      LOG.debug("This is a void return type!!");
      StatementIntermediate completeLine = new StatementIntermediate(context.getCurrentInstruction(), methodInvocation);
      context.pushIntermediateToInstruction(completeLine);
    }
    else {
      context.getExpressions().push(methodInvocation);
    }
View Full Code Here

    MethodInvocation methodInvocation = new MethodInvocation(context.getCurrentInstruction(), left, methodName, parameters);
   
    Type returned = instruction.getReturnType(context.getMethodGen().getConstantPool());
   
    if(returned == BasicType.VOID) {
      StatementIntermediate completeLine = new StatementIntermediate(context.getCurrentInstruction(), methodInvocation);
      context.pushIntermediateToInstruction(completeLine);
      LOG.debug("Pushed complete line: "+completeLine.toString());
    }
    else {
      context.getExpressions().push(methodInvocation);
     
      LOG.debug("Pushed expression: "+methodInvocation);
View Full Code Here

    MethodInvocation methodInvocation = new MethodInvocation(context.getCurrentInstruction(), target, methodName, parameters);
   
    Type returned = instruction.getReturnType(context.getMethodGen().getConstantPool());
   
    if(returned == BasicType.VOID) {
      StatementIntermediate completeLine = new StatementIntermediate(context.getCurrentInstruction(), methodInvocation);
      context.pushIntermediateToInstruction(completeLine);
      LOG.debug("Pushed complete line: "+completeLine.toString());
    }
    else {
      context.getExpressions().push(methodInvocation);
     
      LOG.debug("Pushed expression: "+methodInvocation);
View Full Code Here

TOP

Related Classes of org.candle.decompiler.intermediate.code.StatementIntermediate

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.