micropython

Annotated tests/attributes.py

104:3bf7d0e10c17
2008-07-19 Paul Boddie Made methods to handle assignment expression values. Changed constant storage optimisations to consider sources. Introduced distinctions between some storage operations which use the current value (StoreTemp, StoreFrame, StoreResult) and others which use a source defined in a full assignment operation. Made class attribute assignment via self forbidden (removing StoreAddressContext). Added an unused results optimisation. Fixed attribute_load_instructions references. Improved instruction string representations to show source details where no inputs are defined. Made a failure version of the attributes test.
paul@43 1
#!/usr/bin/env python
paul@43 2
paul@43 3
class C:
paul@43 4
    clsattr = 123
paul@43 5
paul@43 6
    def __init__(self, value):
paul@43 7
        self.instattr = value
paul@91 8
        self.clsattr
paul@91 9
paul@91 10
    def update(self, value):
paul@91 11
        self.attr = value
paul@104 12
        C.clsattr = value
paul@43 13
paul@86 14
C
paul@86 15
C.clsattr
paul@86 16
paul@43 17
# vim: tabstop=4 expandtab shiftwidth=4