Lichen

Annotated tests/nested.py

843:d305986d05c8
2018-07-05 Paul Boddie Employed sets for attributes and providers referenced by accesses. This causes various attributes to be identified definitively in the access plans and instruction sequences.
paul@2 1
a = 4
paul@2 2
paul@2 3
def f(x):
paul@43 4
    def g(y, x=x):
paul@43 5
        def h(z, x=x, y=y):
paul@2 6
            return x, y, z, a
paul@2 7
        return h
paul@2 8
    return g
paul@2 9
paul@266 10
fn = f(1)
paul@266 11
print fn                        # __main__.f.$l0
paul@266 12
print fn(2)                     # __main__.f.$l0.$l0
paul@266 13
print fn(2)(3)                  # (1, 2, 3, 4)
paul@266 14
print fn(2)(3, 5)               # (5, 2, 3, 4)
paul@266 15
print fn(2)(3, 5, 6)            # (5, 6, 3, 4)