On my new Venu X1 the datafield does not support distanceToDestination
It crashes if 'if (info has :distanceToDestination) {' is not used
ConnectIq SDK 8.4.1
On my new Venu X1 the datafield does not support distanceToDestination
It crashes if 'if (info has :distanceToDestination) {' is not used
ConnectIq SDK 8.4.1
it enables the compiler to eliminate branches that are irrelevant for the device
Has anyone ever proven this? I think, it only worked for system 7 preview device, that had a bunch of "has..." device properties in compiler/simulator.json that were used for this optimization. I'm not aware of any real device with such configuration.
This code
import Toybox.Activity;
import Toybox.System;
function checkDistanceToDestination() as Void {
if (Activity.Info has :distanceToDestination) {
System.println("has distanceToDestination");
} else {
System.println("doesn't have distanceToDestination");
}
}
gives the same assembler code regardless of compiler flags and devices used (actually, I've just used venu445mm and venux1 in this particular test):
globals/checkDistanceToDestination:
argc 1
spush globals
getm
lputv 0
getmv Toybox_Activity Info
spush distanceToDestination
canhazplz
bf @_..._mc_10_4_14_4_if_else_false
getmv Toybox_System println
frpush
news @strhas_distanceToDestination_1198218344
invokem 2
popv
return
_..._mc_10_4_14_4_if_else_false:
getmv Toybox_System println
frpush
news @strdoesn_t_have_distanceToDestination_407115324
invokem 2
popv
return
globals/checkDistanceToDestination_func_end:
Does anyone have a counterexample?
The "info" passed to compute is Activity.Info