1.1 --- a/optimiser.py Sun Oct 23 14:56:33 2016 +0200
1.2 +++ b/optimiser.py Mon Oct 24 21:16:57 2016 +0200
1.3 @@ -567,20 +567,33 @@
1.4 param_locations = self.param_locations = {}
1.5
1.6 for i, argnames in enumerate(self.arg_locations):
1.7 +
1.8 + # Position the arguments after the first context argument.
1.9 +
1.10 for argname in argnames:
1.11 - param_locations[argname] = i
1.12 + param_locations[argname] = i + 1
1.13
1.14 for name, argnames in self.importer.function_parameters.items():
1.15 - l = self.parameters[name] = [None] * len(argnames)
1.16 +
1.17 + # Allocate an extra context parameter in the table.
1.18 +
1.19 + l = self.parameters[name] = [None] + [None] * len(argnames)
1.20
1.21 # Store an entry for the name along with the name's position in the
1.22 # parameter list.
1.23
1.24 for pos, argname in enumerate(argnames):
1.25 +
1.26 + # Position the argument in the table.
1.27 +
1.28 position = param_locations[argname]
1.29 if position >= len(l):
1.30 l.extend([None] * (position - len(l) + 1))
1.31 - l[position] = (argname, pos)
1.32 +
1.33 + # Indicate an argument list position starting from 1 (after the
1.34 + # initial context argument).
1.35 +
1.36 + l[position] = (argname, pos + 1)
1.37
1.38 def populate_tables(self):
1.39