[cls] include generated equals/hashCode/toString method in stubs
to avoid heavy computation of super functions
This commit is contained in:
Vendored
+31
@@ -54,6 +54,21 @@ PsiJetFileStubImpl[package=a.b.c]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=kotlin]
|
REFERENCE_EXPRESSION[referencedName=kotlin]
|
||||||
REFERENCE_EXPRESSION[referencedName=String]
|
REFERENCE_EXPRESSION[referencedName=String]
|
||||||
|
FUN[fqName=a.b.c.DataClass.equals, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=equals]
|
||||||
|
MODIFIER_LIST[open public operator]
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other]
|
||||||
|
TYPE_REFERENCE
|
||||||
|
NULLABLE_TYPE
|
||||||
|
USER_TYPE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION[referencedName=kotlin]
|
||||||
|
REFERENCE_EXPRESSION[referencedName=Any]
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION[referencedName=kotlin]
|
||||||
|
REFERENCE_EXPRESSION[referencedName=Boolean]
|
||||||
FUN[fqName=a.b.c.DataClass.f, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=f]
|
FUN[fqName=a.b.c.DataClass.f, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=f]
|
||||||
MODIFIER_LIST[public final]
|
MODIFIER_LIST[public final]
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
@@ -62,3 +77,19 @@ PsiJetFileStubImpl[package=a.b.c]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=kotlin]
|
REFERENCE_EXPRESSION[referencedName=kotlin]
|
||||||
REFERENCE_EXPRESSION[referencedName=Int]
|
REFERENCE_EXPRESSION[referencedName=Int]
|
||||||
|
FUN[fqName=a.b.c.DataClass.hashCode, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=hashCode]
|
||||||
|
MODIFIER_LIST[open public]
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION[referencedName=kotlin]
|
||||||
|
REFERENCE_EXPRESSION[referencedName=Int]
|
||||||
|
FUN[fqName=a.b.c.DataClass.toString, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=toString]
|
||||||
|
MODIFIER_LIST[open public]
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION[referencedName=kotlin]
|
||||||
|
REFERENCE_EXPRESSION[referencedName=String]
|
||||||
|
|||||||
Vendored
+16
@@ -94,6 +94,14 @@ PsiJetFileStubImpl[package=test]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=kotlin]
|
REFERENCE_EXPRESSION[referencedName=kotlin]
|
||||||
REFERENCE_EXPRESSION[referencedName=Unit]
|
REFERENCE_EXPRESSION[referencedName=Unit]
|
||||||
|
FUN[fqName=test.Modifiers.hashCode, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=hashCode]
|
||||||
|
MODIFIER_LIST[open public]
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION[referencedName=kotlin]
|
||||||
|
REFERENCE_EXPRESSION[referencedName=Int]
|
||||||
FUN[fqName=test.Modifiers.inlined, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=inlined]
|
FUN[fqName=test.Modifiers.inlined, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=inlined]
|
||||||
MODIFIER_LIST[public final inline]
|
MODIFIER_LIST[public final inline]
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
@@ -165,6 +173,14 @@ PsiJetFileStubImpl[package=test]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=kotlin]
|
REFERENCE_EXPRESSION[referencedName=kotlin]
|
||||||
REFERENCE_EXPRESSION[referencedName=Unit]
|
REFERENCE_EXPRESSION[referencedName=Unit]
|
||||||
|
FUN[fqName=test.Modifiers.toString, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=toString]
|
||||||
|
MODIFIER_LIST[open public]
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION[referencedName=kotlin]
|
||||||
|
REFERENCE_EXPRESSION[referencedName=String]
|
||||||
CLASS[classId=test/Modifiers.Ann, fqName=test.Modifiers.Ann, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=false, name=Ann, superNames=[Annotation]]
|
CLASS[classId=test/Modifiers.Ann, fqName=test.Modifiers.Ann, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=false, name=Ann, superNames=[Annotation]]
|
||||||
MODIFIER_LIST[public final annotation]
|
MODIFIER_LIST[public final annotation]
|
||||||
PRIMARY_CONSTRUCTOR[fqName=null, hasBody=false, isDelegatedCallToThis=false, isExtension=false, isTopLevel=false, name=Ann]
|
PRIMARY_CONSTRUCTOR[fqName=null, hasBody=false, isDelegatedCallToThis=false, isExtension=false, isTopLevel=false, name=Ann]
|
||||||
|
|||||||
+6
-1
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils.isEnumEntry
|
|||||||
import org.jetbrains.kotlin.resolve.constants.*
|
import org.jetbrains.kotlin.resolve.constants.*
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.secondaryConstructors
|
import org.jetbrains.kotlin.resolve.descriptorUtil.secondaryConstructors
|
||||||
import org.jetbrains.kotlin.types.isFlexible
|
import org.jetbrains.kotlin.types.isFlexible
|
||||||
|
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
|
|
||||||
private const val DECOMPILED_CODE_COMMENT = "/* compiled code */"
|
private const val DECOMPILED_CODE_COMMENT = "/* compiled code */"
|
||||||
@@ -52,7 +53,11 @@ internal fun CallableMemberDescriptor.mustNotBeWrittenToDecompiledText(): Boolea
|
|||||||
|
|
||||||
CallableMemberDescriptor.Kind.SYNTHESIZED -> {
|
CallableMemberDescriptor.Kind.SYNTHESIZED -> {
|
||||||
// Of all synthesized functions, only `component*` functions are rendered (for historical reasons)
|
// Of all synthesized functions, only `component*` functions are rendered (for historical reasons)
|
||||||
!DataClassDescriptorResolver.isComponentLike(name)
|
!DataClassDescriptorResolver.isComponentLike(name) && name !in listOf(
|
||||||
|
OperatorNameConventions.EQUALS,
|
||||||
|
StandardNames.HASHCODE_NAME,
|
||||||
|
OperatorNameConventions.TO_STRING
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-1
@@ -7,6 +7,7 @@ import com.intellij.psi.stubs.StubElement
|
|||||||
import com.intellij.util.io.StringRef
|
import com.intellij.util.io.StringRef
|
||||||
import org.jetbrains.kotlin.analysis.decompiler.stub.flags.*
|
import org.jetbrains.kotlin.analysis.decompiler.stub.flags.*
|
||||||
import org.jetbrains.kotlin.constant.ConstantValue
|
import org.jetbrains.kotlin.constant.ConstantValue
|
||||||
|
import org.jetbrains.kotlin.builtins.StandardNames
|
||||||
import org.jetbrains.kotlin.descriptors.SourceElement
|
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
||||||
import org.jetbrains.kotlin.load.kotlin.*
|
import org.jetbrains.kotlin.load.kotlin.*
|
||||||
@@ -27,6 +28,8 @@ import org.jetbrains.kotlin.resolve.constants.ClassLiteralValue
|
|||||||
import org.jetbrains.kotlin.serialization.deserialization.AnnotatedCallableKind
|
import org.jetbrains.kotlin.serialization.deserialization.AnnotatedCallableKind
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.ProtoContainer
|
import org.jetbrains.kotlin.serialization.deserialization.ProtoContainer
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.getName
|
import org.jetbrains.kotlin.serialization.deserialization.getName
|
||||||
|
import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
||||||
|
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
||||||
|
|
||||||
@@ -85,7 +88,11 @@ private fun shouldSkip(flags: Int, name: Name): Boolean {
|
|||||||
return when (Flags.MEMBER_KIND.get(flags)) {
|
return when (Flags.MEMBER_KIND.get(flags)) {
|
||||||
MemberKind.FAKE_OVERRIDE, MemberKind.DELEGATION -> true
|
MemberKind.FAKE_OVERRIDE, MemberKind.DELEGATION -> true
|
||||||
//TODO: fix decompiler to use sane criteria
|
//TODO: fix decompiler to use sane criteria
|
||||||
MemberKind.SYNTHESIZED -> !DataClassResolver.isComponentLike(name)
|
MemberKind.SYNTHESIZED -> !DataClassResolver.isComponentLike(name) && name !in listOf(
|
||||||
|
OperatorNameConventions.EQUALS,
|
||||||
|
StandardNames.HASHCODE_NAME,
|
||||||
|
OperatorNameConventions.TO_STRING
|
||||||
|
)
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user