Skip to content

Commit

Permalink
fill up implementations for expect/actuals
Browse files Browse the repository at this point in the history
  • Loading branch information
neetopia committed Sep 13, 2023
1 parent b25a6da commit c277f4f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,6 @@ class KSClassDeclarationEnumEntryImpl private constructor(private val ktEnumEntr

override val annotations: Sequence<KSAnnotation> = emptySequence()

override val isActual: Boolean
get() = TODO("Not yet implemented")

override val isExpect: Boolean
get() = TODO("Not yet implemented")

override fun findActuals(): Sequence<KSDeclaration> {
TODO("Not yet implemented")
}

override fun findExpects(): Sequence<KSDeclaration> {
TODO("Not yet implemented")
}

override val declarations: Sequence<KSDeclaration> by lazy {
// TODO: fix after .getDeclaredMemberScope() works for enum entry with no initializer.
emptySequence()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,27 @@ package com.google.devtools.ksp.impl.symbol.kotlin
import com.google.devtools.ksp.symbol.KSDeclaration
import com.google.devtools.ksp.symbol.KSExpectActual
import org.jetbrains.kotlin.analysis.api.symbols.KtDeclarationSymbol
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtPossibleMultiplatformSymbol

class KSExpectActualImpl(private val declarationSymbol: KtDeclarationSymbol) : KSExpectActual {
override val isActual: Boolean
get() = TODO("Not yet implemented")
get() = (declarationSymbol as? KtPossibleMultiplatformSymbol)?.isActual == true

override val isExpect: Boolean
get() = TODO("Not yet implemented")
get() = (declarationSymbol as? KtPossibleMultiplatformSymbol)?.isExpect == true

// TODO: not possible in new KMP model, returning empty sequence for now.
override fun findActuals(): Sequence<KSDeclaration> {
TODO("Not yet implemented")
return emptySequence()
}

override fun findExpects(): Sequence<KSDeclaration> {
TODO("Not yet implemented")
return if (!isActual) {
emptySequence()
} else {
analyze {
declarationSymbol.getExpectsForActual().mapNotNull { it.toKSDeclaration() }
}.asSequence()
}
}
}

0 comments on commit c277f4f

Please sign in to comment.