diff options
author | Damien George <damien.p.george@gmail.com> | 2014-10-05 20:13:34 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-10-05 20:13:34 +0100 |
commit | c4d0868df1117ad243ee8f7238985a822b0f775d (patch) | |
tree | 4d75f4c60a2da4cbd85d3d130b773e21fce7be7b /py/compile.h | |
parent | a91ac2011f0131ce550bf227d78ccccbdab4f882 (diff) | |
download | micropython-c4d0868df1117ad243ee8f7238985a822b0f775d.tar.gz micropython-c4d0868df1117ad243ee8f7238985a822b0f775d.zip |
py: Implement proper context save/restore for eval/exec; factor code.
This has benefits all round: code factoring for parse/compile/execute,
proper context save/restore for exec, allow to sepcify globals/locals
for eval, and reduced ROM usage by >100 bytes on stmhal and unix.
Also, the call to mp_parse_compile_execute is tail call optimised for
the import code, so it doesn't increase stack memory usage.
Diffstat (limited to 'py/compile.h')
-rw-r--r-- | py/compile.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/py/compile.h b/py/compile.h index 983a443e95..cef20efce2 100644 --- a/py/compile.h +++ b/py/compile.h @@ -35,3 +35,6 @@ enum { // the compiler will free the parse tree (pn) before it returns mp_obj_t mp_compile(mp_parse_node_t pn, qstr source_file, uint emit_opt, bool is_repl); + +// this is implemented in runtime.c +mp_obj_t mp_parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t parse_input_kind, mp_obj_dict_t *globals, mp_obj_dict_t *locals); |