1.1 --- a/micropython/__init__.py Sun Jun 07 21:17:59 2009 +0200
1.2 +++ b/micropython/__init__.py Sun Jun 07 22:55:59 2009 +0200
1.3 @@ -211,7 +211,6 @@
1.4 # Position the objects.
1.5
1.6 pos = 0
1.7 - current_function = None
1.8
1.9 for item in self.code:
1.10
1.11 @@ -221,14 +220,6 @@
1.12 item.location = pos
1.13 pos += len(item.code)
1.14
1.15 - # Set code body information on functions, assuming that the
1.16 - # first block is for argument checks.
1.17 -
1.18 - if current_function is not None:
1.19 - current_function.code_body_location = pos
1.20 -
1.21 - current_function = None
1.22 -
1.23 # Other multi-location objects.
1.24
1.25 elif isinstance(item, (
1.26 @@ -269,14 +260,8 @@
1.27 else:
1.28 item.code_location = pos
1.29
1.30 - current_function = item
1.31 -
1.32 elif isinstance(item, micropython.data.Const):
1.33 pos += len(item.raw_data())
1.34 - current_function = None
1.35 -
1.36 - else:
1.37 - current_function = None
1.38
1.39 else:
1.40 pos += 1
1.41 @@ -323,6 +308,15 @@
1.42 else:
1.43 self.raw_code.append(item)
1.44
1.45 + # Set the code body location for items now that the code blocks have
1.46 + # been positioned.
1.47 +
1.48 + if isinstance(item, (micropython.data.Class, micropython.data.Function)):
1.49 + if not with_builtins and item.module.name == "__builtins__" and item.astnode.doc is None:
1.50 + item.code_body_location = item.full_name()
1.51 + else:
1.52 + item.code_body_location = item.get_body_block().location
1.53 +
1.54 # Fix the module locations.
1.55
1.56 for module in self.importer.modules_ordered: