[FIR] Remove unused utilities
This commit is contained in:
@@ -15,29 +15,12 @@ import org.jetbrains.kotlin.fir.declarations.impl.FirModifiableClass
|
|||||||
import org.jetbrains.kotlin.fir.declarations.modality
|
import org.jetbrains.kotlin.fir.declarations.modality
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirBlock
|
import org.jetbrains.kotlin.fir.expressions.FirBlock
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast
|
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpression
|
|
||||||
|
|
||||||
fun ModuleInfo.dependenciesWithoutSelf(): Sequence<ModuleInfo> = dependencies().asSequence().filter { it != this }
|
fun ModuleInfo.dependenciesWithoutSelf(): Sequence<ModuleInfo> = dependencies().asSequence().filter { it != this }
|
||||||
|
|
||||||
// TODO: rewrite
|
// TODO: rewrite
|
||||||
fun FirBlock.returnExpressions(): List<FirExpression> = listOfNotNull(statements.lastOrNull() as? FirExpression)
|
fun FirBlock.returnExpressions(): List<FirExpression> = listOfNotNull(statements.lastOrNull() as? FirExpression)
|
||||||
|
|
||||||
fun FirElement.unwrapWhenSubjectExpression(): FirElement = if (this is FirWhenSubjectExpression) {
|
|
||||||
val whenExpression = whenSubject.whenExpression
|
|
||||||
whenExpression.subjectVariable
|
|
||||||
?: whenExpression.subject
|
|
||||||
?: throw IllegalStateException("Subject or subject variable must be not null")
|
|
||||||
} else {
|
|
||||||
this
|
|
||||||
}
|
|
||||||
|
|
||||||
tailrec fun FirElement.unwrapSmartcast(): FirElement = if (this is FirExpressionWithSmartcast) {
|
|
||||||
originalExpression.unwrapSmartcast()
|
|
||||||
} else {
|
|
||||||
this
|
|
||||||
}
|
|
||||||
|
|
||||||
private val PUBLIC_METHOD_NAMES_IN_OBJECT = setOf("equals", "hashCode", "getClass", "wait", "notify", "notifyAll", "toString")
|
private val PUBLIC_METHOD_NAMES_IN_OBJECT = setOf("equals", "hashCode", "getClass", "wait", "notify", "notifyAll", "toString")
|
||||||
|
|
||||||
fun FirModifiableClass<FirRegularClass>.calculateSAM() {
|
fun FirModifiableClass<FirRegularClass>.calculateSAM() {
|
||||||
|
|||||||
Reference in New Issue
Block a user