JS backend: fixed the variable capturing in deeply nested functions.

(cherry picked from commit cee29a6)
This commit is contained in:
develar
2012-09-06 18:30:58 +04:00
committed by Zalim Bashorov
parent 84542872b8
commit 4a37d56a1b
12 changed files with 253 additions and 299 deletions
@@ -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()
}
}
}