2009-05-24 | Paul Boddie | file changeset files shortlog | Added a StoreAddressContext instruction for class attribute initialisation. Fixed the mechanism behind LoadAttrIndexContextCond and LoadAddressContextCond since it failed to provide the appropriate instance context for instance accesses. Added a LoadFunction instruction in order to distinguish between constants which have no context information and those which do. |
paul@223 | 1 | #!/usr/bin/env python |
paul@223 | 2 | |
paul@223 | 3 | class C: |
paul@223 | 4 | clsattr = 123 |
paul@223 | 5 | clsattr2 = clsattr |
paul@223 | 6 | |
paul@223 | 7 | x = 0 # prevent optimisation of assignments |
paul@223 | 8 | x = C # prevent optimisation of assignments |
paul@223 | 9 | a = x.clsattr |
paul@223 | 10 | b = x.clsattr2 |
paul@223 | 11 | |
paul@223 | 12 | # vim: tabstop=4 expandtab shiftwidth=4 |