1.1 --- a/micropython/ast.py Sun May 24 02:29:50 2009 +0200
1.2 +++ b/micropython/ast.py Sun May 24 18:12:07 2009 +0200
1.3 @@ -599,16 +599,16 @@
1.4 # Visiting of the code occurs when get_code is invoked on this node.
1.5
1.6 else:
1.7 - body_block = self.new_block()
1.8 - check_block = self.new_block()
1.9 -
1.10 # Check frames using the function's details.
1.11
1.12 fn = node.unit
1.13 nparams = len(fn.positional_names)
1.14 ndefaults = len(fn.defaults)
1.15
1.16 - self._generateFunctionContextTest(node, check_block, body_block)
1.17 + fn.body_block = self.new_block()
1.18 + check_block = self.new_block()
1.19 +
1.20 + self._generateFunctionContextTest(node, check_block, fn.body_block)
1.21
1.22 # Check the number of parameters and defaults.
1.23
1.24 @@ -620,7 +620,7 @@
1.25
1.26 # Produce the body.
1.27
1.28 - self.set_block(body_block)
1.29 + self.set_block(fn.body_block)
1.30
1.31 extend = ExtendFrame()
1.32 self.new_op(extend)
1.33 @@ -676,16 +676,16 @@
1.34 # Visiting of the code occurs when get_code is invoked on this node.
1.35
1.36 else:
1.37 - body_block = self.new_block()
1.38 - check_block = self.new_block()
1.39 -
1.40 # Check frames using the function's details.
1.41
1.42 fn = node.unit
1.43 nparams = len(fn.positional_names)
1.44 ndefaults = len(fn.defaults)
1.45
1.46 - self._generateFunctionContextTest(node, check_block, body_block)
1.47 + fn.body_block = self.new_block()
1.48 + check_block = self.new_block()
1.49 +
1.50 + self._generateFunctionContextTest(node, check_block, fn.body_block)
1.51
1.52 # Check the number of parameters and defaults.
1.53
1.54 @@ -697,7 +697,7 @@
1.55
1.56 # Produce the body.
1.57
1.58 - self.set_block(body_block)
1.59 + self.set_block(fn.body_block)
1.60
1.61 extend = ExtendFrame()
1.62 self.new_op(extend)
2.1 --- a/micropython/data.py Sun May 24 02:29:50 2009 +0200
2.2 +++ b/micropython/data.py Sun May 24 18:12:07 2009 +0200
2.3 @@ -927,11 +927,12 @@
2.4
2.5 self.location = None
2.6 self.code_location = None
2.7 - self.code_body_location = None
2.8
2.9 # Program-related details.
2.10
2.11 self.blocks = None
2.12 + self.body_block = None
2.13 +
2.14 self.temp_usage = 0
2.15 self.local_usage = 0
2.16 self.all_local_usage = 0
2.17 @@ -948,9 +949,8 @@
2.18
2.19 def __repr__(self):
2.20 if self.location is not None:
2.21 - return "Function(%r, %s, %r, location=%r, code_location=%r, code_body_location=%r)" % (
2.22 - self.name, shortrepr(self.parent), self.argnames, self.location, self.code_location,
2.23 - self.code_body_location
2.24 + return "Function(%r, %s, %r, location=%r, code_location=%r)" % (
2.25 + self.name, shortrepr(self.parent), self.argnames, self.location, self.code_location
2.26 )
2.27 else:
2.28 return "Function(%r, %s, %r)" % (
2.29 @@ -976,7 +976,7 @@
2.30 ]
2.31
2.32 def get_direct_invocation_location(self):
2.33 - return self.code_body_location
2.34 + return self.body_block.location
2.35
2.36 # Namespace-related methods.
2.37