summaryrefslogtreecommitdiff
path: root/py/compile.c
diff options
context:
space:
mode:
authorKalbeAbbas <kalbeabbas142@gmail.com>2019-12-16 13:25:44 +0500
committerGitHub <noreply@github.com>2019-12-16 13:25:44 +0500
commit89ed64157dfdff0f673f38f098f7c5380fac0347 (patch)
tree666df6d170c13f08e892b79b46bb52d88ce3c1a6 /py/compile.c
parent87dc9bee8b33c40aa2e342ee42ced71ed757b142 (diff)
parent8384e4676b5f7e4c06fd8f1db53382b6f3e6d175 (diff)
Merge branch 'master' into master
Diffstat (limited to 'py/compile.c')
-rw-r--r--py/compile.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/py/compile.c b/py/compile.c
index 8b17935bd..77715d3fe 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -775,13 +775,22 @@ STATIC bool compile_built_in_decorator(compiler_t *comp, int name_len, mp_parse_
qstr attr = MP_PARSE_NODE_LEAF_ARG(name_nodes[1]);
if (attr == MP_QSTR_bytecode) {
*emit_options = MP_EMIT_OPT_BYTECODE;
-#if MICROPY_EMIT_NATIVE
+ // @micropython.native decorator.
} else if (attr == MP_QSTR_native) {
+ // Different from MicroPython: native doesn't raise SyntaxError if native support isn't
+ // compiled, it just passes through the function unmodified.
+ #if MICROPY_EMIT_NATIVE
*emit_options = MP_EMIT_OPT_NATIVE_PYTHON;
+ #else
+ return true;
+ #endif
+ #if MICROPY_EMIT_NATIVE
+ // @micropython.viper decorator.
} else if (attr == MP_QSTR_viper) {
*emit_options = MP_EMIT_OPT_VIPER;
-#endif
+ #endif
#if MICROPY_EMIT_INLINE_ASM
+ // @micropython.asm_thumb decorator.
} else if (attr == ASM_DECORATOR_QSTR) {
*emit_options = MP_EMIT_OPT_ASM;
#endif