Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
chore: Remove unused resolvedJumpTarget from PythonBytecodeInstruction
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher-Chianelli committed Mar 28, 2024
1 parent e1eff01 commit 2362f3d
Showing 1 changed file with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,34 @@

public record PythonBytecodeInstruction(String opname, int offset, int arg,
String argRepr, OptionalInt startsLine,
OptionalInt resolvedJumpTarget, boolean isJumpTarget) {
boolean isJumpTarget) {
public static PythonBytecodeInstruction atOffset(String opname, int offset) {
return new PythonBytecodeInstruction(opname, offset, 0, "", java.util.OptionalInt.empty(),
java.util.OptionalInt.empty(), false);
return new PythonBytecodeInstruction(opname, offset, 0, "", OptionalInt.empty(), false);
}

public static PythonBytecodeInstruction atOffset(OpcodeDescriptor instruction, int offset) {
return atOffset(instruction.name(), offset);
}

public PythonBytecodeInstruction withArg(int newArg) {
return new PythonBytecodeInstruction(opname, offset, newArg, argRepr, startsLine, resolvedJumpTarget, isJumpTarget);
return new PythonBytecodeInstruction(opname, offset, newArg, argRepr, startsLine, isJumpTarget);
}

public PythonBytecodeInstruction withArgRepr(String newArgRepr) {
return new PythonBytecodeInstruction(opname, offset, arg, newArgRepr, startsLine, resolvedJumpTarget, isJumpTarget);
}

public PythonBytecodeInstruction withResolvedJumpTarget(int jumpTarget) {
return new PythonBytecodeInstruction(opname, offset, arg, argRepr, startsLine, OptionalInt.of(jumpTarget),
isJumpTarget);
return new PythonBytecodeInstruction(opname, offset, arg, newArgRepr, startsLine, isJumpTarget);
}

public PythonBytecodeInstruction startsLine(int lineNumber) {
return new PythonBytecodeInstruction(opname, offset, arg, argRepr, OptionalInt.of(lineNumber), resolvedJumpTarget,
return new PythonBytecodeInstruction(opname, offset, arg, argRepr, OptionalInt.of(lineNumber),
isJumpTarget);
}

public PythonBytecodeInstruction withIsJumpTarget(boolean isJumpTarget) {
return new PythonBytecodeInstruction(opname, offset, arg, argRepr, startsLine, resolvedJumpTarget, isJumpTarget);
return new PythonBytecodeInstruction(opname, offset, arg, argRepr, startsLine, isJumpTarget);
}

public PythonBytecodeInstruction markAsJumpTarget() {
return new PythonBytecodeInstruction(opname, offset, arg, argRepr, startsLine, resolvedJumpTarget, true);
return new PythonBytecodeInstruction(opname, offset, arg, argRepr, startsLine, true);
}

@Override
Expand Down

0 comments on commit 2362f3d

Please sign in to comment.