[FIR] Do not get expressions from contract effect list in lazy mode
Eleventh step for ^KT-52615
This commit is contained in:
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.fir.builder
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.tree.IElementType
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import com.intellij.util.AstLoadingFilter
|
||||
import org.jetbrains.kotlin.*
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
@@ -1527,8 +1526,11 @@ open class RawFirBuilder(
|
||||
}
|
||||
|
||||
private fun KtContractEffectList.extractRawEffects(destination: MutableList<FirExpression>) {
|
||||
getExpressions()
|
||||
.mapTo(destination) { it.accept(this@Visitor, Unit) as FirExpression }
|
||||
getContractEffects().mapTo(destination) { effect ->
|
||||
buildOrLazyExpression(effect.toFirSourceElement()) {
|
||||
effect.getExpression().accept(this@Visitor, Unit) as FirExpression
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitLambdaExpression(expression: KtLambdaExpression, data: Unit): FirElement {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
FILE: functionWithBothOldAndNewSyntaxContractDescription.kt
|
||||
public? final? fun test1(s: String?): R|kotlin/Unit|
|
||||
[Contract description] <
|
||||
returnsNotNull#()
|
||||
LAZY_EXPRESSION
|
||||
>
|
||||
{ LAZY_BLOCK }
|
||||
|
||||
+5
-5
@@ -7,7 +7,7 @@ FILE: propertyAccessorsContractDescription.kt
|
||||
public? final? var myInt: Int = LAZY_EXPRESSION
|
||||
public? get(): Int
|
||||
[Contract description] <
|
||||
returnsNotNull#()
|
||||
LAZY_EXPRESSION
|
||||
>
|
||||
{ LAZY_BLOCK }
|
||||
public? set(value: Int): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@@ -21,12 +21,12 @@ FILE: propertyAccessorsContractDescription.kt
|
||||
public? final? var anotherInt: Int = LAZY_EXPRESSION
|
||||
public? get(): Int
|
||||
[Contract description] <
|
||||
returnsNotNull#()
|
||||
LAZY_EXPRESSION
|
||||
>
|
||||
{ LAZY_BLOCK }
|
||||
public? set(value: Int): R|kotlin/Unit|
|
||||
[Contract description] <
|
||||
returns#()
|
||||
LAZY_EXPRESSION
|
||||
>
|
||||
{ LAZY_BLOCK }
|
||||
|
||||
@@ -39,12 +39,12 @@ FILE: propertyAccessorsContractDescription.kt
|
||||
public? final? var someInt: Int = LAZY_EXPRESSION
|
||||
public? get(): Int
|
||||
[Contract description] <
|
||||
returnsNotNull#()
|
||||
LAZY_EXPRESSION
|
||||
>
|
||||
{ LAZY_BLOCK }
|
||||
public? set(value: Int): R|kotlin/Unit|
|
||||
[Contract description] <
|
||||
returns#().implies#(!=(value#, Null(null)))
|
||||
LAZY_EXPRESSION
|
||||
>
|
||||
{ LAZY_BLOCK }
|
||||
|
||||
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
FILE: simpleFunctionsContractDescription.kt
|
||||
public? final? fun test1(s: MyClass?): R|kotlin/Unit|
|
||||
[Contract description] <
|
||||
returns#().implies#(!=(s#, Null(null))),
|
||||
returns#().implies#((s# is MySubClass))
|
||||
LAZY_EXPRESSION,
|
||||
LAZY_EXPRESSION
|
||||
>
|
||||
{ LAZY_BLOCK }
|
||||
public? final? fun test2(): R|kotlin/Unit|
|
||||
[Contract description] <
|
||||
returnsNotNull#()
|
||||
LAZY_EXPRESSION
|
||||
>
|
||||
{ LAZY_BLOCK }
|
||||
|
||||
@@ -14,8 +14,5 @@ class KtContractEffectList : KtElementImplStub<KotlinPlaceHolderStub<KtContractE
|
||||
constructor(stub: KotlinPlaceHolderStub<KtContractEffectList>) : super(stub, KtStubElementTypes.CONTRACT_EFFECT_LIST)
|
||||
}
|
||||
|
||||
fun KtContractEffectList.getExpressions(): List<KtExpression> =
|
||||
fun KtContractEffectList.getContractEffects(): List<KtContractEffect> =
|
||||
getStubOrPsiChildrenAsList(KtStubElementTypes.CONTRACT_EFFECT)
|
||||
.map {
|
||||
it.getExpression()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user