JS/Inlining: change sideEffects metadata to take three values: producing side effect, dependding on side effect and purity
This commit is contained in:
+16
@@ -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"
|
||||
}
|
||||
+21
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user