summaryrefslogtreecommitdiff
path: root/py/compile.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-03-09 12:32:26 +1100
committerDamien George <damien.p.george@gmail.com>2019-03-14 12:22:25 +1100
commit5a6026c614e0b7dd26fcf277f01169c95c5d93a4 (patch)
tree60c11f64389f5880e72d302dab58c8285ce721d7 /py/compile.c
parent55fcb83a42fef108dfa2cd23bae55597d1569f68 (diff)
py/compile: Check that arch is set when compiling native, viper or asm.
Diffstat (limited to 'py/compile.c')
-rw-r--r--py/compile.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/py/compile.c b/py/compile.c
index 8ed7cad5f..4919a1659 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -852,6 +852,18 @@ STATIC bool compile_built_in_decorator(compiler_t *comp, int name_len, mp_parse_
compile_syntax_error(comp, name_nodes[1], "invalid micropython decorator");
}
+ #if MICROPY_DYNAMIC_COMPILER
+ if (*emit_options == MP_EMIT_OPT_NATIVE_PYTHON || *emit_options == MP_EMIT_OPT_VIPER) {
+ if (emit_native_table[mp_dynamic_compiler.native_arch] == NULL) {
+ compile_syntax_error(comp, name_nodes[1], "invalid arch");
+ }
+ } else if (*emit_options == MP_EMIT_OPT_ASM) {
+ if (emit_asm_table[mp_dynamic_compiler.native_arch] == NULL) {
+ compile_syntax_error(comp, name_nodes[1], "invalid arch");
+ }
+ }
+ #endif
+
return true;
}