1.1 --- a/annotate.py Thu Jan 25 01:03:33 2007 +0100
1.2 +++ b/annotate.py Fri Jan 26 00:05:20 2007 +0100
1.3 @@ -451,7 +451,7 @@
1.4
1.5 # Instantiate the class.
1.6
1.7 - instance = self.new_instance(invoke, "new", attr.type.full_name(), attr.type)
1.8 + instance = self.new_instance(invoke, attr.type)
1.9
1.10 # For instantiations, switch the context.
1.11
1.12 @@ -869,22 +869,9 @@
1.13 # Utility methods.
1.14
1.15 def get_builtin_instances(self, node, name):
1.16 - return [Attribute(None, self._new_instance(node, attr.type)) for attr in self.builtins.namespace[name]]
1.17 -
1.18 - def new_instance(self, node, reason, target, type):
1.19 -
1.20 - "Create, on the given 'node', a new instance with the given 'type'."
1.21 + return [Attribute(None, self.new_instance(node, attr.type)) for attr in self.builtins.namespace[name]]
1.22
1.23 - if not hasattr(node, "instances"):
1.24 - node.instances = {}
1.25 -
1.26 - if not node.instances.has_key((reason, target, type)):
1.27 - instance = self._new_instance(node, type)
1.28 - node.instances[(reason, target, type)] = instance
1.29 -
1.30 - return node.instances[(reason, target, type)]
1.31 -
1.32 - def _new_instance(self, node, type):
1.33 + def new_instance(self, node, type):
1.34
1.35 "For the given 'node', obtain an instance from the given 'type'."
1.36
1.37 @@ -1153,6 +1140,7 @@
1.38 code=[
1.39 StoreTemp(
1.40 expr=InvokeFunction(
1.41 + invocation.original,
1.42 expr=LoadAttr(
1.43 expr=LoadRef(
1.44 ref=self.builtins
1.45 @@ -1170,6 +1158,7 @@
1.46 for arg in star_args:
1.47 code.append(
1.48 InvokeFunction(
1.49 + invocation.original,
1.50 expr=LoadAttr(
1.51 expr=LoadTemp(),
1.52 name="append"
1.53 @@ -1185,6 +1174,7 @@
1.54 ]
1.55
1.56 invocation.stars[subprogram.full_name()] = InvokeBlock(
1.57 + invocation.original,
1.58 produces_result=1,
1.59 expr=LoadRef(
1.60 ref=Subprogram(
1.61 @@ -1214,6 +1204,7 @@
1.62 code=[
1.63 StoreTemp(
1.64 expr=InvokeFunction(
1.65 + invocation.original,
1.66 expr=LoadAttr(
1.67 expr=LoadRef(
1.68 ref=self.builtins
1.69 @@ -1252,6 +1243,7 @@
1.70 )
1.71 ),
1.72 InvokeFunction(
1.73 + invocation.original,
1.74 expr=LoadAttr(
1.75 expr=LoadTemp(),
1.76 name="__setitem__"
1.77 @@ -1271,6 +1263,7 @@
1.78 ]
1.79
1.80 invocation.dstars[subprogram.full_name()] = InvokeBlock(
1.81 + invocation.original,
1.82 produces_result=1,
1.83 expr=LoadRef(
1.84 ref=Subprogram(