Clean up: rename Jet* to Kt*
This commit is contained in:
@@ -1626,7 +1626,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
BlockStackElement topOfStack = blockStackElements.pop();
|
||||
assert topOfStack == tryWithFinallyBlockStackElement : "Top element of stack doesn't equals processing finally block";
|
||||
|
||||
KtTryExpression jetTryExpression = tryWithFinallyBlockStackElement.expression;
|
||||
KtTryExpression ktTryExpression = tryWithFinallyBlockStackElement.expression;
|
||||
Label finallyStart = linkedLabel();
|
||||
v.mark(finallyStart);
|
||||
tryWithFinallyBlockStackElement.addGapLabel(finallyStart);
|
||||
@@ -1635,7 +1635,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
generateFinallyMarker(v, finallyDepth, true);
|
||||
}
|
||||
//noinspection ConstantConditions
|
||||
gen(jetTryExpression.getFinallyBlock().getFinalExpression(), Type.VOID_TYPE);
|
||||
gen(ktTryExpression.getFinallyBlock().getFinalExpression(), Type.VOID_TYPE);
|
||||
|
||||
if (isFinallyMarkerRequired(context)) {
|
||||
generateFinallyMarker(v, finallyDepth, false);
|
||||
@@ -4849,9 +4849,9 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
|
||||
public void newArrayInstruction(@NotNull KotlinType arrayType) {
|
||||
if (KotlinBuiltIns.isArray(arrayType)) {
|
||||
KotlinType elementJetType = arrayType.getArguments().get(0).getType();
|
||||
putReifiedOperationMarkerIfTypeIsReifiedParameter(this, elementJetType, ReifiedTypeInliner.OperationKind.NEW_ARRAY);
|
||||
v.newarray(boxType(typeMapper.mapTypeAsDeclaration(elementJetType)));
|
||||
KotlinType elementKotlinType = arrayType.getArguments().get(0).getType();
|
||||
putReifiedOperationMarkerIfTypeIsReifiedParameter(this, elementKotlinType, ReifiedTypeInliner.OperationKind.NEW_ARRAY);
|
||||
v.newarray(boxType(typeMapper.mapTypeAsDeclaration(elementKotlinType)));
|
||||
}
|
||||
else {
|
||||
Type type = typeMapper.mapType(arrayType);
|
||||
|
||||
@@ -603,8 +603,8 @@ public abstract class MemberCodegen<T extends KtPureElement/* TODO: & KtDeclarat
|
||||
if (initializerValue == null) return state.getClassBuilderMode().generateBodies;
|
||||
|
||||
//TODO: OPTIMIZATION: don't initialize static final fields
|
||||
KotlinType jetType = getPropertyOrDelegateType(property, propertyDescriptor);
|
||||
Type type = typeMapper.mapType(jetType);
|
||||
KotlinType kotlinType = getPropertyOrDelegateType(property, propertyDescriptor);
|
||||
Type type = typeMapper.mapType(kotlinType);
|
||||
return !skipDefaultValue(propertyDescriptor, initializerValue.getValue(), type);
|
||||
}
|
||||
|
||||
|
||||
@@ -560,9 +560,9 @@ public class PropertyCodegen {
|
||||
PropertyDescriptor propertyDescriptor = propertyAccessorDescriptor.getCorrespondingProperty();
|
||||
StackValue property = codegen.intermediateValueForProperty(propertyDescriptor, true, null, StackValue.LOCAL_0);
|
||||
|
||||
PsiElement jetProperty = DescriptorToSourceUtils.descriptorToDeclaration(propertyDescriptor);
|
||||
if (jetProperty instanceof KtProperty || jetProperty instanceof KtParameter) {
|
||||
codegen.markLineNumber((KtElement) jetProperty, false);
|
||||
PsiElement ktProperty = DescriptorToSourceUtils.descriptorToDeclaration(propertyDescriptor);
|
||||
if (ktProperty instanceof KtProperty || ktProperty instanceof KtParameter) {
|
||||
codegen.markLineNumber((KtElement) ktProperty, false);
|
||||
}
|
||||
|
||||
if (propertyAccessorDescriptor instanceof PropertyGetterDescriptor) {
|
||||
|
||||
@@ -245,9 +245,9 @@ public class CodegenBinding {
|
||||
answer.addAll(files);
|
||||
|
||||
for (FqName name : names) {
|
||||
Collection<KtFile> jetFiles = bindingContext.get(PACKAGE_TO_FILES, name);
|
||||
if (jetFiles != null) {
|
||||
answer.addAll(jetFiles);
|
||||
Collection<KtFile> ktFiles = bindingContext.get(PACKAGE_TO_FILES, name);
|
||||
if (ktFiles != null) {
|
||||
answer.addAll(ktFiles);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
class Increment(private val myDelta: Int) : IntrinsicMethod() {
|
||||
override fun toCallable(method: CallableMethod, isSuper: Boolean, resolvedCall: ResolvedCall<*>): Callable =
|
||||
createIntrinsicCallable(method) {
|
||||
val jetExpression = resolvedCall.call.calleeExpression
|
||||
assert(jetExpression !is KtPrefixExpression) { "There should be postfix increment ${jetExpression!!.text}" }
|
||||
val ktExpression = resolvedCall.call.calleeExpression
|
||||
assert(ktExpression !is KtPrefixExpression) { "There should be postfix increment ${ktExpression!!.text}" }
|
||||
genIncrement(returnType, myDelta, it)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
|
||||
class NewArray : IntrinsicMethod() {
|
||||
override fun toCallable(fd: FunctionDescriptor, isSuper: Boolean, resolvedCall: ResolvedCall<*>, codegen: ExpressionCodegen): Callable {
|
||||
val jetType = resolvedCall.resultingDescriptor.returnType!!
|
||||
val type = codegen.state.typeMapper.mapType(jetType)
|
||||
val kotlinType = resolvedCall.resultingDescriptor.returnType!!
|
||||
val type = codegen.state.typeMapper.mapType(kotlinType)
|
||||
return object : IntrinsicCallable(type, listOf(Type.INT_TYPE), null, null) {
|
||||
override fun invokeIntrinsic(v: InstructionAdapter) {
|
||||
codegen.newArrayInstruction(jetType)
|
||||
codegen.newArrayInstruction(kotlinType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,15 +19,15 @@ import org.jetbrains.org.objectweb.asm.tree.*
|
||||
|
||||
object TypeIntrinsics {
|
||||
@JvmStatic
|
||||
fun instanceOf(v: InstructionAdapter, jetType: KotlinType, boxedAsmType: Type) {
|
||||
val functionTypeArity = getFunctionTypeArity(jetType)
|
||||
fun instanceOf(v: InstructionAdapter, kotlinType: KotlinType, boxedAsmType: Type) {
|
||||
val functionTypeArity = getFunctionTypeArity(kotlinType)
|
||||
if (functionTypeArity >= 0) {
|
||||
v.iconst(functionTypeArity)
|
||||
v.typeIntrinsic(IS_FUNCTON_OF_ARITY_METHOD_NAME, IS_FUNCTON_OF_ARITY_DESCRIPTOR)
|
||||
return
|
||||
}
|
||||
|
||||
val suspendFunctionTypeArity = getSuspendFunctionTypeArity(jetType)
|
||||
val suspendFunctionTypeArity = getSuspendFunctionTypeArity(kotlinType)
|
||||
if (suspendFunctionTypeArity >= 0) {
|
||||
val notSuspendLambda = Label()
|
||||
val end = Label()
|
||||
@@ -49,7 +49,7 @@ object TypeIntrinsics {
|
||||
return
|
||||
}
|
||||
|
||||
val isMutableCollectionMethodName = getIsMutableCollectionMethodName(jetType)
|
||||
val isMutableCollectionMethodName = getIsMutableCollectionMethodName(kotlinType)
|
||||
if (isMutableCollectionMethodName != null) {
|
||||
v.typeIntrinsic(isMutableCollectionMethodName, IS_MUTABLE_COLLECTION_METHOD_DESCRIPTOR)
|
||||
return
|
||||
@@ -72,8 +72,8 @@ object TypeIntrinsics {
|
||||
LdcInsnNode(Integer(value))
|
||||
}
|
||||
|
||||
@JvmStatic fun instanceOf(instanceofInsn: TypeInsnNode, instructions: InsnList, jetType: KotlinType, asmType: Type) {
|
||||
val functionTypeArity = getFunctionTypeArity(jetType)
|
||||
@JvmStatic fun instanceOf(instanceofInsn: TypeInsnNode, instructions: InsnList, kotlinType: KotlinType, asmType: Type) {
|
||||
val functionTypeArity = getFunctionTypeArity(kotlinType)
|
||||
if (functionTypeArity >= 0) {
|
||||
instructions.insertBefore(instanceofInsn, iconstNode(functionTypeArity))
|
||||
instructions.insertBefore(instanceofInsn,
|
||||
@@ -82,7 +82,7 @@ object TypeIntrinsics {
|
||||
return
|
||||
}
|
||||
|
||||
val isMutableCollectionMethodName = getIsMutableCollectionMethodName(jetType)
|
||||
val isMutableCollectionMethodName = getIsMutableCollectionMethodName(kotlinType)
|
||||
if (isMutableCollectionMethodName != null) {
|
||||
instructions.insertBefore(instanceofInsn,
|
||||
typeIntrinsicNode(isMutableCollectionMethodName, IS_MUTABLE_COLLECTION_METHOD_DESCRIPTOR))
|
||||
@@ -141,22 +141,22 @@ object TypeIntrinsics {
|
||||
FqNames.mutableMapEntry
|
||||
)
|
||||
|
||||
private fun getMutableCollectionMethodName(prefix: String, jetType: KotlinType): String? {
|
||||
val fqName = getClassFqName(jetType)
|
||||
private fun getMutableCollectionMethodName(prefix: String, kotlinType: KotlinType): String? {
|
||||
val fqName = getClassFqName(kotlinType)
|
||||
if (fqName == null || fqName !in MUTABLE_COLLECTION_TYPE_FQ_NAMES) return null
|
||||
val baseName = if (fqName == FqNames.mutableMapEntry) "MutableMapEntry" else fqName.shortName().asString()
|
||||
return prefix + baseName
|
||||
}
|
||||
|
||||
private fun getIsMutableCollectionMethodName(jetType: KotlinType): String? = getMutableCollectionMethodName("is", jetType)
|
||||
private fun getIsMutableCollectionMethodName(kotlinType: KotlinType): String? = getMutableCollectionMethodName("is", kotlinType)
|
||||
|
||||
private fun getAsMutableCollectionMethodName(jetType: KotlinType): String? = getMutableCollectionMethodName("as", jetType)
|
||||
private fun getAsMutableCollectionMethodName(kotlinType: KotlinType): String? = getMutableCollectionMethodName("as", kotlinType)
|
||||
|
||||
private val IS_MUTABLE_COLLECTION_METHOD_DESCRIPTOR =
|
||||
Type.getMethodDescriptor(Type.BOOLEAN_TYPE, Type.getObjectType("java/lang/Object"))
|
||||
|
||||
private fun getClassFqName(jetType: KotlinType): FqName? {
|
||||
val classDescriptor = TypeUtils.getClassDescriptor(jetType) ?: return null
|
||||
private fun getClassFqName(kotlinType: KotlinType): FqName? {
|
||||
val classDescriptor = TypeUtils.getClassDescriptor(kotlinType) ?: return null
|
||||
return DescriptorUtils.getFqName(classDescriptor).toSafe()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user