code writer support for cascaded assignment nodes and string nodes
authorStefan Behnel <scoder@users.berlios.de>
Sat, 19 Jul 2008 08:48:58 +0000 (10:48 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 19 Jul 2008 08:48:58 +0000 (10:48 +0200)
Cython/CodeWriter.py

index 7d995b0804c9ad2dccf3860114ec59e8806a072b..dca1f6a79a4f76b2a337d9980b9fe67626dab912 100644 (file)
@@ -123,12 +123,26 @@ class CodeWriter(TreeVisitor):
         self.visit(node.rhs)
         self.endline()
     
+    def visit_CascadedAssignmentNode(self, node):
+        self.startline()
+        for lhs in node.lhs_list:
+            self.visit(lhs)
+            self.put(u" = ")
+        self.visit(node.rhs)
+        self.endline()
+    
     def visit_NameNode(self, node):
         self.putname(node.name)
     
     def visit_IntNode(self, node):
         self.put(node.value)
-        
+
+    def visit_StringNode(self, node):
+        value = node.value
+        if value.encoding is not None:
+            value = value.encode(value.encoding)
+        self.put(repr(value))
+
     def visit_IfStatNode(self, node):
         # The IfClauseNode is handled directly without a seperate match
         # for clariy.