Package org.candle.decompiler.intermediate.graph.enhancer

Source Code of org.candle.decompiler.intermediate.graph.enhancer.Try

package org.candle.decompiler.intermediate.graph.enhancer;

import java.util.HashSet;
import java.util.Set;

import org.candle.decompiler.instruction.graph.edge.EdgeType;
import org.candle.decompiler.intermediate.code.AbstractIntermediate;
import org.candle.decompiler.intermediate.code.TryIntermediate;
import org.candle.decompiler.intermediate.graph.GraphIntermediateVisitor;
import org.candle.decompiler.intermediate.graph.context.IntermediateGraphContext;
import org.candle.decompiler.intermediate.graph.edge.IntermediateEdge;

/**
* Go through all intermediates, and see if the source is an exception edge...
* TODO: Enhance the visitor to visit edge types...
*/
public class Try extends GraphIntermediateVisitor {

  public Try(IntermediateGraphContext igc) {
    super(igc);
  }

  @Override
  public void visitAbstractIntermediate(AbstractIntermediate line) {
   
    //such poor performance...
    final Set<IntermediateEdge> edges = new HashSet<IntermediateEdge>(igc.getIncomingEdges(line));
   
    for(IntermediateEdge ie : edges) {
      if(ie.getType() == EdgeType.EXCEPTION) {
        System.out.println("EXCEEEEEPTIONS!");
       
       
        TryIntermediate ti = new TryIntermediate(line.getInstruction());
        igc.getGraph().addVertex(ti);
        igc.redirectPredecessors(line, ti);
      }
    }
  }
}
TOP

Related Classes of org.candle.decompiler.intermediate.graph.enhancer.Try

TOP
Copyright © 2018 www.massapi.com. 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.