Go through passed offsets, filtering ifs located somewhere mid-line.
(self, ifs)
| 570 | return new_instructions |
| 571 | |
| 572 | def remove_mid_line_ifs(self, ifs): |
| 573 | """ |
| 574 | Go through passed offsets, filtering ifs |
| 575 | located somewhere mid-line. |
| 576 | """ |
| 577 | |
| 578 | # FIXME: this doesn't work for Python 3.6+ |
| 579 | |
| 580 | filtered = [] |
| 581 | for i in ifs: |
| 582 | # For each offset, if line number of current and next op |
| 583 | # is the same |
| 584 | if self.lines[i].l_no == self.lines[i + 3].l_no: |
| 585 | # Skip last op on line if it is some sort of POP_JUMP. |
| 586 | if self.code[self.prev[self.lines[i].next]] in ( |
| 587 | self.opc.PJIT, |
| 588 | self.opc.PJIF, |
| 589 | ): |
| 590 | continue |
| 591 | filtered.append(i) |
| 592 | return filtered |
| 593 | |
| 594 | def resetTokenClass(self): |
| 595 | return self.setTokenClass(Token) |
no test coverage detected