Skip to content

Commit b140bff

Browse files
committed
py, compile: Simplify initialisation of compiler structure.
1 parent 02a4c05 commit b140bff

1 file changed

Lines changed: 1 addition & 13 deletions

File tree

py/compile.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3196,21 +3196,9 @@ void compile_scope_compute_things(compiler_t *comp, scope_t *scope) {
31963196
}
31973197

31983198
mp_obj_t mp_compile(mp_parse_node_t pn, qstr source_file, uint emit_opt, bool is_repl) {
3199-
compiler_t *comp = m_new(compiler_t, 1);
3200-
3199+
compiler_t *comp = m_new0(compiler_t, 1);
32013200
comp->source_file = source_file;
32023201
comp->is_repl = is_repl;
3203-
comp->had_error = false;
3204-
3205-
comp->break_label = 0;
3206-
comp->continue_label = 0;
3207-
comp->break_continue_except_level = 0;
3208-
comp->cur_except_level = 0;
3209-
3210-
comp->func_arg_is_super = false;
3211-
3212-
comp->scope_head = NULL;
3213-
comp->scope_cur = NULL;
32143202

32153203
// optimise constants
32163204
pn = fold_constants(pn);

0 commit comments

Comments
 (0)