| 104 | |
| 105 | @dataclasses.dataclass |
| 106 | class Instruction: |
| 107 | kind: InstructionKind |
| 108 | name: str |
| 109 | text: str |
| 110 | target: str | None |
| 111 | |
| 112 | def is_branch(self) -> bool: |
| 113 | return self.kind in (InstructionKind.LONG_BRANCH, InstructionKind.SHORT_BRANCH) |
| 114 | |
| 115 | def update_target(self, target: str) -> "Instruction": |
| 116 | assert self.target is not None |
| 117 | return Instruction( |
| 118 | self.kind, self.name, self.text.replace(self.target, target), target |
| 119 | ) |
| 120 | |
| 121 | def update_name_and_target(self, name: str, target: str) -> "Instruction": |
| 122 | assert self.target is not None |
| 123 | return Instruction( |
| 124 | self.kind, |
| 125 | name, |
| 126 | self.text.replace(self.name, name).replace(self.target, target), |
| 127 | target, |
| 128 | ) |
| 129 | |
| 130 | |
| 131 | @dataclasses.dataclass(eq=False) |
no outgoing calls
no test coverage detected
searching dependent graphs…