Пример #1
0
 def __init__(self, label=''):
     self.insts = []
     self.inEdges = misc.Set()
     self.outEdges = misc.Set()
     self.label = label
     self.bid = Block._count
     self.next = []
     Block._count = Block._count + 1
Пример #2
0
    def __init__(self, name, filename, args=(), optimized=0, klass=None):
        self.super_init()
        self.hasjrel = misc.Set()
        self.hasjabs = misc.Set()
        for i in dis.hasjrel:
            self.hasjrel.add(dis.opname[i])
        for i in dis.hasjabs:
            self.hasjabs.add(dis.opname[i])

        self.name = name
        self.filename = filename
        self.docstring = None
        self.args = args  # XXX
        self.argcount = getArgCount(args)
        self.klass = klass
        if optimized:
            self.flags = CO_OPTIMIZED | CO_NEWLOCALS
        else:
            self.flags = 0
        self.consts = []
        self.names = []
        # Free variables found by the symbol table scan, including
        # variables used only in nested scopes, are included here.
        self.freevars = []
        self.cellvars = []
        # The closure list is used to track the order of cell
        # variables and free variables in the resulting code object.
        # The offsets used by LOAD_CLOSURE/LOAD_DEREF refer to both
        # kinds of variables.
        self.closure = []
        self.varnames = list(args) or []
        for i in range(len(self.varnames)):
            var = self.varnames[i]
            if isinstance(var, TupleArg):
                self.varnames[i] = var.getName()
        self.stage = RAW

        for name, obj in dir(self):
            if name[:9] == "_convert_":
                opname = name[9:]
                self._converters[opname] = obj

        for num in range(len(dis.opname)):
            opnum[dis.opname[num]] = num
Пример #3
0
 def __init__(self):
     self.current = self.entry = Block()
     self.exit = Block("exit")
     self.blocks = misc.Set()
     self.blocks.add(self.entry)
     self.blocks.add(self.exit)