Minor in JS: moved test for additional vars during inline to separate directory

This commit is contained in:
Alexey Tsvetkov
2015-04-21 18:25:53 +03:00
parent 7a0787bc25
commit fd09d4d837
5 changed files with 73 additions and 7 deletions
@@ -0,0 +1,21 @@
package foo
// CHECK_CONTAINS_NO_CALLS: test
// CHECK_VARS_COUNT: function=test count=0
// A copy of stdlib run function.
// Copied to not to depend on run implementation.
// It's important, that the body is just `return fn()`.
inline fun evaluate<T>(fn: ()->T): T = fn()
fun test(x: Int): Int =
evaluate {
evaluate { 2 } * evaluate { x }
}
fun box(): String {
assertEquals(6, test(3))
assertEquals(8, test(4))
return "OK"
}