2009-04-23 | Paul Boddie | file changeset files shortlog | Added missing built-in methods. Added inspection of "if" test expressions. Removed StoreName from the constant storage optimisation (until population of locals/frames is implemented). Added debugging attributes to RSVPMachine for the object and parameter lists. Fixed the StoreName instruction to use the source, not the value. Added common names in use. |
paul@87 | 1 | #!/usr/bin/env python |
paul@87 | 2 | |
paul@87 | 3 | class B: |
paul@87 | 4 | def f(self): |
paul@87 | 5 | pass |
paul@87 | 6 | |
paul@187 | 7 | def f(self): |
paul@187 | 8 | pass |
paul@87 | 9 | |
paul@87 | 10 | b = B() |
paul@87 | 11 | |
paul@87 | 12 | # on A on a |
paul@87 | 13 | class A: |
paul@87 | 14 | f1 = f # unbound (A) bound (a) |
paul@87 | 15 | f2 = B.f # unbound (B) unbound (B) |
paul@87 | 16 | f3 = b.f # bound (b) bound (b) |
paul@87 | 17 | |
paul@87 | 18 | def __init__(self): |
paul@87 | 19 | self.f4 = f # N/A function |
paul@87 | 20 | self.f5 = B.f # N/A unbound (B) |
paul@87 | 21 | self.f6 = b.f # N/A bound (b) |
paul@87 | 22 | |
paul@87 | 23 | def m(self): |
paul@187 | 24 | x = self.f1 # should use optimised attribute access |
paul@187 | 25 | x = self.f2 |
paul@187 | 26 | x = self.f3 |
paul@187 | 27 | x = self.f4 |
paul@187 | 28 | x = self.f5 |
paul@187 | 29 | x = self.f6 |
paul@87 | 30 | |
paul@87 | 31 | a = A() |
paul@187 | 32 | a.m() |
paul@87 | 33 | |
paul@87 | 34 | A.f1 |
paul@87 | 35 | A.f2 |
paul@87 | 36 | A.f3 |
paul@87 | 37 | a.f1 |
paul@87 | 38 | a.f2 |
paul@87 | 39 | a.f3 |
paul@87 | 40 | a.f4 |
paul@87 | 41 | a.f5 |
paul@87 | 42 | a.f6 |
paul@87 | 43 | |
paul@87 | 44 | # vim: tabstop=4 expandtab shiftwidth=4 |