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.cosh = function cosh(x) {
cosh.called = true;
switch (x) {
case -1: return 1.5430806348152437
case 0: return 1.0
case 1: return 1.5430806348152437
case 2: return 3.7621956910836314
}
}
// FILE: main.kt
import kotlin.math.cosh
fun box(): String {
assertEquals(cosh(-1.0), 1.5430806348152437)
assertEquals(cosh(0.0), 1.0)
assertEquals(cosh(1.0), 1.5430806348152437)
assertEquals(cosh(2.0), 3.7621956910836314)
assertEquals(js("Math.cosh.called"), true)
return "OK"
}
@@ -0,0 +1,18 @@
// WITH_STDLIB
// TARGET_BACKEND: JS_IR
// FILE: main.js
Math.cosh = undefined;
// FILE: main.kt
import kotlin.math.cosh
fun box(): String {
assertEquals(cosh(-1.0), 1.5430806348152437)
assertEquals(cosh(0.0), 1.0)
assertEquals(cosh(1.0), 1.5430806348152437)
assertEquals(cosh(2.0), 3.7621956910836314)
assertEquals(js("Math.cosh.called"), js("undefined"))
return "OK"
}