py: Allow to properly disable builtin slice operation.
This patch makes the MICROPY_PY_BUILTINS_SLICE compile-time option
fully disable the builtin slice operation (when set to 0). This
includes removing the slice sytanx from the grammar. Now, enabling
slice costs 4228 bytes on unix x64, and 1816 bytes on stmhal.
diff --git a/py/emitnative.c b/py/emitnative.c
index 9f57334..c2fe951 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -2084,6 +2084,7 @@
}
#endif
+#if MICROPY_PY_BUILTINS_SLICE
STATIC void emit_native_build_slice(emit_t *emit, mp_uint_t n_args) {
DEBUG_printf("build_slice %d\n", n_args);
if (n_args == 2) {
@@ -2104,6 +2105,7 @@
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
}
}
+#endif
STATIC void emit_native_unpack_sequence(emit_t *emit, mp_uint_t n_args) {
DEBUG_printf("unpack_sequence %d\n", n_args);
@@ -2336,7 +2338,9 @@
emit_native_build_set,
emit_native_set_add,
#endif
+ #if MICROPY_PY_BUILTINS_SLICE
emit_native_build_slice,
+ #endif
emit_native_unpack_sequence,
emit_native_unpack_ex,
emit_native_make_function,