1.1 --- a/annotate.py Tue Oct 03 00:50:03 2006 +0200
1.2 +++ b/annotate.py Wed Oct 04 01:05:41 2006 +0200
1.3 @@ -67,6 +67,18 @@
1.4
1.5 system = System()
1.6
1.7 +# Exceptions.
1.8 +
1.9 +class FailureError(Exception):
1.10 + def __init__(self, exc, node, *args):
1.11 + Exception.__init__(self, *args)
1.12 + self.nodes = [node]
1.13 + self.exc = exc
1.14 + def add(self, node):
1.15 + self.nodes.append(node)
1.16 + def __str__(self):
1.17 + return "%s, %s" % (self.exc, self.nodes)
1.18 +
1.19 # Annotation.
1.20
1.21 class Annotator(Visitor):
1.22 @@ -207,10 +219,11 @@
1.23 def dispatch(self, node, *args):
1.24 try:
1.25 return Visitor.dispatch(self, node, *args)
1.26 - except:
1.27 - print "Failed using node", node
1.28 - #print "Original AST node", getattr(node, "original", None)
1.29 + except FailureError, exc:
1.30 + exc.add(node)
1.31 raise
1.32 + except Exception, exc:
1.33 + raise FailureError(exc, node)
1.34
1.35 def visitLoadRef(self, loadref):
1.36 self.namespace.set_types([Attribute(None, loadref.ref)])
2.1 --- a/tests/assign.py Tue Oct 03 00:50:03 2006 +0200
2.2 +++ b/tests/assign.py Wed Oct 04 01:05:41 2006 +0200
2.3 @@ -1,5 +1,6 @@
2.4 class A: pass
2.5 a = A()
2.6 +a.x = 1, 2, 3
2.7 c = b = a.x
2.8 [x, y, z] = c
2.9 x, y, z = c
3.1 --- a/tests/augassign.py Tue Oct 03 00:50:03 2006 +0200
3.2 +++ b/tests/augassign.py Wed Oct 04 01:05:41 2006 +0200
3.3 @@ -1,3 +1,5 @@
3.4 +a = [1,2,3]
3.5 +b = [4,5]
3.6 a += b
3.7 a.b += c
3.8 a.b().c += d