JS: fix issues with js() usage in inline functions

This commit is contained in:
Alexey Tsvetkov
2015-03-13 14:51:38 +03:00
parent 5ff5cea17a
commit 1557111277
11 changed files with 151 additions and 21 deletions
@@ -0,0 +1,20 @@
package foo
// CHECK_CONTAINS_NO_CALLS: test
inline fun sum(x: Int, y: Int): Int = js("var a = x; a + y")
fun test(x: Int, y: Int): Int {
val xx = sum(x, x)
js("var a = 0;")
val yy = sum(y, y)
return sum(xx, yy)
}
fun box(): String {
assertEquals(4, test(1, 1))
assertEquals(8, test(1, 3))
return "OK"
}