File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929#include <readline/history.h>
3030#endif
3131
32- // Default emit options
32+ // Command line options, with their defaults
33+ bool compile_only = false;
3334uint emit_opt = MP_EMIT_OPT_NONE ;
3435
3536#if MICROPY_ENABLE_GC
@@ -87,6 +88,10 @@ STATIC void execute_from_lexer(mp_lexer_t *lex, mp_parse_input_kind_t input_kind
8788 return ;
8889 }
8990
91+ if (compile_only ) {
92+ return ;
93+ }
94+
9095 // execute it
9196 nlr_buf_t nlr ;
9297 if (nlr_push (& nlr ) == 0 ) {
@@ -226,6 +231,7 @@ int usage(char **argv) {
226231);
227232 int impl_opts_cnt = 0 ;
228233 printf (
234+ " compile-only -- parse and compile only\n"
229235" emit={bytecode,native,viper} -- set the default code emitter\n"
230236);
231237 impl_opts_cnt ++ ;
@@ -273,6 +279,8 @@ void pre_process_options(int argc, char **argv) {
273279 exit (usage (argv ));
274280 }
275281 if (0 ) {
282+ } else if (strcmp (argv [a + 1 ], "compile-only" ) == 0 ) {
283+ compile_only = true;
276284 } else if (strcmp (argv [a + 1 ], "emit=bytecode" ) == 0 ) {
277285 emit_opt = MP_EMIT_OPT_BYTE_CODE ;
278286 } else if (strcmp (argv [a + 1 ], "emit=native" ) == 0 ) {
You can’t perform that action at this time.
0 commit comments