def op_LOAD_DEREF(self, inst, res): n_cellvars = len(self.code_cellvars) if inst.arg < n_cellvars: name = self.code_cellvars[inst.arg] gl = self.get(name) else: idx = inst.arg - n_cellvars name = self.code_freevars[idx] value = self.get_closure_value(idx) gl = ir.FreeVar(idx, name, value, loc=self.loc) self.store(gl, res)
def op_LOAD_CLOSURE(self, inst, res): n_cellvars = len(self.code_cellvars) if inst.arg < n_cellvars: name = self.code_cellvars[inst.arg] try: gl = self.get(name) except NotDefinedError as e: raise NotImplementedError("Unsupported use of op_LOAD_CLOSURE encountered") else: idx = inst.arg - n_cellvars name = self.code_freevars[idx] value = self.get_closure_value(idx) gl = ir.FreeVar(idx, name, value, loc=self.loc) self.store(gl, res)