diff options
author | Damien George <damien.p.george@gmail.com> | 2017-03-14 11:43:28 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-03-14 11:52:05 +1100 |
commit | 97142000f78fab8d1646efc17d60ac0e20919bd5 (patch) | |
tree | 9676c0cbf7d58aa7c94926615d9935a42d0f810a | |
parent | 68e1c4f0684de5dd5cefaf8d775657b42ce09dbe (diff) | |
download | micropython-97142000f78fab8d1646efc17d60ac0e20919bd5.tar.gz micropython-97142000f78fab8d1646efc17d60ac0e20919bd5.zip |
mpy-cross/main: Move lexer constructor to within NLR handler block.
-rw-r--r-- | mpy-cross/main.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/mpy-cross/main.c b/mpy-cross/main.c index 378c013c8d..4c88c72224 100644 --- a/mpy-cross/main.c +++ b/mpy-cross/main.c @@ -57,14 +57,10 @@ STATIC void stderr_print_strn(void *env, const char *str, mp_uint_t len) { STATIC const mp_print_t mp_stderr_print = {NULL, stderr_print_strn}; STATIC int compile_and_save(const char *file, const char *output_file, const char *source_file) { - mp_lexer_t *lex = mp_lexer_new_from_file(file); - if (lex == NULL) { - printf("could not open file '%s' for reading\n", file); - return 1; - } - nlr_buf_t nlr; if (nlr_push(&nlr) == 0) { + mp_lexer_t *lex = mp_lexer_new_from_file(file); + qstr source_name; if (source_file == NULL) { source_name = lex->source_name; |