py/compile: Add option to allow compiling top-level await.
Enabled by MICROPY_COMPILE_ALLOW_TOP_LEVEL_AWAIT. When enabled, this means that scope such as module-level functions and REPL statements can yield. The outer C code must then handle this yielded generator. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -30,6 +30,11 @@
|
||||
#include "py/parse.h"
|
||||
#include "py/emitglue.h"
|
||||
|
||||
#if MICROPY_COMP_ALLOW_TOP_LEVEL_AWAIT
|
||||
// set to `true` to allow top-level await expressions
|
||||
extern bool mp_compile_allow_top_level_await;
|
||||
#endif
|
||||
|
||||
// the compiler will raise an exception if an error occurred
|
||||
// the compiler will clear the parse tree before it returns
|
||||
// mp_globals_get() will be used for the context
|
||||
|
||||
Reference in New Issue
Block a user