[DLC] add missing visitor methods
Some of our light classes have no correct parent (KT-56882), so I temporarily disabled AbstractSymbolLightClassesParentingTestBase for such cases (previously decompiled light classes were not tested at all) ^KT-56613 ^KT-56882
This commit is contained in:
committed by
Space Team
parent
0bd193ccba
commit
95455c9870
+11
-1
@@ -5,8 +5,10 @@
|
||||
|
||||
package org.jetbrains.kotlin.analysis.decompiled.light.classes
|
||||
|
||||
import com.intellij.psi.JavaElementVisitor
|
||||
import com.intellij.psi.PsiClass
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiElementVisitor
|
||||
import org.jetbrains.kotlin.asJava.classes.KtExtensibleLightClass
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightElementBase
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
@@ -15,4 +17,12 @@ abstract class KtLightClassForDecompiledDeclarationBase(
|
||||
val clsDelegate: PsiClass,
|
||||
clsParent: PsiElement,
|
||||
final override val kotlinOrigin: KtClassOrObject?
|
||||
) : KtLightElementBase(clsParent), PsiClass, KtExtensibleLightClass
|
||||
) : KtLightElementBase(clsParent), PsiClass, KtExtensibleLightClass {
|
||||
override fun accept(visitor: PsiElementVisitor) {
|
||||
if (visitor is JavaElementVisitor) {
|
||||
visitor.visitClass(this)
|
||||
} else {
|
||||
visitor.visitElement(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-1
@@ -34,4 +34,12 @@ internal class KtLightEnumClassForDecompiledDeclaration(
|
||||
|
||||
override fun equals(other: Any?): Boolean = this === other || other is KtLightEnumClassForDecompiledDeclaration && super.equals(other)
|
||||
override fun hashCode(): Int = super.hashCode()
|
||||
}
|
||||
|
||||
override fun accept(visitor: PsiElementVisitor) {
|
||||
if (visitor is JavaElementVisitor) {
|
||||
visitor.visitEnumConstantInitializer(this)
|
||||
} else {
|
||||
visitor.visitElement(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-1
@@ -44,4 +44,12 @@ internal class KtLightEnumEntryForDecompiledDeclaration(
|
||||
fldDelegate == other.fldDelegate
|
||||
|
||||
override fun hashCode(): Int = super.hashCode()
|
||||
}
|
||||
|
||||
override fun accept(visitor: PsiElementVisitor) {
|
||||
if (visitor is JavaElementVisitor) {
|
||||
visitor.visitEnumConstant(this)
|
||||
} else {
|
||||
visitor.visitElement(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-1
@@ -77,4 +77,12 @@ open class KtLightFieldForDecompiledDeclaration(
|
||||
another is KtLightFieldForDecompiledDeclaration && fldDelegate.isEquivalentTo(another.fldDelegate) ||
|
||||
fldDelegate.isEquivalentTo(another)
|
||||
}
|
||||
}
|
||||
|
||||
override fun accept(visitor: PsiElementVisitor) {
|
||||
if (visitor is JavaElementVisitor) {
|
||||
visitor.visitField(this)
|
||||
} else {
|
||||
visitor.visitElement(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-1
@@ -109,10 +109,18 @@ class KtLightMethodForDecompiledDeclaration(
|
||||
another is KtLightMethodForDecompiledDeclaration && funDelegate.isEquivalentTo(another.funDelegate) ||
|
||||
funDelegate.isEquivalentTo(another)
|
||||
}
|
||||
|
||||
override fun accept(visitor: PsiElementVisitor) {
|
||||
if (visitor is JavaElementVisitor) {
|
||||
visitor.visitMethod(this)
|
||||
} else {
|
||||
visitor.visitElement(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun KtLightMethod.checkIsMangled(): Boolean {
|
||||
val demangledName = demangleInternalName(name) ?: return false
|
||||
val originalName = propertyNameByAccessor(demangledName, this) ?: demangledName
|
||||
return originalName == kotlinOrigin?.name
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user