JS IR: hide runtime helpers from users

This commit is contained in:
Anton Bannykh
2020-04-22 19:31:48 +03:00
parent 9f20e65595
commit e8a6ddceaa
8 changed files with 50 additions and 47 deletions
+8 -6
View File
@@ -15,18 +15,20 @@ internal fun throwKotlinNothingValueException(): Nothing =
internal fun noWhenBranchMatchedException(): Nothing = throw NoWhenBranchMatchedException()
fun THROW_ISE(): Nothing {
internal fun THROW_ISE(): Nothing {
throw IllegalStateException()
}
fun THROW_CCE(): Nothing {
internal fun THROW_CCE(): Nothing {
throw ClassCastException()
}
fun THROW_NPE(): Nothing {
internal fun THROW_NPE(): Nothing {
throw NullPointerException()
}
fun THROW_IAE(msg: String): Nothing {
internal fun THROW_IAE(msg: String): Nothing {
throw IllegalArgumentException(msg)
}
fun <T:Any> ensureNotNull(v: T?): T = if (v == null) THROW_NPE() else v
internal fun <T:Any> ensureNotNull(v: T?): T = if (v == null) THROW_NPE() else v