diff options
| author | Damien George <damien@micropython.org> | 2021-03-23 12:48:35 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-09-10 14:09:44 +1000 |
| commit | e6850838cdc1a0e0fe8e735a03e7df46d0dcdd0e (patch) | |
| tree | 75692c103ae9d3d70578d63eab64916635bf1d8a /py/objfun.h | |
| parent | 61b7c098b9a21311bbcec3b43c279ec9aada311b (diff) | |
py/parse: Simplify parse nodes representing a list.
This commit simplifies and optimises the parse tree in-memory
representation of lists of expressions, for tuples and lists, and when
tuples are used on the left-hand-side of assignments and within del
statements. This reduces memory usage of the parse tree when such code is
compiled, and also reduces the size of the compiler.
For example, (1,) was previously the following parse tree:
expr_stmt(5) (n=2)
atom_paren(45) (n=1)
testlist_comp(146) (n=2)
int(1)
testlist_comp_3b(149) (n=1)
NULL
NULL
and with this commit is now:
expr_stmt(5) (n=2)
atom_paren(45) (n=1)
testlist_comp(146) (n=1)
int(1)
NULL
Similarly, (1, 2, 3) was previously:
expr_stmt(5) (n=2)
atom_paren(45) (n=1)
testlist_comp(146) (n=2)
int(1)
testlist_comp_3c(150) (n=2)
int(2)
int(3)
NULL
and is now:
expr_stmt(5) (n=2)
atom_paren(45) (n=1)
testlist_comp(146) (n=3)
int(1)
int(2)
int(3)
NULL
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/objfun.h')
0 files changed, 0 insertions, 0 deletions
