Commits

Stephen Tu committed 752620f

fix the way subscript args are handled

  • Participants
  • Parent commits d44d132

Comments (0)

Files changed (1)

File pypy/interpreter/astcompiler/codegen.py

         return None
 
     def _break_if_file_matches(self, filename):
-        pass
+        self._break_if_cond_fails(self.symbols.compile_info.filename.find(filename) == -1)
 
-        #if self.symbols.compile_info.filename.find(filename) != -1:
-        #    import pdb
-        #    pdb.set_trace()
+    def _break_if_cond_match(self, cond):
+        self._break_if_cond_fails(not cond)
 
     def _break_if_cond_fails(self, cond):
         pass
 
-        #if not cond:
-        #    import pdb
-        #    pdb.set_trace()
-
-    def _break_if_cond_match(self, cond):
-        self._break_if_cond_fails(not cond)
+        if not cond:
+            import pdb
+            pdb.set_trace()
 
     ### Visitors ###
 
         ast.GenericASTVisitor.visit_Attribute(self, node)
 
     def visit_Subscript(self, node):
+        #self._break_if_file_matches('fooidx.py')
         self._record_binary_feature(node.value, 'used_as_subscriptable')
-        self._record_binary_feature(node.slice, 'used_as_subscript_idx')
+        # node.slice is handled in visit_{Slice,Index}()
         ast.GenericASTVisitor.visit_Subscript(self, node)
 
     def visit_Name(self, node):
             self._record_binary_feature(node.step, 'used_as_slice_idx')
         ast.GenericASTVisitor.visit_Slice(self, node)
 
+    def visit_Index(self, node):
+        self._record_binary_feature(node.value, 'used_as_subscript_idx')
+        ast.GenericASTVisitor.visit_Index(self, node)
+
     def visit_comprehension(self, node):
         self._visit_for_like(node.target, node.iter)
         # XXX: node.ifs