micropython

Annotated tests/failure/shadow_locals_globals_reassign.py

342:c7c2119483cf
2010-06-13 Paul Boddie Fixed exception attribute initialisation for translation errors. Reintroduced the _scope attribute on AST nodes in order to support supposedly harmless changes in scope (such as the "importing" of a built-in or global into a local scope where the name is redefined subsequently). Reorganised the tests according to the above shadowing policy change. Introduced tentative slicing support plus built-in functions that rely on slicing.
paul@339 1
#!/usr/bin/env python
paul@339 2
paul@339 3
a = 1
paul@339 4
paul@339 5
def reassign():
paul@342 6
    i = 2
paul@342 7
    while i > 0:
paul@342 8
        a = a # right hand side name changes origin
paul@342 9
        i -= 1
paul@339 10
    return a
paul@339 11
paul@339 12
result2_1 = reassign()
paul@339 13
paul@339 14
# vim: tabstop=4 expandtab shiftwidth=4