JS: when none of exhaustive when clauses match, generate code that throws exception. See KT-12194

This commit is contained in:
Alexey Andreev
2016-12-27 17:18:47 +03:00
parent 3384c6f603
commit 7f0166623d
7 changed files with 137 additions and 12 deletions
+4 -1
View File
@@ -33,4 +33,7 @@ internal fun arrayIterator(array: dynamic): MutableIterator<dynamic> {
}
@JsName("PropertyMetadata")
internal class PropertyMetadata(val name: String)
internal class PropertyMetadata(val name: String)
@JsName("noWhenBranchMatched")
internal fun noWhenBranchMatched(): Nothing = throw NoWhenBranchMatchedException()
+2
View File
@@ -41,3 +41,5 @@ public open class ClassCastException(message: String? = null) : RuntimeException
public open class AssertionError(message: String? = null) : Error(message)
public open class NoSuchElementException(message: String? = null) : Exception(message)
public open class NoWhenBranchMatchedException(message: String? = null) : RuntimeException(message)