# HG changeset patch # User Paul Boddie # Date 1220805820 -7200 # Node ID 1c6a86066472461f42c8ac6304cb123261d8851e # Parent 2548cd0c4008938221fa410d3a105fa2be86fd58 Changed the frame usage calculations. diff -r 2548cd0c4008 -r 1c6a86066472 micropython/ast.py --- a/micropython/ast.py Sun Sep 07 02:17:05 2008 +0200 +++ b/micropython/ast.py Sun Sep 07 18:43:40 2008 +0200 @@ -639,7 +639,8 @@ self.temp_positions.remove(temp_position) def set_frame_usage(self, node, extend): - extend.attr = self.max_temp_position + node.unit.local_usage # NOTE: See get_code for similar code. + ntemp = self.max_temp_position + 1 + extend.attr = ntemp + node.unit.local_usage # NOTE: See get_code for similar code. # Code writing methods. diff -r 2548cd0c4008 -r 1c6a86066472 micropython/data.py --- a/micropython/data.py Sun Sep 07 02:17:05 2008 +0200 +++ b/micropython/data.py Sun Sep 07 18:43:40 2008 +0200 @@ -832,16 +832,21 @@ self[name].position = i if i is not None: - j = i + 1 + nparams = i + 1 else: - j = 0 + nparams = 0 + + i = None + for i, attr in enumerate(self.locals().values()): + attr.position = i + nparams - i = 0 - for i, attr in enumerate(self.locals().values()): - attr.position = i + j + if i is not None: + nothers = i + 1 + else: + nothers = 0 - self.local_usage = i + 1 - self.all_local_usage = i + j + 1 + self.local_usage = nothers + self.all_local_usage = nparams + nothers self.finalised = 1 def function_from_method(self):