py: Simplify some cases of accessing the map of module and type dict.
mp_obj_module_get_globals() returns a mp_obj_dict_t*, and type->locals_dict is a mp_obj_dict_t*, so access the map entry of the dict directly instead of needing to cast this mp_obj_dict_t* up to an object and then calling the mp_obj_dict_get_map() helper function.
This commit is contained in:
@@ -145,13 +145,13 @@ STATIC void mp_help_print_obj(const mp_obj_t obj) {
|
||||
|
||||
mp_map_t *map = NULL;
|
||||
if (type == &mp_type_module) {
|
||||
map = mp_obj_dict_get_map(mp_obj_module_get_globals(obj));
|
||||
map = &mp_obj_module_get_globals(obj)->map;
|
||||
} else {
|
||||
if (type == &mp_type_type) {
|
||||
type = MP_OBJ_TO_PTR(obj);
|
||||
}
|
||||
if (type->locals_dict != MP_OBJ_NULL && MP_OBJ_IS_TYPE(type->locals_dict, &mp_type_dict)) {
|
||||
map = mp_obj_dict_get_map(type->locals_dict);
|
||||
if (type->locals_dict != NULL) {
|
||||
map = &type->locals_dict->map;
|
||||
}
|
||||
}
|
||||
if (map != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user