JS/Inlining: change sideEffects metadata to take three values: producing side effect, dependding on side effect and purity

This commit is contained in:
Alexey Andreev
2016-06-02 17:41:17 +03:00
parent 774efa4e70
commit 6b99d4e1c5
26 changed files with 154 additions and 92 deletions
@@ -0,0 +1,16 @@
package foo
class A {
var x = 23
}
inline fun bar(value: Int, a: A): Int {
a.x = 42
return value
}
fun box(): String {
val a = A()
assertEquals(23, bar(a.x, a))
return "OK"
}
@@ -0,0 +1,21 @@
package foo
object A {
init {
log("A.init")
}
val x = 23
}
inline fun bar(value: Int) {
log("bar->begin")
log("value=$value")
log("bar->end")
}
fun box(): String {
bar(A.x)
assertEquals("A.init;bar->begin;value=23;bar->end;", pullLog())
return "OK"
}
@@ -1,7 +1,7 @@
package foo
// CHECK_CONTAINS_NO_CALLS: test
// CHECK_VARS_COUNT: function=test count=1
// CHECK_VARS_COUNT: function=test count=0
object SumHolder {
var sum = 0