Files
kotlin-fork/js/js.translator/testFiles/closure/cases/wrappedVariableInExtensionFun.kt
T
develar e786e62fd7 JS backend: fixed variable capturing in extension functions.
Fixed ClosureTest.testWrappedVariableInExtensionFun IteratorsTest.foldReducesTheFirstNElements and IteratorsTest.takeExtractsTheFirstNElements. All tests passed.

(cherry picked from commit f8f1895)
2013-08-09 14:29:55 +04:00

11 lines
155 B
Kotlin

package foo
fun Any.foo(n: Int): ()->Boolean {
var count = n
return { --count >= 0 }
}
fun box(): Boolean {
return 1.foo(3)() && !1.foo(0)()
}