kotlinx.atomicfu compiler plugin for JS_IR backend (#4581)

* kotlinx.atomicfu compiler plugin for JS_IR

Support transformations of atomic operations introduced by the kotlinx.atomicfu library for the JS_IR backend. Compiler plugin is applied externally by the kotlinx.atomicfu gradle plugin.

* Apply compiler plugin for JS platform only

* New plugin test structure

* testGroupOutputDirPrefix changed
This commit is contained in:
mvicsokolova
2021-12-01 22:33:13 +03:00
committed by GitHub
parent 05695761ec
commit 93561a1a55
45 changed files with 2655 additions and 4 deletions
@@ -0,0 +1,34 @@
import kotlinx.atomicfu.*
import kotlinx.atomicfu.locks.*
import kotlin.test.*
class PropertyDeclarationTest {
private val a: AtomicInt
private val head: AtomicRef<String>
private val lateIntArr: AtomicIntArray
private val lateRefArr: AtomicArray<String?>
private val lock: ReentrantLock
init {
a = atomic(0)
head = atomic("AAA")
lateIntArr = AtomicIntArray(55)
lateRefArr = atomicArrayOfNulls<String?>(10)
lock = reentrantLock()
}
fun test() {
assertEquals(0, a.value)
check(head.compareAndSet("AAA", "BBB"))
assertEquals("BBB", head.value)
assertEquals(0, lateIntArr[35].value)
assertEquals(null, lateRefArr[5].value)
assertEquals(null, lock)
}
}
fun box(): String {
val testClass = PropertyDeclarationTest()
testClass.test()
return "OK"
}