add isKotlinSourceElement method to Source interface in order to recognize kotlin source elements during compilation
This commit is contained in:
+2
@@ -24,6 +24,8 @@ import org.jetbrains.kotlin.load.java.sources.JavaSourceElementFactory
|
||||
import org.jetbrains.kotlin.load.java.sources.JavaSourceElement
|
||||
|
||||
private class JavaSourceElementImpl(override val javaElement: JavaElement) : PsiSourceElement, JavaSourceElement {
|
||||
override fun isKotlinSourceElement(): Boolean = false
|
||||
|
||||
override val psi: PsiElement?
|
||||
get() = (javaElement as JavaElementImpl<*>).getPsi()
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ import org.jetbrains.kotlin.psi.JetElement
|
||||
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||
import com.intellij.psi.PsiElement
|
||||
|
||||
public class KotlinSourceElement(override val psi: JetElement) : PsiSourceElement
|
||||
public class KotlinSourceElement(override val psi: JetElement) : PsiSourceElement {
|
||||
override fun isKotlinSourceElement(): Boolean = true
|
||||
}
|
||||
|
||||
public fun JetElement?.toSourceElement(): SourceElement = if (this == null) SourceElement.NO_SOURCE else KotlinSourceElement(this)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user