[psi] decompiled code doesn't have function bodies
otherwise AST for decompiled code would be loaded by findChildByClass call ^ KTIJ-25047
This commit is contained in:
@@ -23,10 +23,8 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiModifiableCodeBlock;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.AstLoadingFilter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.KtNodeTypes;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinFunctionStub;
|
||||
@@ -142,8 +140,14 @@ public class KtNamedFunction extends KtTypeParameterListOwnerStub<KotlinFunction
|
||||
@Override
|
||||
public KtBlockExpression getBodyBlockExpression() {
|
||||
KotlinFunctionStub stub = getStub();
|
||||
if (stub != null && !(stub.hasBlockBody() && stub.hasBody())) {
|
||||
return null;
|
||||
if (stub != null) {
|
||||
if (!(stub.hasBlockBody() && stub.hasBody())) {
|
||||
return null;
|
||||
}
|
||||
if (getContainingKtFile().isCompiled()) {
|
||||
//don't load ast
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
KtExpression bodyExpression = findChildByClass(KtExpression.class);
|
||||
|
||||
@@ -106,8 +106,13 @@ public class KtPropertyAccessor extends KtDeclarationStub<KotlinPropertyAccessor
|
||||
@Override
|
||||
public KtBlockExpression getBodyBlockExpression() {
|
||||
KotlinPropertyAccessorStub stub = getStub();
|
||||
if (stub != null && !(stub.hasBlockBody() && stub.hasBody())) {
|
||||
return null;
|
||||
if (stub != null) {
|
||||
if (!(stub.hasBlockBody() && stub.hasBody())) {
|
||||
return null;
|
||||
}
|
||||
if (getContainingKtFile().isCompiled()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
KtExpression bodyExpression = findChildByClass(KtExpression.class);
|
||||
|
||||
@@ -30,8 +30,14 @@ class KtSecondaryConstructor : KtConstructor<KtSecondaryConstructor> {
|
||||
override fun getContainingClassOrObject() = parent.parent as KtClassOrObject
|
||||
|
||||
override fun getBodyExpression(): KtBlockExpression? {
|
||||
if (stub?.hasBody() == false) {
|
||||
return null
|
||||
val stub = stub
|
||||
if (stub != null) {
|
||||
if (stub.hasBody() == false) {
|
||||
return null
|
||||
}
|
||||
if (containingKtFile.isCompiled) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
return findChildByClass(KtBlockExpression::class.java)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user