private Stmt getFinalTarget(Stmt stmt) { Stmt finalTarget = null, target; // if not a goto, this is the final target if (!(stmt instanceof GotoStmt)) { return stmt; } // first map this statement to itself, so we can detect cycles stmtMap.put(stmt, stmt); target = (Stmt) ((GotoStmt) stmt).getTarget(); // check if target is in statement map if (stmtMap.containsKey(target)) { // see if it maps to itself finalTarget = stmtMap.get(target); if (finalTarget == target) { // this is part of a cycle finalTarget = null; } } else { finalTarget = getFinalTarget(target); } stmtMap.put(stmt, finalTarget); return finalTarget; } // getFinalTarget
newTarget = getFinalTarget(target); if (newTarget == null) { newTarget = stmt; newTarget = getFinalTarget(target); if (newTarget == null) { newTarget = stmt;
private Stmt getFinalTarget(Stmt stmt) { Stmt finalTarget=null, target; // if not a goto, this is the final target if (!(stmt instanceof GotoStmt)) return stmt; // first map this statement to itself, so we can detect cycles stmtMap.put(stmt, stmt); target = (Stmt)((GotoStmt)stmt).getTarget(); // check if target is in statement map if (stmtMap.containsKey(target)) { // see if it maps to itself finalTarget = stmtMap.get(target); if (finalTarget == target) // this is part of a cycle finalTarget = null; } else finalTarget = getFinalTarget(target); stmtMap.put(stmt, finalTarget); return finalTarget; } // getFinalTarget
private Stmt getFinalTarget(Stmt stmt) { Stmt finalTarget=null, target; // if not a goto, this is the final target if (!(stmt instanceof GotoStmt)) return stmt; // first map this statement to itself, so we can detect cycles stmtMap.put(stmt, stmt); target = (Stmt)((GotoStmt)stmt).getTarget(); // check if target is in statement map if (stmtMap.containsKey(target)) { // see if it maps to itself finalTarget = stmtMap.get(target); if (finalTarget == target) // this is part of a cycle finalTarget = null; } else finalTarget = getFinalTarget(target); stmtMap.put(stmt, finalTarget); return finalTarget; } // getFinalTarget
newTarget = getFinalTarget(target); if (newTarget == null) newTarget = stmt; newTarget = getFinalTarget(target); if (newTarget == null) newTarget = stmt;
newTarget = getFinalTarget(target); if (newTarget == null) newTarget = stmt; newTarget = getFinalTarget(target); if (newTarget == null) newTarget = stmt;