diff options
| author | Damien George <damien.p.george@gmail.com> | 2018-10-26 16:48:07 +1100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2018-10-28 00:33:08 +1100 |
| commit | 9201f46cc8e92231f0f6c92e4d56befbc150f72c (patch) | |
| tree | 425eeb6f9031a94acf2b79cb56a0a35a902da173 /py/scope.h | |
| parent | c2074e7b66a042492604fbf9ea80b71cdf848e93 (diff) | |
py/compile: Fix case of eager implicit conversion of local to nonlocal.
This ensures that implicit variables are only converted to implicit
closed-over variables (nonlocals) at the very end of the function scope.
If variables are closed-over when first used (read from, as was done prior
to this commit) then this can be incorrect because the variable may be
assigned to later on in the function which means they are just a plain
local, not closed over.
Fixes issue #4272.
Diffstat (limited to 'py/scope.h')
| -rw-r--r-- | py/scope.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/scope.h b/py/scope.h index 5e9a0eb7b..d51bb90bb 100644 --- a/py/scope.h +++ b/py/scope.h @@ -93,6 +93,6 @@ void scope_free(scope_t *scope); id_info_t *scope_find_or_add_id(scope_t *scope, qstr qstr, bool *added); id_info_t *scope_find(scope_t *scope, qstr qstr); id_info_t *scope_find_global(scope_t *scope, qstr qstr); -void scope_find_local_and_close_over(scope_t *scope, id_info_t *id, qstr qst); +void scope_check_to_close_over(scope_t *scope, id_info_t *id); #endif // MICROPY_INCLUDED_PY_SCOPE_H |
