1.1 --- a/annotate.py Sat Oct 07 19:46:21 2006 +0200
1.2 +++ b/annotate.py Sun Oct 08 18:46:00 2006 +0200
1.3 @@ -330,6 +330,7 @@
1.4 if hasattr(return_, "expr"):
1.5 return_.expr = self.dispatch(return_.expr)
1.6 self.namespace.returns += self.namespace.types
1.7 + self.annotate(return_)
1.8 self.namespace.snapshot()
1.9 return return_
1.10
1.11 @@ -344,7 +345,7 @@
1.12 # the target may be a class or object, and there may be many different
1.13 # related subprograms.
1.14
1.15 - invocations = {}
1.16 + invocations = []
1.17
1.18 # Visit each callable in turn, finding subprograms.
1.19
1.20 @@ -398,10 +399,11 @@
1.21 # If a subprogram is defined, invoke it.
1.22
1.23 self.invoke_subprogram(invoke, attribute)
1.24 - invocations[callable] = attribute.type
1.25 + if attribute.type not in invocations:
1.26 + invocations.append(attribute.type)
1.27
1.28 else:
1.29 - print "Invocation type is None"
1.30 + print "Invocation type is None for", accessor
1.31
1.32 if isinstance(attr.type, Class):
1.33
1.34 @@ -615,6 +617,14 @@
1.35 def load(self, name):
1.36 return self.names[name]
1.37
1.38 + def merge_namespace(self, namespace):
1.39 + self.merge_items(namespace.names.items())
1.40 + self.returns += namespace.returns
1.41 +
1.42 + def merge_items(self, items):
1.43 + for name, types in items:
1.44 + self.merge(name, types)
1.45 +
1.46 def merge(self, name, types):
1.47 if not self.names.has_key(name):
1.48 self.names[name] = types[:]
1.49 @@ -624,13 +634,6 @@
1.50 if type not in existing:
1.51 existing.append(type)
1.52
1.53 - def merge_namespace(self, namespace):
1.54 - self.merge_items(namespace.names.items())
1.55 -
1.56 - def merge_items(self, items):
1.57 - for name, types in items:
1.58 - self.merge(name, types)
1.59 -
1.60 def snapshot(self):
1.61
1.62 "Make a snapshot of the locals and remember them."