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:
@@ -113,7 +113,6 @@ public class IntrinsicMethods {
|
||||
declareIntrinsicFunction("Boolean", "not", 0, new Not());
|
||||
|
||||
declareIntrinsicFunction("String", "plus", 1, new Concat());
|
||||
declareIntrinsicFunction("CharSequence", "get", 1, new StringGetChar());
|
||||
declareIntrinsicFunction("String", "get", 1, new StringGetChar());
|
||||
|
||||
declareIntrinsicFunction("Cloneable", "clone", 0, CLONE);
|
||||
|
||||
@@ -23,20 +23,21 @@ import org.jetbrains.jet.codegen.StackValue
|
||||
import org.jetbrains.jet.lang.psi.JetExpression
|
||||
|
||||
public class StringGetChar : LazyIntrinsicMethod() {
|
||||
override fun generateImpl(codegen: ExpressionCodegen,
|
||||
returnType: Type,
|
||||
element: PsiElement?,
|
||||
arguments: List<JetExpression>,
|
||||
receiver: StackValue): StackValue {
|
||||
|
||||
override fun generateImpl(
|
||||
codegen: ExpressionCodegen,
|
||||
returnType: Type,
|
||||
element: PsiElement?,
|
||||
arguments: List<JetExpression>,
|
||||
receiver: StackValue
|
||||
): StackValue {
|
||||
return StackValue.operation(Type.CHAR_TYPE) {
|
||||
if (receiver != StackValue.none()) {
|
||||
receiver.put(receiver.type, it)
|
||||
}
|
||||
if (!arguments.isEmpty()) {
|
||||
codegen.gen(arguments.get(0)).put(Type.INT_TYPE, it)
|
||||
codegen.gen(arguments.first()).put(Type.INT_TYPE, it)
|
||||
}
|
||||
it.invokeinterface("java/lang/CharSequence", "charAt", "(I)C")
|
||||
it.invokevirtual("java/lang/String", "charAt", "(I)C", false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user