[pypy-svn] r59139 - in pypy/branch/oo-jit/pypy/jit/codegen/cli: . test
antocuni at codespeak.net
antocuni at codespeak.net
Thu Oct 16 13:53:24 CEST 2008
Author: antocuni
Date: Thu Oct 16 13:53:24 2008
New Revision: 59139
Modified:
pypy/branch/oo-jit/pypy/jit/codegen/cli/args_manager.py
pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_args_manager.py
Log:
the logic in _get_indexes was completely broken. Fix.
Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/args_manager.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/args_manager.py (original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/args_manager.py Thu Oct 16 13:53:24 2008
@@ -101,15 +101,12 @@
def _get_indexes(self, fieldtypes):
indexes = []
- curtype = None
- curidx = -1
+ next_idx_by_type = {}
for fieldtype in fieldtypes:
- if fieldtype != curtype:
- curidx = self.type_index[fieldtype]
- curtype = fieldtype
- else:
- curidx += 1
- indexes.append(curidx)
+ startidx = self.type_index[fieldtype]
+ index = next_idx_by_type.get(fieldtype, startidx)
+ indexes.append(index)
+ next_idx_by_type[fieldtype] = index+1
return indexes
Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_args_manager.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_args_manager.py (original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_args_manager.py Thu Oct 16 13:53:24 2008
@@ -66,12 +66,11 @@
assert m.type_index['float'] == 2
def test__get_indexes():
- py.test.skip('fixme')
m = MyArgsManager()
m.register_types(['int', 'float', 'int'])
m.close()
indexes = m._get_indexes(['int', 'float', 'int'])
- assert indexes == [0, 1, 2]
+ assert indexes == [0, 2, 1]
def test_copy_to_inputargs():
meth = FakeMethod()
More information about the Pypy-commit
mailing list