Make 'sure' an inline function with a lazy parameter

Also replace some other non-lazy stdlib function usages with the new lazy
'sure'
This commit is contained in:
Alexander Udalov
2015-04-16 00:58:50 +03:00
parent b2a2e4ae92
commit 44e35cad29
12 changed files with 102 additions and 120 deletions
@@ -16,12 +16,4 @@
package org.jetbrains.kotlin.utils
public fun <T : Any> T?.sure(message: String): T = this ?: throw AssertionError(message)
fun <T> T.printAndReturn(message: String = ""): T {
if (!message.isEmpty()) {
println("$message:")
}
println(this)
return this
}
public inline fun <T : Any> T?.sure(message: () -> String): T = this ?: throw AssertionError(message())