[pypy-svn] r48937 - pypy/dist/pypy/translator/llvm
rxe at codespeak.net
rxe at codespeak.net
Thu Nov 22 18:18:35 CET 2007
Author: rxe
Date: Thu Nov 22 18:18:33 2007
New Revision: 48937
Modified:
pypy/dist/pypy/translator/llvm/structnode.py
Log:
bug fix found by turning on optimizations for tests
Modified: pypy/dist/pypy/translator/llvm/structnode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/structnode.py (original)
+++ pypy/dist/pypy/translator/llvm/structnode.py Thu Nov 22 18:18:33 2007
@@ -124,10 +124,21 @@
return ref
def get_childref(self, index):
+ if isinstance(index, str):
+ pos = 0
+ found = False
+ for name in self.structtype._names_without_voids():
+ if name == index:
+ found = True
+ break
+ pos += 1
+ else:
+ pos = index
+
return "getelementptr(%s* %s, i32 0, i32 %s)" % (
self.get_typerepr(),
self.get_ref(),
- index)
+ pos)
def setup(self):
if isinstance(self.value, lltype._subarray):
More information about the Pypy-commit
mailing list