Skip to content

Commit

Permalink
delete exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzun66 committed Jan 14, 2025
1 parent 13c4ad7 commit 9b138a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class PostOrderBlockIterator implements BlockIterator {

Expand All @@ -45,10 +46,8 @@ public boolean hasNext() {
}

@Override
@Nullable
public BasicBlock<?> next() {
if (!hasNext()) {
throw new NoSuchElementException("There is no more block.");
}
while (!stack.isEmpty()) {
Frame frame = stack.peek();
if (frame.succIterator.hasNext()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class ReversePostOrderBlockIterator implements BlockIterator {
private List<BasicBlock<?>> blocks;
Expand All @@ -46,9 +47,10 @@ public boolean hasNext() {
}

@Override
@Nullable
public BasicBlock<?> next() {
if (!hasNext()) {
throw new NoSuchElementException("There is no more block.");
return null;
}
i++;
return blocks.get(i - 1);
Expand Down

0 comments on commit 9b138a8

Please sign in to comment.