JS backend: fixed the variable capturing in deeply nested functions.
(cherry picked from commit cee29a6)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package foo
|
||||
|
||||
fun getLastFocused(callback:(window:Any?)->Unit) {
|
||||
callback(null)
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
var result = "no"
|
||||
createTab(true) {
|
||||
result = it
|
||||
}
|
||||
return result == "yes"
|
||||
}
|
||||
|
||||
fun createTab(focusWindow:Boolean, callback:((String)->Unit)?) {
|
||||
getLastFocused {
|
||||
fun createTab() {
|
||||
if (focusWindow && callback != null) {
|
||||
callback("yes")
|
||||
}
|
||||
}
|
||||
|
||||
if (it == null) {
|
||||
createTab()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user