Skip to content

Commit

Permalink
Clean up opcode fields
Browse files Browse the repository at this point in the history
  • Loading branch information
liach committed Aug 28, 2024
1 parent 32c9750 commit 8d4c718
Show file tree
Hide file tree
Showing 8 changed files with 379 additions and 285 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ default CodeBuilder ifThen(Consumer<BlockCodeBuilder> thenHandler) {
*/
default CodeBuilder ifThen(Opcode opcode,
Consumer<BlockCodeBuilder> thenHandler) {
if (opcode.kind() != Opcode.Kind.BRANCH || opcode.primaryTypeKind() == TypeKind.VoidType) {
if (opcode.kind() != Opcode.Kind.BRANCH || BytecodeHelpers.isUnconditionalBranch(opcode)) {
throw new IllegalArgumentException("Illegal branch opcode: " + opcode);
}

Expand Down Expand Up @@ -312,7 +312,7 @@ default CodeBuilder ifThenElse(Consumer<BlockCodeBuilder> thenHandler,
default CodeBuilder ifThenElse(Opcode opcode,
Consumer<BlockCodeBuilder> thenHandler,
Consumer<BlockCodeBuilder> elseHandler) {
if (opcode.kind() != Opcode.Kind.BRANCH || opcode.primaryTypeKind() == TypeKind.VoidType) {
if (opcode.kind() != Opcode.Kind.BRANCH || BytecodeHelpers.isUnconditionalBranch(opcode)) {
throw new IllegalArgumentException("Illegal branch opcode: " + opcode);
}

Expand Down
Loading

0 comments on commit 8d4c718

Please sign in to comment.