Support missing when branch exception throwing. (#174)

This commit is contained in:
Nikolay Igotti
2016-12-31 12:01:56 +03:00
committed by GitHub
parent 3a9ba76d91
commit 61d6967f3c
6 changed files with 30 additions and 7 deletions
@@ -68,6 +68,9 @@ private class BuiltinOperatorTransformer(val context: Context) : IrElementTransf
irBuiltins.throwNpe -> IrCallImpl(expression.startOffset, expression.endOffset,
builtIns.getKonanInternalFunctions("ThrowNullPointerException").single())
irBuiltins.noWhenBranchMatchedException -> IrCallImpl(expression.startOffset, expression.endOffset,
builtIns.getKonanInternalFunctions("ThrowNoWhenBranchMatchedException").single())
else -> expression
}
}
+5
View File
@@ -287,6 +287,11 @@ task when7(type: RunKonanTest) {
source = "codegen/branching/when7.kt"
}
task when8(type: RunKonanTest) {
source = "codegen/branching/when8.kt"
goldValue = "true\n"
}
task when_through(type: RunKonanTest) {
source = "codegen/branching/when_through.kt"
}
@@ -0,0 +1,6 @@
fun main(args: Array<String>) {
when (true) {
true -> println("true")
false -> println("false")
}
}