indexing a C ptr/array is 'simple'
authorStefan Behnel <scoder@users.berlios.de>
Fri, 28 Jan 2011 17:47:29 +0000 (18:47 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 28 Jan 2011 17:47:29 +0000 (18:47 +0100)
Cython/Compiler/ExprNodes.py

index 254554b80c884f7fb82a8d2b0a4759c6365729d8..5c4c0579283adc8e3229f0aa5ab99981ce88e06e 100755 (executable)
@@ -2014,6 +2014,11 @@ class IndexNode(ExprNode):
     def is_ephemeral(self):
         return self.base.is_ephemeral()
 
+    def is_simple(self):
+        base = self.base
+        return (base.is_simple() and self.index.is_simple()
+                and base.type and (base.type.is_ptr or base.type.is_array))
+
     def analyse_target_declaration(self, env):
         pass