Beispiel #1
0
 def __init__(self, space, code, globals, constargs={}, closure=None,
              name=None):
     ExecutionContext.__init__(self, space)
     self.code = code
     
     self.w_globals = w_globals = space.wrap(globals)
     
     self.crnt_offset = -1
     self.crnt_frame = None
     if closure is None:
         self.closure = None
     else:
         from pypy.interpreter.nestedscope import Cell
         self.closure = [Cell(Constant(value)) for value in closure]
     frame = self.create_frame()
     formalargcount = code.getformalargcount()
     arg_list = [Variable() for i in range(formalargcount)]
     for position, value in constargs.items():
         arg_list[position] = Constant(value)
     frame.setfastscope(arg_list)
     self.joinpoints = {}
     #for joinpoint in code.getjoinpoints():
     #    self.joinpoints[joinpoint] = []  # list of blocks
     initialblock = SpamBlock(FrameState(frame).copy())
     self.pendingblocks = [initialblock]
     self.graph = FunctionGraph(name or code.co_name, initialblock)
Beispiel #2
0
    def __init__(self,
                 space,
                 code,
                 globals,
                 constargs={},
                 outer_func=None,
                 name=None,
                 is_generator=False):
        ExecutionContext.__init__(self, space)
        self.code = code

        self.w_globals = w_globals = space.wrap(globals)

        self.crnt_offset = -1
        self.crnt_frame = None
        if outer_func and outer_func.closure:
            self.closure = [
                nestedscope.Cell(Constant(value))
                for value in outer_func.closure
            ]
        else:
            self.closure = None
        frame = self.create_frame()
        formalargcount = code.getformalargcount()
        arg_list = [Variable() for i in range(formalargcount)]
        for position, value in constargs.items():
            arg_list[position] = Constant(value)
        frame.setfastscope(arg_list)
        self.joinpoints = {}
        initialblock = SpamBlock(FrameState(frame).copy())
        self.pendingblocks = collections.deque([initialblock])
        self.graph = FunctionGraph(name or code.co_name, initialblock)
        self.is_generator = is_generator
Beispiel #3
0
 def __init__(self, space, code, globals, constargs={}, closure=None,
              name=None):
     ExecutionContext.__init__(self, space)
     self.code = code
     
     self.w_globals = w_globals = space.wrap(globals)
     
     self.crnt_offset = -1
     self.crnt_frame = None
     if closure is None:
         self.closure = None
     else:
         from pypy.interpreter.nestedscope import Cell
         self.closure = [Cell(Constant(value)) for value in closure]
     frame = self.create_frame()
     formalargcount = code.getformalargcount()
     arg_list = [Variable() for i in range(formalargcount)]
     for position, value in constargs.items():
         arg_list[position] = Constant(value)
     frame.setfastscope(arg_list)
     self.joinpoints = {}
     #for joinpoint in code.getjoinpoints():
     #    self.joinpoints[joinpoint] = []  # list of blocks
     initialblock = SpamBlock(FrameState(frame).copy())
     self.pendingblocks = collections.deque([initialblock])
     self.graph = FunctionGraph(name or code.co_name, initialblock)
Beispiel #4
0
    def __init__(self, space, code, globals, constargs={}, outer_func=None,
                 name=None, is_generator=False):
        ExecutionContext.__init__(self, space)
        self.code = code

        self.w_globals = w_globals = space.wrap(globals)

        self.crnt_offset = -1
        self.crnt_frame = None
        if outer_func and outer_func.closure:
            self.closure = [nestedscope.Cell(Constant(value))
                            for value in outer_func.closure]
        else:
            self.closure = None
        frame = self.create_frame()
        formalargcount = code.getformalargcount()
        arg_list = [Variable() for i in range(formalargcount)]
        for position, value in constargs.items():
            arg_list[position] = Constant(value)
        frame.setfastscope(arg_list)
        self.joinpoints = {}
        initialblock = SpamBlock(FrameState(frame).copy())
        self.pendingblocks = collections.deque([initialblock])
        self.graph = FunctionGraph(name or code.co_name, initialblock)
        self.is_generator = is_generator