core: Allow enum
types to specify additional fields in the object
this will be used to make MathOperation enum values callable to construct a Math object with that function
This commit is contained in:
parent
4ff08e02eb
commit
76101c035e
@ -50,12 +50,13 @@ typedef struct {
|
|||||||
cp_enum_obj_print_helper(MP_QSTR_##module, print, self_in, kind); \
|
cp_enum_obj_print_helper(MP_QSTR_##module, print, self_in, kind); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAKE_ENUM_TYPE(module, type, typename) \
|
#define MAKE_ENUM_TYPE(module, type, typename, ...) \
|
||||||
const mp_obj_type_t typename##_type = { \
|
const mp_obj_type_t typename##_type = { \
|
||||||
{ &mp_type_type }, \
|
{ &mp_type_type }, \
|
||||||
.name = MP_QSTR_##type, \
|
.name = MP_QSTR_##type, \
|
||||||
.print = typename##_print, \
|
.print = typename##_print, \
|
||||||
.locals_dict = (mp_obj_dict_t *)&typename##_locals_dict, \
|
.locals_dict = (mp_obj_dict_t *)&typename##_locals_dict, \
|
||||||
|
##__VA_ARGS__ \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user