diff options
author | Damien George <damien.p.george@gmail.com> | 2014-12-27 17:20:41 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-12-27 17:33:30 +0000 |
commit | 83204f34067b765293b791563bdd5756bdfc5aa4 (patch) | |
tree | c3492e6ba82b9c1ae00cfe4cf33b359bec486fe1 /py/compile.c | |
parent | e37dcaafb43c1246ab55d79ebb8889a61f280533 (diff) | |
download | micropython-83204f34067b765293b791563bdd5756bdfc5aa4.tar.gz micropython-83204f34067b765293b791563bdd5756bdfc5aa4.zip |
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.
Diffstat (limited to 'py/compile.c')
-rw-r--r-- | py/compile.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/py/compile.c b/py/compile.c index 25bf64e3b9..66e2996c44 100644 --- a/py/compile.c +++ b/py/compile.c @@ -2842,6 +2842,7 @@ STATIC void compile_trailer_period(compiler_t *comp, mp_parse_node_struct_t *pns EMIT_ARG(load_attr, MP_PARSE_NODE_LEAF_ARG(pns->nodes[0])); // attribute to get } +#if MICROPY_PY_BUILTINS_SLICE STATIC void compile_subscript_3_helper(compiler_t *comp, mp_parse_node_struct_t *pns) { assert(MP_PARSE_NODE_STRUCT_KIND(pns) == PN_subscript_3); // should always be mp_parse_node_t pn = pns->nodes[0]; @@ -2897,6 +2898,7 @@ STATIC void compile_subscript_3(compiler_t *comp, mp_parse_node_struct_t *pns) { EMIT_ARG(load_const_tok, MP_TOKEN_KW_NONE); compile_subscript_3_helper(comp, pns); } +#endif // MICROPY_PY_BUILTINS_SLICE STATIC void compile_dictorsetmaker_item(compiler_t *comp, mp_parse_node_struct_t *pns) { // if this is called then we are compiling a dict key:value pair |