py: Change struct and macro for builtin fun so they can be type checked.

This commit is contained in:
Damien George
2016-01-03 11:53:44 +00:00
parent 3d2daa2d03
commit 1b0aab621b
8 changed files with 51 additions and 24 deletions

View File

@@ -552,11 +552,19 @@ STATIC mp_obj_t mp_builtin_hasattr(mp_obj_t object_in, mp_obj_t attr_in) {
}
MP_DEFINE_CONST_FUN_OBJ_2(mp_builtin_hasattr_obj, mp_builtin_hasattr);
STATIC mp_obj_t mp_builtin_globals(void) {
return MP_OBJ_FROM_PTR(mp_globals_get());
}
MP_DEFINE_CONST_FUN_OBJ_0(mp_builtin_globals_obj, mp_builtin_globals);
STATIC mp_obj_t mp_builtin_locals(void) {
return MP_OBJ_FROM_PTR(mp_locals_get());
}
MP_DEFINE_CONST_FUN_OBJ_0(mp_builtin_locals_obj, mp_builtin_locals);
// These are defined in terms of MicroPython API functions right away
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_id_obj, mp_obj_id);
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_len_obj, mp_obj_len);
MP_DEFINE_CONST_FUN_OBJ_0(mp_builtin_globals_obj, mp_globals_get);
MP_DEFINE_CONST_FUN_OBJ_0(mp_builtin_locals_obj, mp_locals_get);
STATIC const mp_rom_map_elem_t mp_module_builtins_globals_table[] = {
// built-in core functions