[JS BE] add runtime-function and intrinsics for es6-classes

This commit is contained in:
Vitaly
2020-05-09 13:53:13 +03:00
committed by romanart
parent 18bd80eb29
commit 9ede8445e7
4 changed files with 60 additions and 0 deletions
@@ -99,6 +99,10 @@ internal fun newThrowable(message: String?, cause: Throwable?): Throwable {
internal fun extendThrowable(this_: dynamic, message: String?, cause: Throwable?) {
js("Error").call(this_)
setPropertiesToThrowableInstance(this_, message, cause)
}
internal fun setPropertiesToThrowableInstance(this_: dynamic, message: String?, cause: Throwable?) {
if (!hasOwnPrototypeProperty(this_, "message")) {
this_.message = message ?: cause?.toString() ?: undefined
}