py: Add MICROPY_ENABLE_COMPILER and MICROPY_PY_BUILTINS_EVAL_EXEC opts.
MICROPY_ENABLE_COMPILER can be used to enable/disable the entire compiler,
which is useful when only loading of pre-compiled bytecode is supported.
It is enabled by default.
MICROPY_PY_BUILTINS_EVAL_EXEC controls support of eval and exec builtin
functions. By default they are only included if MICROPY_ENABLE_COMPILER
is enabled.
Disabling both options saves about 40k of code size on 32-bit x86.
diff --git a/py/scope.c b/py/scope.c
index f9b1fb1..632e527 100644
--- a/py/scope.c
+++ b/py/scope.c
@@ -28,6 +28,8 @@
#include "py/scope.h"
+#if MICROPY_ENABLE_COMPILER
+
scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, mp_uint_t emit_options) {
scope_t *scope = m_new0(scope_t, 1);
scope->kind = kind;
@@ -149,3 +151,5 @@
}
assert(0); // we should have found the variable in one of the parents
}
+
+#endif // MICROPY_ENABLE_COMPILER