[psi] don't decompile to detect invalid code
in compiled code no error elements are possible Merge-request: KT-MR-10407 Merged-by: Anna Kozlova <Anna.Kozlova@jetbrains.com>
This commit is contained in:
@@ -154,10 +154,18 @@ public class KtParameter extends KtNamedDeclarationStub<KotlinParameterStub> imp
|
||||
private <T extends PsiElement> boolean checkParentOfParentType(Class<T> klass) {
|
||||
// `parent` is supposed to be [KtParameterList]
|
||||
PsiElement parent = getParent();
|
||||
if (parent == null || parent.getNextSibling() instanceof PsiErrorElement) {
|
||||
if (parent == null) {
|
||||
return false;
|
||||
}
|
||||
return klass.isInstance(parent.getParent());
|
||||
if (klass.isInstance(parent.getParent())) {
|
||||
//don't check ast if the tree structure is different; skip for compiled code
|
||||
if (!getContainingKtFile().isCompiled() &&
|
||||
parent.getNextSibling() instanceof PsiErrorElement) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isCatchParameter() {
|
||||
|
||||
Reference in New Issue
Block a user