1.1 --- a/annotate.py Sat Oct 21 18:20:00 2006 +0200
1.2 +++ b/annotate.py Sun Oct 22 00:14:23 2006 +0200
1.3 @@ -524,16 +524,8 @@
1.4
1.5 "Process the arguments associated with an 'invocation'."
1.6
1.7 - # NOTE: Consider initialiser invocation for classes.
1.8 -
1.9 - types = []
1.10 - args = []
1.11 -
1.12 - # Get type information for regular arguments.
1.13 -
1.14 - for arg in invocation.args:
1.15 - args.append(self.dispatch(arg))
1.16 - types.append(self.namespace.types)
1.17 + invocation.pos_args = self.dispatches(invocation.pos_args)
1.18 + invocation.kw_args = self.dispatch_dict(invocation.kw_args)
1.19
1.20 # Get type information for star and dstar arguments.
1.21
1.22 @@ -541,15 +533,11 @@
1.23 param, default = invocation.star
1.24 default = self.dispatch(default)
1.25 invocation.star = param, default
1.26 - types.append(default.types)
1.27
1.28 if invocation.dstar is not None:
1.29 param, default = invocation.dstar
1.30 default = self.dispatch(default)
1.31 invocation.dstar = param, default
1.32 - types.append(default.types)
1.33 -
1.34 - invocation.args = args
1.35
1.36 def make_items(self, invocation, subprogram, context):
1.37
1.38 @@ -559,27 +547,13 @@
1.39 """
1.40
1.41 if context is not None:
1.42 - args = [Self(context)] + invocation.args
1.43 + pos_args = [Self(context)] + invocation.pos_args
1.44 else:
1.45 - args = invocation.args
1.46 + pos_args = invocation.pos_args
1.47 + kw_args = invocation.kw_args
1.48
1.49 # Sort the arguments into positional and keyword arguments.
1.50
1.51 - pos_args = []
1.52 - kw_args = []
1.53 - add_kw = 0
1.54 - for arg in args:
1.55 - if not add_kw:
1.56 - if not isinstance(arg, Keyword):
1.57 - pos_args.append(arg)
1.58 - else:
1.59 - add_kw = 1
1.60 - if add_kw:
1.61 - if isinstance(arg, Keyword):
1.62 - kw_args.append(arg)
1.63 - else:
1.64 - raise AnnotationMessage, "Positional argument appears after keyword arguments in '%s'." % callfunc
1.65 -
1.66 params = subprogram.params
1.67 items = []
1.68 star_args = []
1.69 @@ -603,12 +577,14 @@
1.70 if kw_args.has_key(param):
1.71 arg = kw_args[param]
1.72 del kw_args[param]
1.73 - elif default is None:
1.74 + elif default is not None:
1.75 + arg = self.dispatch(default)
1.76 + else:
1.77 raise AnnotationMessage, "No argument supplied in '%s' for parameter '%s'." % (subprogram, param)
1.78 items.append((param, arg.types))
1.79 params = params[1:]
1.80
1.81 - dstar_args = kw_args
1.82 + dstar_args = kw_args.values()
1.83
1.84 # Construct temporary objects.
1.85