py/emitcommon: Don't implicitly close class vars that are assigned to.

When in a class body or at the module level don't implicitly close over
variables that have been assigned to.

Fixes issue #8603.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2022-05-03 10:38:15 +10:00
parent a21fd7cc21
commit 590de399f0
3 changed files with 87 additions and 4 deletions

View File

@@ -32,6 +32,7 @@
typedef enum {
ID_INFO_KIND_UNDECIDED,
ID_INFO_KIND_GLOBAL_IMPLICIT,
ID_INFO_KIND_GLOBAL_IMPLICIT_ASSIGNED,
ID_INFO_KIND_GLOBAL_EXPLICIT,
ID_INFO_KIND_LOCAL, // in a function f, written and only referenced by f
ID_INFO_KIND_CELL, // in a function f, read/written by children of f