diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-15 22:14:03 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-15 22:14:03 +0000 |
commit | d02c6d896292d585ba2a46c194cfe00da33a2a72 (patch) | |
tree | f8b20e6dee9ffa961120162710b413d265f77152 /py/compile.c | |
parent | e2fb2baaa48ef6da317a533b5d168b1ab0fcefe8 (diff) | |
download | micropython-d02c6d896292d585ba2a46c194cfe00da33a2a72.tar.gz micropython-d02c6d896292d585ba2a46c194cfe00da33a2a72.zip |
Implement eval.
Diffstat (limited to 'py/compile.c')
-rw-r--r-- | py/compile.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/py/compile.c b/py/compile.c index b948f7aa47..b24e94a8dc 100644 --- a/py/compile.c +++ b/py/compile.c @@ -2708,7 +2708,12 @@ void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) { #endif // compile - if (scope->kind == SCOPE_MODULE) { + if (MP_PARSE_NODE_IS_STRUCT_KIND(scope->pn, PN_eval_input)) { + assert(scope->kind == SCOPE_MODULE); + mp_parse_node_struct_t *pns = (mp_parse_node_struct_t*)scope->pn; + compile_node(comp, pns->nodes[0]); // compile the expression + EMIT(return_value); + } else if (scope->kind == SCOPE_MODULE) { if (!comp->is_repl) { check_for_doc_string(comp, scope->pn); } @@ -2833,7 +2838,6 @@ void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) { } EMIT(end_pass); - } void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind_t pass) { |