feat: add polyfills insertion for ES Next used features
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// WITH_STDLIB
|
||||
// TARGET_BACKEND: JS_IR
|
||||
// FILE: main.js
|
||||
Math.log2 = function log2(x) {
|
||||
log2.called = true;
|
||||
return Math.log(x) * Math.LOG2E;
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.math.log2
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(log2(1.0), 0)
|
||||
assertEquals(log2(2.0), 1)
|
||||
assertEquals(log2(4.0), 2)
|
||||
assertEquals(js("Math.log2.called"), true)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// WITH_STDLIB
|
||||
// TARGET_BACKEND: JS_IR
|
||||
// FILE: main.js
|
||||
Math.log2 = undefined;
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.math.log2
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(log2(1.0), 0)
|
||||
assertEquals(log2(2.0), 1)
|
||||
assertEquals(log2(4.0), 2)
|
||||
assertEquals(js("Math.log2.called"), js("undefined"))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user