[SLC] cleanup 'equals' code
^KT-54051
This commit is contained in:
committed by
Space Team
parent
2329bd1fe7
commit
fe1647096f
+2
-6
@@ -160,15 +160,11 @@ abstract class SymbolLightClassForClassLike<SType : KtClassOrObjectSymbol> prote
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is SymbolLightClassForClassLike<*> || other.ktModule != ktModule || other.manager != manager) return false
|
||||
if (classOrObjectDeclaration != null) {
|
||||
if (classOrObjectDeclaration != null || other.classOrObjectDeclaration != null) {
|
||||
return other.classOrObjectDeclaration == classOrObjectDeclaration
|
||||
}
|
||||
|
||||
return other.classOrObjectDeclaration == null && compareSymbolPointers(
|
||||
ktModule,
|
||||
classOrObjectSymbolPointer,
|
||||
other.classOrObjectSymbolPointer,
|
||||
)
|
||||
return compareSymbolPointers(ktModule, classOrObjectSymbolPointer, other.classOrObjectSymbolPointer)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = classOrObjectDeclaration.hashCode()
|
||||
|
||||
+2
-3
@@ -87,12 +87,11 @@ internal class SymbolLightFieldForObject private constructor(
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is SymbolLightFieldForObject || other.ktModule != ktModule) return false
|
||||
if (kotlinOrigin != null) {
|
||||
if (kotlinOrigin != null || other.kotlinOrigin != null) {
|
||||
return other.kotlinOrigin == kotlinOrigin
|
||||
}
|
||||
|
||||
return other.kotlinOrigin == null &&
|
||||
other.containingClass == containingClass &&
|
||||
return other.containingClass == containingClass &&
|
||||
compareSymbolPointers(ktModule, other.objectSymbolPointer, objectSymbolPointer)
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -170,12 +170,11 @@ internal class SymbolLightFieldForProperty private constructor(
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is SymbolLightFieldForProperty || other.ktModule != ktModule || other.fieldName != fieldName) return false
|
||||
if (kotlinOrigin != null) {
|
||||
if (kotlinOrigin != null || other.kotlinOrigin != null) {
|
||||
return kotlinOrigin == other.kotlinOrigin
|
||||
}
|
||||
|
||||
return other.kotlinOrigin == null &&
|
||||
containingClass == other.containingClass &&
|
||||
return containingClass == other.containingClass &&
|
||||
compareSymbolPointers(ktModule, propertySymbolPointer, other.propertySymbolPointer)
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -132,12 +132,11 @@ internal abstract class SymbolLightMethod<FType : KtFunctionLikeSymbol> private
|
||||
other.argumentsSkipMask != argumentsSkipMask
|
||||
) return false
|
||||
|
||||
if (functionDeclaration != null) {
|
||||
if (functionDeclaration != null || other.functionDeclaration != null) {
|
||||
return functionDeclaration == other.functionDeclaration
|
||||
}
|
||||
|
||||
return other.functionDeclaration == null &&
|
||||
containingClass == other.containingClass &&
|
||||
return containingClass == other.containingClass &&
|
||||
compareSymbolPointers(ktModule, functionSymbolPointer, other.functionSymbolPointer)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -92,11 +92,11 @@ internal abstract class SymbolLightParameterCommon(
|
||||
if (this === other) return true
|
||||
if (other !is SymbolLightParameterCommon || other.ktModule != ktModule) return false
|
||||
|
||||
if (parameterDeclaration != null) {
|
||||
if (parameterDeclaration != null || other.parameterDeclaration != null) {
|
||||
return parameterDeclaration == other.parameterDeclaration
|
||||
}
|
||||
|
||||
return other.parameterDeclaration == null && compareSymbolPointers(ktModule, parameterSymbolPointer, other.parameterSymbolPointer)
|
||||
return compareSymbolPointers(ktModule, parameterSymbolPointer, other.parameterSymbolPointer)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = parameterDeclaration?.hashCode() ?: _name.hashCode()
|
||||
|
||||
+2
-3
@@ -176,12 +176,11 @@ internal class SymbolLightTypeParameter private constructor(
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is SymbolLightTypeParameter || other.ktModule != ktModule || other.index != index) return false
|
||||
if (typeParameterDeclaration != null) {
|
||||
if (typeParameterDeclaration != null || other.typeParameterDeclaration != null) {
|
||||
return other.typeParameterDeclaration == typeParameterDeclaration
|
||||
}
|
||||
|
||||
return other.typeParameterDeclaration == null &&
|
||||
other.kotlinOrigin == kotlinOrigin &&
|
||||
return other.kotlinOrigin == kotlinOrigin &&
|
||||
compareSymbolPointers(ktModule, typeParameterSymbolPointer, other.typeParameterSymbolPointer) &&
|
||||
other.parent == parent
|
||||
}
|
||||
|
||||
+2
-4
@@ -61,13 +61,11 @@ internal class SymbolLightTypeParameterList(
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is SymbolLightTypeParameterList || other.ktModule != ktModule) return false
|
||||
if (ktDeclaration != null) {
|
||||
if (ktDeclaration != null || other.ktDeclaration != null) {
|
||||
return other.ktDeclaration == ktDeclaration
|
||||
}
|
||||
|
||||
return other.ktDeclaration == null &&
|
||||
compareSymbolPointers(ktModule, symbolWithTypeParameterPointer, other.symbolWithTypeParameterPointer) &&
|
||||
other.owner == owner
|
||||
return other.owner == owner && compareSymbolPointers(ktModule, symbolWithTypeParameterPointer, other.symbolWithTypeParameterPointer)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = ktDeclaration.hashCode() + 1
|
||||
|
||||
Reference in New Issue
Block a user