Rename CharSequence.get to charAt

This is done for JVM interoperability. There's still a member function
String.get() and an extension function "get" on CharSequence

 #KT-1730 Fixed
 #KT-5389 Fixed
This commit is contained in:
Alexander Udalov
2014-11-26 19:57:30 +03:00
parent a7b88e9485
commit 4d95bcfc7e
18 changed files with 95 additions and 33 deletions
-2
View File
@@ -27,8 +27,6 @@ public fun String.split(regex: String, limit: Int): Array<String> = noImpl
native public fun String.substring(beginIndex : Int) : String = noImpl
native public fun String.substring(beginIndex : Int, endIndex : Int) : String = noImpl
native public fun String.charAt(index : Int) : Char = noImpl
native public fun String.concat(str : String) : String = noImpl
native public fun String.match(regex : String) : Array<String> = noImpl
@@ -26,7 +26,9 @@ public final class StringOperationFIF extends CompositeFIF {
public static final FunctionIntrinsicFactory INSTANCE = new StringOperationFIF();
private StringOperationFIF() {
add(pattern("kotlin", "CharSequence", "get").checkOverridden(), new BuiltInFunctionIntrinsic("charAt"));
add(pattern("kotlin", "String", "get"), new BuiltInFunctionIntrinsic("charAt"));
// This intrinsic is needed because charAt is a public function taking one parameter and thus its name would be mangled otherwise
add(pattern("kotlin", "CharSequence", "charAt").checkOverridden(), new BuiltInFunctionIntrinsic("charAt"));
add(pattern("kotlin", "CharSequence", "length").checkOverridden(), LENGTH_PROPERTY_INTRINSIC);
add(pattern("kotlin.js", "isEmpty").isExtensionOf("kotlin.CharSequence"), IS_EMPTY_INTRINSIC);
}