The following code can't be built in debug mode with "-l 3 -O 3":
import Toybox.Lang;
(:release)
const CALL_G = true;
(:debug)
const CALL_G = false;
function f() as Number {
if (CALL_G) {
return g(); // Undefined symbol ':g' detected.
} else {
return 0;
}
}
(:release)
function g() as Number {
return 1;
}
The assembler code for release mode has no signs of branching due to compile time optimizations:
globals/f:
argc 1
spush globals
getm
lputv 0
getselfv g
invokemz
return
globals/f_func_end:
Debug and release annotation are here only for testing purposes. The same happens for custom mutually exclusive annotations.