summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGlenn Ruben Bakke <glennbakke@gmail.com>2017-03-07 17:46:34 +0100
committerGlenn Ruben Bakke <glennbakke@gmail.com>2017-03-07 17:46:34 +0100
commitfd8f2c36f539a386192d106ef5ca0ce6a3926aec (patch)
tree7b0bf8cb7a0677c1987b2d3e725f57cffc2e8633 /lib
parent5f705adae06d4925351fe716f956d0fc922e53cf (diff)
parentfd49ff991769a29b2dcc0f8ed88143487f2bd131 (diff)
Merge branch 'master' into nrf5_no_sdk
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/pyexec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c
index 5e2f24298..0d20c1917 100644
--- a/lib/utils/pyexec.c
+++ b/lib/utils/pyexec.c
@@ -75,11 +75,15 @@ STATIC int parse_compile_execute(void *source, mp_parse_input_kind_t input_kind,
} else
#endif
{
+ #if MICROPY_ENABLE_COMPILER
// source is a lexer, parse and compile the script
mp_lexer_t *lex = source;
qstr source_name = lex->source_name;
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, exec_flags & EXEC_FLAG_IS_REPL);
+ #else
+ mp_raise_msg(&mp_type_RuntimeError, "script compilation not supported");
+ #endif
}
// execute code
@@ -137,6 +141,7 @@ STATIC int parse_compile_execute(void *source, mp_parse_input_kind_t input_kind,
return ret;
}
+#if MICROPY_ENABLE_COMPILER
#if MICROPY_REPL_EVENT_DRIVEN
typedef struct _repl_t {
@@ -497,6 +502,7 @@ friendly_repl_reset:
}
#endif // MICROPY_REPL_EVENT_DRIVEN
+#endif // MICROPY_ENABLE_COMPILER
int pyexec_file(const char *filename) {
mp_lexer_t *lex = mp_lexer_new_from_file(filename);