2009-06-01 | Paul Boddie | raw annotate files changeset graph | Moved context verification back into the invocation code, as opposed to residing in the function body code. This is required because keyword arguments need to operate on adjusted frames, and such adjustments must therefore occur because keyword arguments are stored in their invocation frames. Renamed CheckClassContext to the more general CheckClass instruction. Made AdjustFrame operate on invocation frames again. Introduced explicit tests for class invocation since instantiators require an extra slot for each new instance. Fixed the "if" statement to employ conversion of expression results to boolean values. Split and improved test programs. |
1 #!/usr/bin/env python 2 3 class B: 4 def __init__(self, y): 5 self.y = y 6 def m(self, x): 7 return x 8 9 class A: 10 m1 = B.m 11 def __init__(self, b): 12 self.m2 = B.m 13 self.m3 = b.m 14 15 b = B(789) 16 a = A(b) 17 result_123 = A.m1(b, 123) # A.m1 is unbound 18 result_234 = a.m1(b, 234) # a.m1 is unbound 19 result_345 = a.m2(b, 345) # a.m2 is unbound 20 result_456 = a.m3(456) # a.m3 is bound to b 21 22 # vim: tabstop=4 expandtab shiftwidth=4