summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-08 21:32:29 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-08 21:32:29 +0100
commitf4c9b33abf0ac6ff97cd39331d125a74fd2bb897 (patch)
tree64bdfb7d6d032d826640e1f9a43956b0b3947591 /py/obj.h
parent4671392d90e98ea4edf6e9ce7023d21cc9957d8c (diff)
downloadmicropython-f4c9b33abf0ac6ff97cd39331d125a74fd2bb897.tar.gz
micropython-f4c9b33abf0ac6ff97cd39331d125a74fd2bb897.zip
py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR.
This makes the runtime and object APIs more consistent. mp_store_subscr functionality now moved into objects (ie list and dict store_item).
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/py/obj.h b/py/obj.h
index 77f7c0b8f6..92dd6a8a0b 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -163,8 +163,8 @@ typedef mp_obj_t (*mp_call_fun_t)(mp_obj_t fun, uint n_args, uint n_kw, const mp
typedef mp_obj_t (*mp_unary_op_fun_t)(int op, mp_obj_t);
typedef mp_obj_t (*mp_binary_op_fun_t)(int op, mp_obj_t, mp_obj_t);
typedef void (*mp_load_attr_fun_t)(mp_obj_t self_in, qstr attr, mp_obj_t *dest); // for fail, do nothing; for attr, dest[0] = value; for method, dest[0] = method, dest[1] = self
-typedef bool (*mp_store_attr_fun_t)(mp_obj_t self_in, qstr attr, mp_obj_t value); // return true if store succeeded
-typedef bool (*mp_store_item_fun_t)(mp_obj_t self_in, mp_obj_t index, mp_obj_t value); // return true if store succeeded
+typedef bool (*mp_store_attr_fun_t)(mp_obj_t self_in, qstr attr, mp_obj_t value); // return true if store succeeded; if value==MP_OBJ_NULL then delete
+typedef bool (*mp_store_item_fun_t)(mp_obj_t self_in, mp_obj_t index, mp_obj_t value); // return true if store succeeded; if value==MP_OBJ_NULL then delete
typedef struct _mp_method_t {
qstr name;
@@ -218,8 +218,9 @@ struct _mp_obj_type_t {
mp_load_attr_fun_t load_attr;
mp_store_attr_fun_t store_attr; // if value is MP_OBJ_NULL, then delete that attribute
- // Implements container[index] = val; note that load_item is implemented
- // by binary_op(RT_BINARY_OP_SUBSCR)
+
+ // Implements container[index] = val. If val == MP_OBJ_NULL, then it's a delete.
+ // Note that load_item is implemented by binary_op(RT_BINARY_OP_SUBSCR)
mp_store_item_fun_t store_item;
mp_fun_1_t getiter;