feat: add polyfills insertion for ES Next used features

This commit is contained in:
Artem Kobzar
2022-02-16 10:49:11 +00:00
committed by Space
parent 76ff717091
commit 804eb61bf0
80 changed files with 8769 additions and 6552 deletions
@@ -0,0 +1,26 @@
// WITH_STDLIB
// TARGET_BACKEND: JS_IR
// FILE: main.js
Math.atanh = function atanh(x) {
atanh.called = true;
switch (x) {
case -1: return -Infinity
case 0: return 0.0
case 0.5: return 0.5493061443340548
case 1: return Infinity
}
}
// FILE: main.kt
import kotlin.math.atanh
fun box(): String {
assertEquals(atanh(-1.0), Double.NEGATIVE_INFINITY)
assertEquals(atanh(0.0), 0.0)
assertEquals(atanh(0.5), 0.5493061443340548)
assertEquals(atanh(1.0), Double.POSITIVE_INFINITY)
assertEquals(js("Math.atanh.called"), true)
return "OK"
}
@@ -0,0 +1,18 @@
// WITH_STDLIB
// TARGET_BACKEND: JS_IR
// FILE: main.js
Math.atanh = undefined;
// FILE: main.kt
import kotlin.math.atanh
fun box(): String {
assertEquals(atanh(-1.0), Double.NEGATIVE_INFINITY)
assertEquals(atanh(0.0), 0.0)
assertEquals(atanh(0.5), 0.5493061443340548)
assertEquals(atanh(1.0), Double.POSITIVE_INFINITY)
assertEquals(js("Math.atanh.called"), js("undefined"))
return "OK"
}