Remove runtime specialization in inline last and lastOrNull to prevent double inlining of predicate body.

This commit is contained in:
Ilya Gorbunov
2016-04-22 20:21:16 +03:00
parent 09c1ff1233
commit 2d12ed68c8
2 changed files with 0 additions and 16 deletions
@@ -527,12 +527,6 @@ fun elements(): List<GenericFunction> {
@throws [NoSuchElementException] if no such ${f.element} is found.""" }
returns("T")
body { f ->
(if (f == Iterables)
"""
if (this is List)
return this.last(predicate)
"""
else "") +
"""
var last: T? = null
var found = false
@@ -574,12 +568,6 @@ fun elements(): List<GenericFunction> {
doc { f -> "Returns the last ${f.element} matching the given [predicate], or `null` if no such ${f.element} was found." }
returns("T?")
body { f ->
(if (f == Iterables)
"""
if (this is List)
return this.lastOrNull(predicate)
"""
else "") +
"""
var last: T? = null
for (element in this) {