micropython

Changeset

521:1af8032d9f88
2012-06-04 Paul Boddie raw files shortlog changelog graph Allow usage of instance attributes as declarations, permitting external initialisation of such attributes.
micropython/inspect.py (file)
     1.1 --- a/micropython/inspect.py	Mon Jun 04 01:20:39 2012 +0200
     1.2 +++ b/micropython/inspect.py	Mon Jun 04 01:38:25 2012 +0200
     1.3 @@ -514,6 +514,12 @@
     1.4              # to be an instance.
     1.5  
     1.6              else:
     1.7 +
     1.8 +                # Record any instance attributes.
     1.9 +
    1.10 +                if expr.name == "self":
    1.11 +                    self.store_instance_attr(attrname)
    1.12 +
    1.13                  attr = make_instance()
    1.14  
    1.15                  # Note usage of the attribute where a local is involved.