pxt
pxt copied to clipboard
incorrect function value capture
The following crashes on hardware (and probably sim as well):
function bugTest() {
let q = 0
function foo() { // const foo = () => { // fixes the issue
q++
}
const tmp = () => {
const bar = foo // here foo is referenced as if we were in bugTest; instead it should be captured
if (typeof bar != "function")
throw "oops"
}
tmp()
}
bugTest()