2008-07-19 | Paul Boddie | raw annotate files changeset graph | 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. |
1 #!/usr/bin/env python 2 3 import imported 4 5 imported.attr = 456 # detected with warning 6 7 m = imported 8 imported.a = 9 # detected with warning 9 m.a = 8 # detected with warning (m is always imported) 10 11 imported.x = 1 # detected with warning (despite no collision) 12 13 class C: # hack: make an attribute called y known to the system 14 y = None # hack: this prevents compilation errors with the statements 15 # hack: below 16 17 n = None 18 n = imported 19 n.y = 2 # not detected due to reassignment of n 20 n.y = 3 # not detected due to reassignment of n 21 22 # vim: tabstop=4 expandtab shiftwidth=4