(firstlineno, linetable)
| 672 | return uval >> 1 |
| 673 | |
| 674 | def parse_location_table(firstlineno, linetable): |
| 675 | line = firstlineno |
| 676 | addr = 0 |
| 677 | it = iter(linetable) |
| 678 | while True: |
| 679 | try: |
| 680 | first_byte = read(it) |
| 681 | except StopIteration: |
| 682 | return |
| 683 | code = (first_byte >> 3) & 15 |
| 684 | length = (first_byte & 7) + 1 |
| 685 | end_addr = addr + length |
| 686 | if code == 15: |
| 687 | yield addr, end_addr, None |
| 688 | addr = end_addr |
| 689 | continue |
| 690 | elif code == 14: # Long form |
| 691 | line_delta = read_signed_varint(it) |
| 692 | line += line_delta |
| 693 | end_line = line + read_varint(it) |
| 694 | col = read_varint(it) |
| 695 | end_col = read_varint(it) |
| 696 | elif code == 13: # No column |
| 697 | line_delta = read_signed_varint(it) |
| 698 | line += line_delta |
| 699 | elif code in (10, 11, 12): # new line |
| 700 | line_delta = code - 10 |
| 701 | line += line_delta |
| 702 | column = read(it) |
| 703 | end_column = read(it) |
| 704 | else: |
| 705 | assert (0 <= code < 10) |
| 706 | second_byte = read(it) |
| 707 | column = code << 3 | (second_byte >> 4) |
| 708 | yield addr, end_addr, line |
| 709 | addr = end_addr |
| 710 | |
| 711 | |
| 712 | class PyCodeArrayPtr: |
no test coverage detected
searching dependent graphs…