2012-06-22 | Paul Boddie | file changeset files shortlog | Made sure that local name usage is tracked for classes as well as modules. Without such tracking, usage of class attributes at class definition time is not recorded, and anything beyond simple aliasing of attributes causes usage of those attributes to go undetected and for those attributes to be vacuumed. |
paul@551 | 1 | #!/usr/bin/env python |
paul@551 | 2 | |
paul@551 | 3 | def p(x): |
paul@551 | 4 | return x |
paul@551 | 5 | |
paul@551 | 6 | class C: |
paul@551 | 7 | def f(self): |
paul@551 | 8 | return 1 |
paul@551 | 9 | m = p(f) |
paul@551 | 10 | |
paul@551 | 11 | def g(self): |
paul@551 | 12 | return 2 |
paul@551 | 13 | n = p(g) |
paul@551 | 14 | |
paul@551 | 15 | c = C() |
paul@551 | 16 | result_1 = c.m() |
paul@551 | 17 | |
paul@551 | 18 | # vim: tabstop=4 expandtab shiftwidth=4 |