summaryrefslogtreecommitdiff
path: root/py/compile.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott@chickadee.tech>2016-09-19 13:32:29 -0700
committerScott Shawcroft <scott@chickadee.tech>2016-09-19 13:32:29 -0700
commitbb03afdb77c95b9cb23e531e5763167ccb09c8e4 (patch)
tree509722778a03b10c933963a35c93eb5670a5cdb5 /py/compile.c
parent345dd1484c4e68f53ea242c5778a2de99119db9a (diff)
parent60592fd23c8acd4ed4f70d8fbe8f8b11ea58082c (diff)
Merge remote-tracking branch 'micropython/master'
Diffstat (limited to 'py/compile.c')
-rw-r--r--py/compile.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/py/compile.c b/py/compile.c
index c8b4e5470..7207ac2e0 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -2869,17 +2869,11 @@ STATIC void compile_scope_comp_iter(compiler_t *comp, mp_parse_node_struct_t *pn
if (MP_PARSE_NODE_IS_NULL(pn_iter)) {
// no more nested if/for; compile inner expression
compile_node(comp, pn_inner_expr);
- if (comp->scope_cur->kind == SCOPE_LIST_COMP) {
- EMIT_ARG(list_append, for_depth + 2);
- } else if (comp->scope_cur->kind == SCOPE_DICT_COMP) {
- EMIT_ARG(map_add, for_depth + 2);
- #if MICROPY_PY_BUILTINS_SET
- } else if (comp->scope_cur->kind == SCOPE_SET_COMP) {
- EMIT_ARG(set_add, for_depth + 2);
- #endif
- } else {
+ if (comp->scope_cur->kind == SCOPE_GEN_EXPR) {
EMIT(yield_value);
EMIT(pop_top);
+ } else {
+ EMIT_ARG(store_comp, comp->scope_cur->kind, for_depth + 2);
}
} else if (MP_PARSE_NODE_IS_STRUCT_KIND(pn_iter, PN_comp_if)) {
// if condition