1.1 --- a/micropython/data.py Sun Oct 27 01:51:49 2013 +0200
1.2 +++ b/micropython/data.py Sun Oct 27 01:54:07 2013 +0200
1.3 @@ -174,6 +174,24 @@
1.4
1.5 return attr
1.6
1.7 + def get_for_local(self, name):
1.8 +
1.9 + """
1.10 + Get an attribute for a local name annotation, maintaining specific
1.11 + assignment information.
1.12 + """
1.13 +
1.14 + attr, scope, full_name = self._get_with_scope(name)
1.15 +
1.16 + if scope != "local":
1.17 + return None
1.18 +
1.19 + users = self.attribute_users[-1]
1.20 + if users.has_key(name):
1.21 + return LocalAttr(None, self, name, nodes=users[name])
1.22 + else:
1.23 + return attr
1.24 +
1.25 def _get_with_scope(self, name, external=0):
1.26
1.27 """
1.28 @@ -188,7 +206,6 @@
1.29 module = self.module
1.30 builtins = module and module.builtins or None
1.31 importer = module and module.importer or None
1.32 - users = self.attribute_users[-1]
1.33
1.34 # Constants.
1.35
1.36 @@ -197,9 +214,6 @@
1.37
1.38 # Locals.
1.39
1.40 - elif not external and users.has_key(name):
1.41 - return LocalAttr(None, self, name, nodes=users[name]), "local", self.full_name()
1.42 -
1.43 elif not external and self.has_key(name):
1.44 return self[name], "local", self.full_name()
1.45