[cls] save parameter name for functional types in stub

to make it available for deserialized Fir
This commit is contained in:
Anna Kozlova
2023-04-18 19:17:45 +02:00
committed by teamcity
parent d59d66e876
commit a41f7dc25d
9 changed files with 111 additions and 21 deletions
@@ -23,12 +23,12 @@ object KotlinStubVersions {
// Though only kotlin declarations (no code in the bodies) are stubbed, please do increase this version
// if you are not 100% sure it can be avoided.
// Increasing this version will lead to reindexing of all kotlin source files on the first IDE startup with the new version.
const val SOURCE_STUB_VERSION = 152
const val SOURCE_STUB_VERSION = 153
// Binary stub version should be increased if stub format (org.jetbrains.kotlin.psi.stubs.impl) is changed
// or changes are made to the core stub building code (org.jetbrains.kotlin.idea.decompiler.stubBuilder).
// Increasing this version will lead to reindexing of all binary files that are potentially kotlin binaries (including all class files).
private const val BINARY_STUB_VERSION = 88
private const val BINARY_STUB_VERSION = 89
// Classfile stub version should be increased if changes are made to classfile stub building subsystem (org.jetbrains.kotlin.idea.decompiler.classFile)
// Increasing this version will lead to reindexing of all classfiles.
@@ -42,7 +42,7 @@ public class KtParameterElementType extends KtStubElementType<KotlinParameterStu
StringRef fqNameRef = StringRef.fromString(fqName != null ? fqName.asString() : null);
return new KotlinParameterStubImpl(
(StubElement<?>) parentStub, fqNameRef, StringRef.fromString(psi.getName()),
psi.isMutable(), psi.hasValOrVar(), psi.hasDefaultValue()
psi.isMutable(), psi.hasValOrVar(), psi.hasDefaultValue(), null
);
}
@@ -54,6 +54,7 @@ public class KtParameterElementType extends KtStubElementType<KotlinParameterStu
dataStream.writeBoolean(stub.hasDefaultValue());
FqName name = stub.getFqName();
dataStream.writeName(name != null ? name.asString() : null);
dataStream.writeName(stub instanceof KotlinParameterStubImpl ? ((KotlinParameterStubImpl) stub).getFunctionTypeParameterName() : null);
}
@NotNull
@@ -65,7 +66,8 @@ public class KtParameterElementType extends KtStubElementType<KotlinParameterStu
boolean hasDefaultValue = dataStream.readBoolean();
StringRef fqName = dataStream.readName();
return new KotlinParameterStubImpl((StubElement<?>) parentStub, fqName, name, isMutable, hasValOrValNode, hasDefaultValue);
return new KotlinParameterStubImpl((StubElement<?>) parentStub, fqName, name, isMutable, hasValOrValNode, hasDefaultValue,
dataStream.readNameString());
}
@Override
@@ -30,8 +30,10 @@ class KotlinParameterStubImpl(
private val name: StringRef?,
private val isMutable: Boolean,
private val hasValOrVar: Boolean,
private val hasDefaultValue: Boolean
private val hasDefaultValue: Boolean,
val functionTypeParameterName: String? = null
) : KotlinStubBaseImpl<KtParameter>(parent, KtStubElementTypes.VALUE_PARAMETER), KotlinParameterStub {
override fun getName(): String? {
return StringRef.toString(name)
}