Skip to content

Commit 3b2fd4d

Browse files
committed
lib/utils/pyexec: Allow to compile when the uPy compiler is disabled.
1 parent e2f1a8a commit 3b2fd4d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/utils/pyexec.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,15 @@ STATIC int parse_compile_execute(void *source, mp_parse_input_kind_t input_kind,
7575
} else
7676
#endif
7777
{
78+
#if MICROPY_ENABLE_COMPILER
7879
// source is a lexer, parse and compile the script
7980
mp_lexer_t *lex = source;
8081
qstr source_name = lex->source_name;
8182
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
8283
module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, exec_flags & EXEC_FLAG_IS_REPL);
84+
#else
85+
mp_raise_msg(&mp_type_RuntimeError, "script compilation not supported");
86+
#endif
8387
}
8488

8589
// execute code
@@ -137,6 +141,7 @@ STATIC int parse_compile_execute(void *source, mp_parse_input_kind_t input_kind,
137141
return ret;
138142
}
139143

144+
#if MICROPY_ENABLE_COMPILER
140145
#if MICROPY_REPL_EVENT_DRIVEN
141146

142147
typedef struct _repl_t {
@@ -497,6 +502,7 @@ int pyexec_friendly_repl(void) {
497502
}
498503

499504
#endif // MICROPY_REPL_EVENT_DRIVEN
505+
#endif // MICROPY_ENABLE_COMPILER
500506

501507
int pyexec_file(const char *filename) {
502508
mp_lexer_t *lex = mp_lexer_new_from_file(filename);

0 commit comments

Comments
 (0)