micropython

tests/abandoned_attribute_usage_multiple_candidates.py

438:b547786f38c7
2011-07-02 Paul Boddie Moved some code generation methods into a new Assembler class. Separated sequence element storage into a separate method which may form the basis of a native library routine.
     1 #!/usr/bin/env python     2      3 """     4 This test attempts to cause the recording of the usage of 'C' in the function     5 'f', alongside the expectation that 'D' might be used instead with the function     6 'g'. A guard cannot therefore be generated. Meanwhile, the method 'E.h' should     7 be eliminated.     8 """     9     10 class C:    11     def f(self):    12         return 1    13     14 class D:    15     def g(self):    16         return 2    17     18 class E:    19     def h(self):    # unused    20         return 3    21     22 def f(c):    23     if 1:    24         return c.f()    25     return c.g()    26     27 c = C()    28 d = D()    29 e = E()    30 result1_1 = f(c)    31     32 # vim: tabstop=4 expandtab shiftwidth=4