summaryrefslogtreecommitdiffstatshomepage
path: root/py/vm.c
diff options
context:
space:
mode:
authorDamien <damien.p.george@gmail.com>2013-10-16 16:12:52 +0100
committerDamien <damien.p.george@gmail.com>2013-10-16 16:12:52 +0100
commitc226dca1f712914f63ead99fbf4f451aaba90d24 (patch)
tree98146d0f255c9bc56f3ee0f5cec5be92cf1b15c2 /py/vm.c
parent152568bcb61e65b700ca2b963534f2632d080345 (diff)
downloadmicropython-c226dca1f712914f63ead99fbf4f451aaba90d24.tar.gz
micropython-c226dca1f712914f63ead99fbf4f451aaba90d24.zip
Support tuples and list comprehension, albeit crude.
Diffstat (limited to 'py/vm.c')
-rw-r--r--py/vm.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/py/vm.c b/py/vm.c
index adf84c0e02..2821d40470 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -268,6 +268,13 @@ py_obj_t py_execute_byte_code(const byte *code, uint len, const py_obj_t *args,
*sp = rt_compare_op(unum, obj1, obj2);
break;
+ case PYBC_BUILD_TUPLE:
+ DECODE_UINT;
+ obj1 = rt_build_tuple(unum, sp);
+ sp += unum - 1;
+ *sp = obj1;
+ break;
+
case PYBC_BUILD_LIST:
DECODE_UINT;
obj1 = rt_build_list(unum, sp);
@@ -275,6 +282,13 @@ py_obj_t py_execute_byte_code(const byte *code, uint len, const py_obj_t *args,
*sp = obj1;
break;
+ case PYBC_LIST_APPEND:
+ DECODE_UINT;
+ // I think it's guaranteed by the compiler that sp[unum] is a list
+ rt_list_append(sp[unum], sp[0]);
+ sp++;
+ break;
+
case PYBC_BUILD_MAP:
DECODE_UINT;
PUSH(rt_build_map(unum));