diff options
Diffstat (limited to 'py/objslice.c')
-rw-r--r-- | py/objslice.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/py/objslice.c b/py/objslice.c index 03607e4c3e..a624be9631 100644 --- a/py/objslice.c +++ b/py/objslice.c @@ -9,6 +9,36 @@ #include "obj.h" #include "runtime0.h" +/******************************************************************************/ +/* ellipsis object, a singleton */ + +typedef struct _mp_obj_ellipsis_t { + mp_obj_base_t base; +} mp_obj_ellipsis_t; + +void ellipsis_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in) { + print(env, "Ellipsis"); +} + +const mp_obj_type_t ellipsis_type = { + { &mp_const_type }, + "ellipsis", + ellipsis_print, // print + NULL, // make_new + NULL, // call_n + NULL, // unary_op + NULL, // binary_op + NULL, // getiter + NULL, // iternext + {{NULL, NULL},}, // method list +}; + +static const mp_obj_ellipsis_t ellipsis_obj = {{&ellipsis_type}}; +const mp_obj_t mp_const_ellipsis = (mp_obj_t)&ellipsis_obj; + +/******************************************************************************/ +/* slice object */ + #if MICROPY_ENABLE_SLICE // TODO: This implements only variant of slice with 2 integer args only. @@ -29,6 +59,7 @@ const mp_obj_type_t slice_type = { "slice", slice_print, NULL, // call_n + NULL, // make_new NULL, // unary_op NULL, // binary_op NULL, // getiter |