Skip to content

Commit 7f70b60

Browse files
committed
py: Remove unused compile scope flags, and irrelevant flag compute code.
1 parent 2a6660b commit 7f70b60

2 files changed

Lines changed: 3 additions & 25 deletions

File tree

py/compile.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3301,18 +3301,6 @@ STATIC void scope_compute_things(scope_t *scope) {
33013301
scope->num_locals += num_free;
33023302
}
33033303
}
3304-
3305-
// compute scope_flags
3306-
int num_free = 0;
3307-
for (int i = 0; i < scope->id_info_len; i++) {
3308-
id_info_t *id = &scope->id_info[i];
3309-
if (id->kind == ID_INFO_KIND_CELL || id->kind == ID_INFO_KIND_FREE) {
3310-
num_free += 1;
3311-
}
3312-
}
3313-
if (num_free == 0) {
3314-
scope->scope_flags |= MP_SCOPE_FLAG_NOFREE;
3315-
}
33163304
}
33173305

33183306
mp_obj_t mp_compile(mp_parse_node_t pn, qstr source_file, uint emit_opt, bool is_repl) {

py/runtime0.h

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,10 @@
2626
#ifndef __MICROPY_INCLUDED_PY_RUNTIME0_H__
2727
#define __MICROPY_INCLUDED_PY_RUNTIME0_H__
2828

29-
// taken from python source, Include/code.h
3029
// These must fit in 8 bits; see scope.h
31-
#define MP_SCOPE_FLAG_OPTIMISED 0x01
32-
#define MP_SCOPE_FLAG_NEWLOCALS 0x02
33-
#define MP_SCOPE_FLAG_VARARGS 0x04
34-
#define MP_SCOPE_FLAG_VARKEYWORDS 0x08
35-
#define MP_SCOPE_FLAG_NESTED 0x10
36-
#define MP_SCOPE_FLAG_GENERATOR 0x20
37-
/* The MP_SCOPE_FLAG_NOFREE flag is set if there are no free or cell variables.
38-
This information is redundant, but it allows a single flag test
39-
to determine whether there is any extra work to be done when the
40-
call frame is setup.
41-
*/
42-
#define MP_SCOPE_FLAG_NOFREE 0x40
30+
#define MP_SCOPE_FLAG_VARARGS (0x01)
31+
#define MP_SCOPE_FLAG_VARKEYWORDS (0x02)
32+
#define MP_SCOPE_FLAG_GENERATOR (0x04)
4333

4434
// types for native (viper) function signature
4535
#define MP_NATIVE_TYPE_OBJ (0x00)

0 commit comments

Comments
 (0)