Fix regionMatch for CharSequence

This commit is contained in:
Pavel Punegov
2018-10-31 23:11:58 +01:00
committed by Pavel Punegov
parent 51f3123e9c
commit b4da3e91c9
2 changed files with 12 additions and 15 deletions
-7
View File
@@ -981,13 +981,6 @@ KBoolean Kotlin_String_regionMatches(KString thiz, KInt thizOffset,
return true; return true;
} }
KBoolean Kotlin_CharSequence_regionMatches(KString thiz, KInt thizOffset,
KString other, KInt otherOffset,
KInt length, KBoolean ignoreCase) {
return Kotlin_String_regionMatches(thiz, thizOffset, other, otherOffset,
length, ignoreCase);
}
KBoolean Kotlin_Char_isDefined(KChar ch) { KBoolean Kotlin_Char_isDefined(KChar ch) {
// TODO: fixme! // TODO: fixme!
RuntimeAssert(false, "Kotlin_Char_isDefined() is not implemented"); RuntimeAssert(false, "Kotlin_Char_isDefined() is not implemented");
@@ -139,11 +139,15 @@ public fun String.endsWith(suffix: String, ignoreCase: Boolean = false): Boolean
* @param otherOffset the start offset in the other char sequence of the substring to compare. * @param otherOffset the start offset in the other char sequence of the substring to compare.
* @param length the length of the substring to compare. * @param length the length of the substring to compare.
*/ */
@SymbolName("Kotlin_CharSequence_regionMatches") public actual fun CharSequence.regionMatches(
external public actual fun CharSequence.regionMatches(
thisOffset: Int, other: CharSequence, otherOffset: Int, length: Int, thisOffset: Int, other: CharSequence, otherOffset: Int, length: Int,
ignoreCase: Boolean): Boolean ignoreCase: Boolean): Boolean {
return if (this is String && other is String) {
this.regionMatches(thisOffset, other, otherOffset, length, ignoreCase)
} else {
regionMatchesImpl(thisOffset, other, otherOffset, length, ignoreCase)
}
}
/** /**
* Returns `true` if the specified range in this string is equal to the specified range in another string. * Returns `true` if the specified range in this string is equal to the specified range in another string.