diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-27 23:26:35 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-27 23:26:35 +0000 |
commit | 2326d52d2056aace9c5eddd170fe6ad4186e39e8 (patch) | |
tree | 0040b59c798301a1fdb30901b5e0d4adae143adb /py/compile.c | |
parent | 8767d0710ee3f0b78fdfa7b73750d5b66048b8b0 (diff) | |
download | micropython-2326d52d2056aace9c5eddd170fe6ad4186e39e8.tar.gz micropython-2326d52d2056aace9c5eddd170fe6ad4186e39e8.zip |
py: Factor out code from runtime.c to emitglue.c.
Diffstat (limited to 'py/compile.c')
-rw-r--r-- | py/compile.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/py/compile.c b/py/compile.c index 4d07f2e74b..b3a83715e0 100644 --- a/py/compile.c +++ b/py/compile.c @@ -13,6 +13,7 @@ #include "scope.h" #include "runtime0.h" #include "emit.h" +#include "emitglue.h" #include "obj.h" #include "compile.h" #include "runtime.h" @@ -213,7 +214,7 @@ STATIC void compile_decrease_except_level(compiler_t *comp) { } STATIC scope_t *scope_new_and_link(compiler_t *comp, scope_kind_t kind, mp_parse_node_t pn, uint emit_options) { - scope_t *scope = scope_new(kind, pn, comp->source_file, rt_get_unique_code_id(), emit_options); + scope_t *scope = scope_new(kind, pn, comp->source_file, mp_emit_glue_get_unique_code_id(), emit_options); scope->parent = comp->scope_cur; scope->next = NULL; if (comp->scope_head == NULL) { @@ -1149,14 +1150,14 @@ void compile_del_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) { void compile_break_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) { if (comp->break_label == 0) { - printf("ERROR: cannot break from here\n"); + compile_syntax_error(comp, "'break' outside loop"); } EMIT_ARG(break_loop, comp->break_label, comp->cur_except_level - comp->break_continue_except_level); } void compile_continue_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) { if (comp->continue_label == 0) { - printf("ERROR: cannot continue from here\n"); + compile_syntax_error(comp, "'continue' outside loop"); } EMIT_ARG(continue_loop, comp->continue_label, comp->cur_except_level - comp->break_continue_except_level); } |