Remove NameResolver#getFqName, replace with getClassId
This commit is contained in:
@@ -157,7 +157,7 @@ class LazyOperationsLog(
|
|||||||
val context = typeDeserializer.field<DeserializationContext>("c")
|
val context = typeDeserializer.field<DeserializationContext>("c")
|
||||||
val typeProto = o.field<ProtoBuf.Type>("typeProto")
|
val typeProto = o.field<ProtoBuf.Type>("typeProto")
|
||||||
val text = when {
|
val text = when {
|
||||||
typeProto.hasClassName() -> context.nameResolver.getFqName(typeProto.className).asString()
|
typeProto.hasClassName() -> context.nameResolver.getClassId(typeProto.className).asSingleFqName().asString()
|
||||||
typeProto.hasTypeParameter() -> {
|
typeProto.hasTypeParameter() -> {
|
||||||
val classifier = (o as JetType).constructor.declarationDescriptor!!
|
val classifier = (o as JetType).constructor.declarationDescriptor!!
|
||||||
"" + classifier.name + " in " + DescriptorUtils.getFqName(classifier.containingDeclaration)
|
"" + classifier.name + " in " + DescriptorUtils.getFqName(classifier.containingDeclaration)
|
||||||
|
|||||||
-4
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.serialization.deserialization;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.name.ClassId;
|
import org.jetbrains.kotlin.name.ClassId;
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
|
|
||||||
public interface NameResolver {
|
public interface NameResolver {
|
||||||
@@ -30,7 +29,4 @@ public interface NameResolver {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
ClassId getClassId(int index);
|
ClassId getClassId(int index);
|
||||||
|
|
||||||
@NotNull
|
|
||||||
FqName getFqName(int index);
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-12
@@ -45,7 +45,7 @@ public class NameResolverImpl implements NameResolver {
|
|||||||
private final ProtoBuf.StringTable strings;
|
private final ProtoBuf.StringTable strings;
|
||||||
private final ProtoBuf.QualifiedNameTable qualifiedNames;
|
private final ProtoBuf.QualifiedNameTable qualifiedNames;
|
||||||
|
|
||||||
public NameResolverImpl(
|
private NameResolverImpl(
|
||||||
@NotNull ProtoBuf.StringTable strings,
|
@NotNull ProtoBuf.StringTable strings,
|
||||||
@NotNull ProtoBuf.QualifiedNameTable qualifiedNames
|
@NotNull ProtoBuf.QualifiedNameTable qualifiedNames
|
||||||
) {
|
) {
|
||||||
@@ -93,15 +93,4 @@ public class NameResolverImpl implements NameResolver {
|
|||||||
|
|
||||||
return new ClassId(FqName.fromSegments(packageFqName), FqName.fromSegments(relativeClassName), local);
|
return new ClassId(FqName.fromSegments(packageFqName), FqName.fromSegments(relativeClassName), local);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@NotNull
|
|
||||||
public FqName getFqName(int index) {
|
|
||||||
QualifiedName qualifiedName = qualifiedNames.getQualifiedName(index);
|
|
||||||
Name shortName = getName(qualifiedName.getShortName());
|
|
||||||
if (!qualifiedName.hasParentQualifiedName()) {
|
|
||||||
return FqName.topLevel(shortName);
|
|
||||||
}
|
|
||||||
return getFqName(qualifiedName.getParentQualifiedName()).child(shortName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ class GenerateProtoBufCompare {
|
|||||||
private val RESULT_NAME = "result"
|
private val RESULT_NAME = "result"
|
||||||
private val STRING_INDEXES_NANE = "StringIndexes"
|
private val STRING_INDEXES_NANE = "StringIndexes"
|
||||||
private val CLASS_ID_INDEXES_NANE = "ClassIdIndexes"
|
private val CLASS_ID_INDEXES_NANE = "ClassIdIndexes"
|
||||||
private val FQ_NAME_INDEXES_NANE = "FqNameIndexes"
|
|
||||||
private val OLD_PREFIX = "old"
|
private val OLD_PREFIX = "old"
|
||||||
private val NEW_PREFIX = "new"
|
private val NEW_PREFIX = "new"
|
||||||
private val CHECK_EQAULS_NAME = "checkEquals"
|
private val CHECK_EQAULS_NAME = "checkEquals"
|
||||||
@@ -75,7 +74,6 @@ class GenerateProtoBufCompare {
|
|||||||
p.println()
|
p.println()
|
||||||
|
|
||||||
p.println("import org.jetbrains.kotlin.name.ClassId")
|
p.println("import org.jetbrains.kotlin.name.ClassId")
|
||||||
p.println("import org.jetbrains.kotlin.name.FqName")
|
|
||||||
p.println("import org.jetbrains.kotlin.serialization.ProtoBuf")
|
p.println("import org.jetbrains.kotlin.serialization.ProtoBuf")
|
||||||
p.println("import org.jetbrains.kotlin.serialization.deserialization.NameResolver")
|
p.println("import org.jetbrains.kotlin.serialization.deserialization.NameResolver")
|
||||||
p.println("import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf")
|
p.println("import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf")
|
||||||
@@ -95,9 +93,7 @@ class GenerateProtoBufCompare {
|
|||||||
p.println("public val $NEW_PREFIX${CLASS_ID_INDEXES_NANE}Map: MutableMap<Int, Int> = hashMapOf()")
|
p.println("public val $NEW_PREFIX${CLASS_ID_INDEXES_NANE}Map: MutableMap<Int, Int> = hashMapOf()")
|
||||||
|
|
||||||
p.println()
|
p.println()
|
||||||
p.println("private val fqNames = Interner<FqName>()")
|
|
||||||
p.println("private val classIds = Interner<ClassId>()")
|
p.println("private val classIds = Interner<ClassId>()")
|
||||||
p.println()
|
|
||||||
|
|
||||||
val fileDescriptor = DebugProtoBuf.getDescriptor()
|
val fileDescriptor = DebugProtoBuf.getDescriptor()
|
||||||
|
|
||||||
@@ -150,9 +146,7 @@ class GenerateProtoBufCompare {
|
|||||||
p.println("public fun getIndexOfClassId(index: Int, map: MutableMap<Int, Int>, nameResolver: NameResolver): Int {")
|
p.println("public fun getIndexOfClassId(index: Int, map: MutableMap<Int, Int>, nameResolver: NameResolver): Int {")
|
||||||
p.println(" map[index]?.let { return it }")
|
p.println(" map[index]?.let { return it }")
|
||||||
p.println()
|
p.println()
|
||||||
// TODO fqNames -> classIds
|
p.println(" val result = classIds.intern(nameResolver.getClassId(index))")
|
||||||
p.println(" val result = fqNames.intern(nameResolver.getFqName(index))")
|
|
||||||
//p.println(" val result = classIds.intern(nameResolver.getClassId(index))")
|
|
||||||
p.println(" map[index] = result")
|
p.println(" map[index] = result")
|
||||||
p.println(" return result")
|
p.println(" return result")
|
||||||
p.println("}")
|
p.println("}")
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package org.jetbrains.kotlin.jps.incremental
|
package org.jetbrains.kotlin.jps.incremental
|
||||||
|
|
||||||
import org.jetbrains.kotlin.name.ClassId
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
import org.jetbrains.kotlin.name.FqName
|
|
||||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
|
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
|
||||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf
|
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf
|
||||||
@@ -33,10 +32,8 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
public val oldClassIdIndexesMap: MutableMap<Int, Int> = hashMapOf()
|
public val oldClassIdIndexesMap: MutableMap<Int, Int> = hashMapOf()
|
||||||
public val newClassIdIndexesMap: MutableMap<Int, Int> = hashMapOf()
|
public val newClassIdIndexesMap: MutableMap<Int, Int> = hashMapOf()
|
||||||
|
|
||||||
private val fqNames = Interner<FqName>()
|
|
||||||
private val classIds = Interner<ClassId>()
|
private val classIds = Interner<ClassId>()
|
||||||
|
|
||||||
|
|
||||||
open fun checkEquals(old: ProtoBuf.Package, new: ProtoBuf.Package): Boolean {
|
open fun checkEquals(old: ProtoBuf.Package, new: ProtoBuf.Package): Boolean {
|
||||||
if (!checkEqualsPackageMember(old, new)) return false
|
if (!checkEqualsPackageMember(old, new)) return false
|
||||||
|
|
||||||
@@ -556,7 +553,7 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
public fun getIndexOfClassId(index: Int, map: MutableMap<Int, Int>, nameResolver: NameResolver): Int {
|
public fun getIndexOfClassId(index: Int, map: MutableMap<Int, Int>, nameResolver: NameResolver): Int {
|
||||||
map[index]?.let { return it }
|
map[index]?.let { return it }
|
||||||
|
|
||||||
val result = fqNames.intern(nameResolver.getFqName(index))
|
val result = classIds.intern(nameResolver.getClassId(index))
|
||||||
map[index] = result
|
map[index] = result
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user