1.1 --- a/annotate.py Sun Dec 03 23:47:41 2006 +0100
1.2 +++ b/annotate.py Wed Dec 06 00:48:29 2006 +0100
1.3 @@ -122,7 +122,7 @@
1.4 Raise, ReleaseTemp, ReturnFromBlock, ReturnFromFunction, StoreAttr,
1.5 StoreName, StoreTemp, Subprogram, Try.
1.6
1.7 - Missing: Keyword, Global, Import.
1.8 + Missing: Global, Import.
1.9 """
1.10
1.11 def __init__(self):
1.12 @@ -698,6 +698,7 @@
1.13 writes = {}
1.14 non_writes = []
1.15 for attr in self.namespace.types:
1.16 + # NOTE: Impose "atomic" constraints on certain types.
1.17 if attr is None:
1.18 if not attr in non_writes:
1.19 non_writes.append(attr)
1.20 @@ -851,6 +852,16 @@
1.21 context = None
1.22 target = attribute.type
1.23
1.24 + # Test to see if anything has changed.
1.25 +
1.26 + if hasattr(invoke, "syscount") and invoke.syscount == self.system.count:
1.27 + return
1.28 +
1.29 + # Remember the state of the system.
1.30 +
1.31 + else:
1.32 + invoke.syscount = self.system.count
1.33 +
1.34 # Provide the correct namespace for the invocation.
1.35
1.36 if getattr(invoke, "share_locals", 0):
1.37 @@ -866,16 +877,6 @@
1.38 namespace.merge_items(items)
1.39 using_module_namespace = 0
1.40
1.41 - # Test to see if anything has changed.
1.42 -
1.43 - if hasattr(invoke, "syscount") and invoke.syscount == self.system.count:
1.44 - return
1.45 -
1.46 - # Remember the state of the system.
1.47 -
1.48 - else:
1.49 - invoke.syscount = self.system.count
1.50 -
1.51 # Process the subprogram.
1.52 # In order to keep global accesses working, the module namespace must be
1.53 # adjusted.
1.54 @@ -965,7 +966,11 @@
1.55 pos_args = [Self(context)] + invocation.pos_args
1.56 else:
1.57 pos_args = invocation.pos_args
1.58 - kw_args = invocation.kw_args
1.59 +
1.60 + # Duplicate the keyword arguments - we remove them in processing below.
1.61 +
1.62 + kw_args = {}
1.63 + kw_args.update(invocation.kw_args)
1.64
1.65 # Sort the arguments into positional and keyword arguments.
1.66
1.67 @@ -1038,9 +1043,9 @@
1.68 raise AnnotationMessage, "Invocation provides unwanted *args."
1.69 elif subprogram.star is not None:
1.70 param, default = subprogram.star
1.71 - if not hasattr(arg, "types"):
1.72 - arg = self.dispatch(default) # NOTE: Review reprocessing.
1.73 - items.append((param, arg.types))
1.74 + if not hasattr(default, "types"):
1.75 + subprogram.star = param, self.dispatch(default) # NOTE: Review reprocessing.
1.76 + items.append((param, default.types))
1.77
1.78 if dstar_types is not None:
1.79 if subprogram.dstar is not None:
1.80 @@ -1050,9 +1055,9 @@
1.81 raise AnnotationMessage, "Invocation provides unwanted **args."
1.82 elif subprogram.dstar is not None:
1.83 param, default = subprogram.dstar
1.84 - if not hasattr(arg, "types"):
1.85 - arg = self.dispatch(default) # NOTE: Review reprocessing.
1.86 - items.append((param, arg.types))
1.87 + if not hasattr(default, "types"):
1.88 + subprogram.dstar = param, self.dispatch(default) # NOTE: Review reprocessing.
1.89 + items.append((param, default.types))
1.90
1.91 # Record the parameter types.
1.92