Skip to content
Permalink
Browse files

Switched to using reversed. THIS REQUIRES UPGRADING YOUR PYPY CHECKOUT.

  • Loading branch information
Alex Gaynor
Alex Gaynor committed Apr 29, 2013
1 parent 70b72b4 commit 48a0ca3c5354d4062a00aba7151f4d1fb8869313
Showing with 8 additions and 13 deletions.
  1. +1 −2 topaz/ast.py
  2. +3 −3 topaz/astcompiler.py
  3. +1 −2 topaz/objects/arrayobject.py
  4. +3 −6 topaz/objects/moduleobject.py
@@ -822,8 +822,7 @@ def compile(self, ctx):
for name, pos in block_ctx.symtable.cell_numbers.iteritems():
cells[pos] = name
num_cells = 0
for i in xrange(len(cells) - 1, -1, -1):
name = cells[i]
for name in reversed(cells):
if block_ctx.symtable.cells[name] == block_ctx.symtable.FREEVAR:
ctx.emit(consts.LOAD_CLOSURE, ctx.symtable.get_cell_num(name))
num_cells += 1
@@ -212,9 +212,9 @@ def in_frame_block(self, block_type):
return False

def find_frame_block(self, block_type):
for i in xrange(len(self.frame_blocks) - 1, -1, -1):
if self.frame_blocks[i][0] == block_type:
return self.frame_blocks[i][1]
for frame_block in reversed(self.frame_blocks):
if frame_block[0] == block_type:
return frame_block[1]
raise SystemError

def new_block(self):
@@ -209,8 +209,7 @@ def method_shift(self, space, w_n=None):
@classdef.method("unshift")
@check_frozen()
def method_unshift(self, space, args_w):
for i in xrange(len(args_w) - 1, -1, -1):
w_obj = args_w[i]
for w_obj in reversed(args_w):
self.items_w.insert(0, w_obj)
return self

@@ -184,9 +184,7 @@ def _find_const_pure(self, name, version):

@jit.unroll_safe
def set_class_var(self, space, name, w_obj):
ancestors = self.ancestors()
for idx in xrange(len(ancestors) - 1, -1, -1):
module = ancestors[idx]
for module in reversed(self.ancestors()):
assert isinstance(module, W_ModuleObject)
w_res = module.class_variables.get(space, name)
if w_res is not None or module is self:
@@ -326,9 +324,8 @@ def method_include(self, space, w_mod):

@classdef.method("append_features")
def method_append_features(self, space, w_mod):
ancestors = self.ancestors()
for idx in xrange(len(ancestors) - 1, -1, -1):
w_mod.include_module(space, ancestors[idx])
for module in reversed(self.ancestors()):
w_mod.include_module(space, module)

@classdef.method("define_method", name="symbol")
def method_define_method(self, space, name, w_method=None, block=None):

0 comments on commit 48a0ca3

Please sign in to comment.