2008-09-05 | Paul Boddie | file changeset files shortlog | Added the final Return instruction to generated images. Fixed the For node processing to store assigned values before visiting assignment nodes. Changed source processing to not use temporary storage optimisations, since the conditions for such optimisations are not met in general when processing assignments. Adopted a list to hold sources (assignment expression values), since list and tuple assignment act on a hierarchy of such values. Added elementary support and tests for list assignment. |
paul@96 | 1 | #!/usr/bin/env python |
paul@96 | 2 | |
paul@96 | 3 | import imported |
paul@96 | 4 | |
paul@108 | 5 | imported.attr # cannot assign to this |
paul@96 | 6 | |
paul@96 | 7 | m = imported |
paul@108 | 8 | imported.a # cannot assign to this |
paul@108 | 9 | m.a # cannot assign to this (m is known) |
paul@96 | 10 | |
paul@96 | 11 | class C: # hack: make an attribute called y known to the system |
paul@96 | 12 | y = None # hack: this prevents compilation errors with the statements |
paul@96 | 13 | # hack: below |
paul@96 | 14 | |
paul@96 | 15 | n = None |
paul@96 | 16 | n = imported |
paul@108 | 17 | n.a = 1 # not detected due to reassignment of n |
paul@96 | 18 | n.y = 2 # not detected due to reassignment of n |
paul@96 | 19 | n.y = 3 # not detected due to reassignment of n |
paul@96 | 20 | |
paul@96 | 21 | # vim: tabstop=4 expandtab shiftwidth=4 |