Code: Select all
import pyb
DEBUG = const(0)
# some code
if DEBUG:
print("debug info")
Code: Select all
import pyb
DEBUG = const(0)
# some code
if DEBUG:
print("debug info")
Code: Select all
STATIC void compile_if_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
uint l_end = comp_next_label(comp);
// optimisation: don't emit anything when "if False"
if (!mp_parse_node_is_const_false(pns->nodes[0])) {
...
}
bool mp_parse_node_is_const_false(mp_parse_node_t pn) {
return MP_PARSE_NODE_IS_TOKEN_KIND(pn, MP_TOKEN_KW_FALSE)
|| (MP_PARSE_NODE_IS_SMALL_INT(pn) && MP_PARSE_NODE_LEAF_SMALL_INT(pn) == 0);
}