Do not inline Regex.replace

This commit is contained in:
Ilya Gorbunov
2016-01-29 21:36:48 +03:00
parent dccae6c3ff
commit a192915c82
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -634,7 +634,7 @@ public inline fun CharSequence.replace(regex: Regex, replacement: String): Strin
* replacement for that match.
*/
@kotlin.internal.InlineOnly
public inline fun CharSequence.replace(regex: Regex, transform: (MatchResult) -> CharSequence): String = regex.replace(this, transform)
public inline fun CharSequence.replace(regex: Regex, noinline transform: (MatchResult) -> CharSequence): String = regex.replace(this, transform)
/**
* Replaces the first occurrence of the given regular expression [regex] in this char sequence with specified [replacement] expression.
@@ -151,7 +151,7 @@ internal constructor(private val nativePattern: Pattern) {
* the given function [transform] that takes [MatchResult] and returns a string to be used as a
* replacement for that match.
*/
public inline fun replace(input: CharSequence, transform: (MatchResult) -> CharSequence): String {
public fun replace(input: CharSequence, transform: (MatchResult) -> CharSequence): String {
var match: MatchResult? = find(input) ?: return input.toString()
var lastStart = 0