You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 08:49:51 +08:00
Suppress arg in dissassembly if there is none
This commit is contained in:
@@ -20,8 +20,11 @@ class Token:
|
||||
# linestart = starts_line
|
||||
# attr = argval
|
||||
# pattr = argrepr
|
||||
def __init__(self, type_, attr=None, pattr=None, offset=-1, linestart=None):
|
||||
def __init__(self, type_, attr=None, pattr=None, offset=-1,
|
||||
linestart=None, op=None, has_arg=None):
|
||||
self.type = intern(type_)
|
||||
self.op = op
|
||||
self.has_arg = has_arg
|
||||
self.attr = attr
|
||||
self.pattr = pattr
|
||||
self.offset = offset
|
||||
@@ -50,7 +53,10 @@ class Token:
|
||||
offset_opname = '%6s %-17s' % (self.offset, self.type)
|
||||
argstr = "%6d " % self.attr if isinstance(self.attr, int) else (' '*7)
|
||||
pattr = self.pattr if self.pattr is not None else ''
|
||||
return "%s%s%s %r" % (prefix, offset_opname, argstr, pattr)
|
||||
if self.has_arg:
|
||||
return "%s%s%s %r" % (prefix, offset_opname, argstr, pattr)
|
||||
else:
|
||||
return "%s%s" % (prefix, offset_opname)
|
||||
|
||||
def __hash__(self):
|
||||
return hash(self.type)
|
||||
|
Reference in New Issue
Block a user