summaryrefslogtreecommitdiffstatshomepage
path: root/py/scope.h
diff options
context:
space:
mode:
Diffstat (limited to 'py/scope.h')
-rw-r--r--py/scope.h32
1 files changed, 13 insertions, 19 deletions
diff --git a/py/scope.h b/py/scope.h
index 7ecd1e19f9..daba296dc4 100644
--- a/py/scope.h
+++ b/py/scope.h
@@ -7,14 +7,12 @@ enum {
};
typedef struct _id_info_t {
- // TODO compress this info to make structure smaller in memory
- bool param;
- int kind;
- qstr qstr;
-
+ uint8_t param;
+ uint8_t kind;
// when it's an ID_INFO_KIND_LOCAL this is the unique number of the local
// whet it's an ID_INFO_KIND_CELL/FREE this is the unique number of the closed over variable
- int local_num;
+ uint16_t local_num;
+ qstr qstr;
} id_info_t;
// scope is a "block" in Python parlance
@@ -26,20 +24,16 @@ typedef struct _scope_t {
mp_parse_node_t pn;
qstr source_file;
qstr simple_name;
- int id_info_alloc;
- int id_info_len;
- id_info_t *id_info;
- uint scope_flags; // see runtime0.h
- int num_params;
- /* not needed
- int num_default_params;
- int num_dict_params;
- */
- int num_locals;
- int stack_size; // maximum size of the locals stack
- int exc_stack_size; // maximum size of the exception stack
uint unique_code_id;
- uint emit_options;
+ uint8_t scope_flags; // see runtime0.h
+ uint8_t emit_options; // see compile.h
+ uint16_t num_params;
+ uint16_t num_locals;
+ uint16_t stack_size; // maximum size of the locals stack
+ uint16_t exc_stack_size; // maximum size of the exception stack
+ uint16_t id_info_alloc;
+ uint16_t id_info_len;
+ id_info_t *id_info;
} scope_t;
scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, uint unique_code_id, uint emit_options);