Permalink
Browse files

Add variable resolving mixin class

  • Loading branch information...
1 parent 1ef2ebd commit adbb911246ac14e0b5b05744bf962b355750f2db @markflorisson committed Aug 5, 2012
Showing with 14 additions and 8 deletions.
  1. +13 −7 Cython/Compiler/Vector.py
  2. +1 −1 Cython/minivect
View
@@ -69,8 +69,18 @@ def map_type(self, type, wrap=False):
else:
raise minierror.UnmappableTypeError(type)
-class CythonSpecializerMixin(object):
+class VariableResolvingMixin(object):
+
is_partial_mapping = False
+
+ def visit_NodeWrapper(self, node):
+ self.is_partial_mapping = True
+ for op in node.operands:
+ op.variable = self.visit(op.variable)
+ return node
+
+class CythonSpecializerMixin(VariableResolvingMixin):
+
has_error_handler = False
def visit_FunctionNode(self, node):
@@ -102,12 +112,6 @@ def qualify(type):
node = super(CythonSpecializerMixin, self).visit_FunctionNode(node)
return node
- def visit_NodeWrapper(self, node):
- self.is_partial_mapping = True
- for op in node.operands:
- op.variable = self.visit(op.variable)
- return node
-
def visit_ErrorHandler(self, node):
self.has_error_handler = True
return super(CythonSpecializerMixin, self).visit_ErrorHandler(node)
@@ -253,6 +257,8 @@ class Context(miniast.CContext):
codegen_cls = CCodeGen
cleanup_codegen_cls = CCodeGenCleanup
specializer_mixin_cls = CythonSpecializerMixin
+ variable_resolving_mixin_cls = VariableResolvingMixin
+
graphviz_cls = CythonGraphvizGenerator
def getchildren(self, node):

0 comments on commit adbb911

Please sign in to comment.