MCPcopy Index your code
hub / github.com/RustPython/RustPython / findlabels

Function findlabels

Lib/dis.py:965–979  ·  view source on GitHub ↗

Detect all offsets in a byte code which are jump targets. Return the list of offsets.

(code)

Source from the content-addressed store, hash-verified

963 extended_args_offset = 0
964
965def findlabels(code):
966 """Detect all offsets in a byte code which are jump targets.
967
968 Return the list of offsets.
969
970 """
971 labels = []
972 for offset, _, op, arg in _unpack_opargs(code):
973 if arg is not None:
974 label = _get_jump_target(op, arg, offset)
975 if label is None:
976 continue
977 if label not in labels:
978 labels.append(label)
979 return labels
980
981def findlinestarts(code):
982 """Find the offsets in a byte code which are start of lines in the source.

Callers 1

_make_labels_mapFunction · 0.85

Calls 3

_unpack_opargsFunction · 0.85
_get_jump_targetFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected