summaryrefslogtreecommitdiffstatshomepage
path: root/py/runtime.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-03-21 00:58:07 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-03-21 00:59:39 +0200
commit07b8dc68d667c212f9a3710b74e90e05e1032316 (patch)
treecb904cc2ba1ff56caeb30d64fe72c32e503f30b6 /py/runtime.c
parent8d51c9d37601e30b58cde625251225c8cee83cc3 (diff)
downloadmicropython-07b8dc68d667c212f9a3710b74e90e05e1032316.tar.gz
micropython-07b8dc68d667c212f9a3710b74e90e05e1032316.zip
runtime: mp_load_method_maybe(): Don't use confusing "base" term.
"Base" should rather refer to "base type"."Base object for attribute lookup" should rather be just "object". Also, a case of common subexpression elimination.
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/py/runtime.c b/py/runtime.c
index 13a70ffc86..f1633c6c54 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -857,13 +857,13 @@ mp_obj_t mp_load_attr(mp_obj_t base, qstr attr) {
// no attribute found, returns: dest[0] == MP_OBJ_NULL, dest[1] == MP_OBJ_NULL
// normal attribute found, returns: dest[0] == <attribute>, dest[1] == MP_OBJ_NULL
// method attribute found, returns: dest[0] == <method>, dest[1] == <self>
-void mp_load_method_maybe(mp_obj_t base, qstr attr, mp_obj_t *dest) {
+void mp_load_method_maybe(mp_obj_t obj, qstr attr, mp_obj_t *dest) {
// clear output to indicate no attribute/method found yet
dest[0] = MP_OBJ_NULL;
dest[1] = MP_OBJ_NULL;
// get the type
- mp_obj_type_t *type = mp_obj_get_type(base);
+ mp_obj_type_t *type = mp_obj_get_type(obj);
// look for built-in names
if (0) {
@@ -875,11 +875,11 @@ void mp_load_method_maybe(mp_obj_t base, qstr attr, mp_obj_t *dest) {
} else if (attr == MP_QSTR___next__ && type->iternext != NULL) {
dest[0] = (mp_obj_t)&mp_builtin_next_obj;
- dest[1] = base;
+ dest[1] = obj;
} else if (type->load_attr != NULL) {
// this type can do its own load, so call it
- type->load_attr(base, attr, dest);
+ type->load_attr(obj, attr, dest);
} else if (type->locals_dict != NULL) {
// generic method lookup
@@ -896,14 +896,14 @@ void mp_load_method_maybe(mp_obj_t base, qstr attr, mp_obj_t *dest) {
} else if (MP_OBJ_IS_TYPE(elem->value, &mp_type_classmethod)) {
// return a bound method, with self being the type of this object
dest[0] = ((mp_obj_static_class_method_t*)elem->value)->fun;
- dest[1] = mp_obj_get_type(base);
+ dest[1] = type;
} else if (MP_OBJ_IS_TYPE(elem->value, &mp_type_type)) {
// Don't try to bind types
dest[0] = elem->value;
} else if (mp_obj_is_callable(elem->value)) {
// return a bound method, with self being this object
dest[0] = elem->value;
- dest[1] = base;
+ dest[1] = obj;
} else {
// class member is a value, so just return that value
dest[0] = elem->value;