That's a good idea - I guess you could add a new macro - ASSERT_AND_PRINT(jsvGetLocks(var) < JSV_LOCK_MAX, jsvGetRef(var)) or something, that would print the second arg if it failed.
jsvGetRef is really what you need. Then you can look it up in the memory trace that should be printed after the assertion... Trying to work out the variable name is possible by scanning all variables, but a huge faff and I don't think there is any built-in function for it.
Otherwise the easiest way is if you have a debugger, or can reproduce it on the PC.
(Just going to move this to ESP8266 - I don't think it's really JS related... not in the way most folks will be expecting :) )
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
That's a good idea - I guess you could add a new macro -
ASSERT_AND_PRINT(jsvGetLocks(var) < JSV_LOCK_MAX, jsvGetRef(var))
or something, that would print the second arg if it failed.jsvGetRef is really what you need. Then you can look it up in the memory trace that should be printed after the assertion... Trying to work out the variable name is possible by scanning all variables, but a huge faff and I don't think there is any built-in function for it.
Otherwise the easiest way is if you have a debugger, or can reproduce it on the PC.
(Just going to move this to ESP8266 - I don't think it's really JS related... not in the way most folks will be expecting :) )