private static Range getRangeAndAssertExactlyOne(InstructionHandle ih, String from) {
Range ret = null;
Iterator<InstructionTargeter> tIter = ih.getTargeters().iterator();
if (!tIter.hasNext()) {
throw new BCException("range handle with no range in " + from);
}
while (tIter.hasNext()) {
InstructionTargeter ts = tIter.next();
if (ts instanceof Range) {
if (ret != null) {
throw new BCException("range handle with multiple ranges in " + from);
}
ret = (Range) ts;
}
}
if (ret == null) {
throw new BCException("range handle with no range in " + from);
}
return ret;
}