FIC: support fun interfaces in stub builder
This commit is contained in:
@@ -28,7 +28,7 @@ object KotlinStubVersions {
|
||||
// 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 = 70
|
||||
private const val BINARY_STUB_VERSION = 71
|
||||
|
||||
// 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.
|
||||
|
||||
+4
-3
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.psi.stubs.elements;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.util.io.DataInputOutputUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.psi.KtModifierList;
|
||||
@@ -41,14 +42,14 @@ public class KtModifierListElementType<T extends KtModifierList> extends KtStubE
|
||||
|
||||
@Override
|
||||
public void serialize(@NotNull KotlinModifierListStub stub, @NotNull StubOutputStream dataStream) throws IOException {
|
||||
int mask = ((KotlinModifierListStubImpl) stub).getMask();
|
||||
dataStream.writeVarInt(mask);
|
||||
long mask = ((KotlinModifierListStubImpl) stub).getMask();
|
||||
DataInputOutputUtil.writeLONG(dataStream, mask);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public KotlinModifierListStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
int mask = dataStream.readVarInt();
|
||||
long mask = DataInputOutputUtil.readLONG(dataStream);
|
||||
return new KotlinModifierListStubImpl(parentStub, mask, this);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -25,14 +25,14 @@ import org.jetbrains.kotlin.psi.stubs.elements.KtModifierListElementType;
|
||||
|
||||
public class KotlinModifierListStubImpl extends KotlinStubBaseImpl<KtDeclarationModifierList> implements KotlinModifierListStub {
|
||||
|
||||
private final int mask;
|
||||
private final long mask;
|
||||
|
||||
public KotlinModifierListStubImpl(StubElement parent, int mask, @NotNull KtModifierListElementType<?> elementType) {
|
||||
public KotlinModifierListStubImpl(StubElement parent, long mask, @NotNull KtModifierListElementType<?> elementType) {
|
||||
super(parent, elementType);
|
||||
this.mask = mask;
|
||||
}
|
||||
|
||||
public int getMask() {
|
||||
public long getMask() {
|
||||
return mask;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,32 +23,32 @@ import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
|
||||
|
||||
object ModifierMaskUtils {
|
||||
init {
|
||||
assert(MODIFIER_KEYWORDS_ARRAY.size <= 32) { "Current implementation depends on the ability to represent modifier list as bit mask" }
|
||||
assert(MODIFIER_KEYWORDS_ARRAY.size <= 64) { "Current implementation depends on the ability to represent modifier list as bit mask" }
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun computeMaskFromModifierList(modifierList: KtModifierList): Int = computeMask { modifierList.hasModifier(it) }
|
||||
fun computeMaskFromModifierList(modifierList: KtModifierList): Long = computeMask { modifierList.hasModifier(it) }
|
||||
|
||||
@JvmStatic
|
||||
fun computeMask(hasModifier: (KtModifierKeywordToken) -> Boolean): Int {
|
||||
var mask = 0
|
||||
fun computeMask(hasModifier: (KtModifierKeywordToken) -> Boolean): Long {
|
||||
var mask = 0L
|
||||
for ((index, modifierKeywordToken) in MODIFIER_KEYWORDS_ARRAY.withIndex()) {
|
||||
if (hasModifier(modifierKeywordToken)) {
|
||||
mask = mask or (1 shl index)
|
||||
mask = mask or (1L shl index)
|
||||
}
|
||||
}
|
||||
return mask
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun maskHasModifier(mask: Int, modifierToken: KtModifierKeywordToken): Boolean {
|
||||
fun maskHasModifier(mask: Long, modifierToken: KtModifierKeywordToken): Boolean {
|
||||
val index = MODIFIER_KEYWORDS_ARRAY.indexOf(modifierToken)
|
||||
assert(index >= 0) { "All JetModifierKeywordTokens should be present in MODIFIER_KEYWORDS_ARRAY" }
|
||||
return (mask and (1 shl index)) != 0
|
||||
return (mask and (1L shl index)) != 0L
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun maskToString(mask: Int): String {
|
||||
fun maskToString(mask: Long): String {
|
||||
val sb = StringBuilder()
|
||||
sb.append("[")
|
||||
var first = true
|
||||
|
||||
Reference in New Issue
Block a user