Package org.candle.decompiler.intermediate.code

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


  public void visitCaseIntermediate(CaseIntermediate line) {
    SwitchIntermediate si = (SwitchIntermediate)igc.getSinglePredecessor(line);

    List<CaseIntermediate> switchCases = igc.getCases(si);
    int position = line.getBlockRange().getStart().getPosition();
    CaseIntermediate next = findNextCase(switchCases, position);

    if(next != null) {
      line.getBlockRange().setEnd(next.getBlockRange().getStart().getPrev());
    }
    else {
      //we should get the end from the parent.
      line.getBlockRange().setEnd(si.getBlockRange().getEnd());
    }
View Full Code Here


  }
 
  protected CaseIntermediate findNextCase(List<CaseIntermediate> cases, int position) {
   
    for(AbstractIntermediate switchCase : cases) {
      CaseIntermediate sc = (CaseIntermediate)switchCase;
     
      if(sc.getBlockRange().getStart().getPosition() > position) {
        return (CaseIntermediate)switchCase;
      }
    }
   
    return null;
View Full Code Here

   
    //now, create the graph.
   
    igc.getGraph().addVertex(line);
    if(line.getDefaultCase() != null) {
      CaseIntermediate si = new CaseIntermediate(line.getInstruction(), line.getDefaultCase());
      igc.getGraph().addVertex(si);
     
      //add an edge.
      igc.getGraph().addEdge(line, si);

      //add edge from outcome to edge.
      LOG.debug(si);
      AbstractIntermediate target = ilc.getNext(line.getDefaultCase().getTarget().getPosition());
     
      LOG.debug("TargeT:"+target);
      igc.getGraph().addVertex(target);
      igc.getGraph().addEdge(si, target);
    }
   
   
    for(Case caseVal : line.getCases()) {
      CaseIntermediate si = new CaseIntermediate(line.getInstruction(), caseVal);
      igc.getGraph().addVertex(si);
     
      //add an edge.
      igc.getGraph().addEdge(line, si);
     
View Full Code Here

TOP

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

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.