Make getContainingFile return null if it isn't JetFile
This commit is contained in:
@@ -18,6 +18,7 @@ package org.jetbrains.jet.lang.resolve;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
|
import com.intellij.psi.PsiFile;
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
import com.intellij.psi.util.PsiTreeUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -122,7 +123,9 @@ public class BindingContextUtils {
|
|||||||
PsiElement declaration = descriptorToDeclaration(context, descriptor);
|
PsiElement declaration = descriptorToDeclaration(context, descriptor);
|
||||||
if (declaration == null) return null;
|
if (declaration == null) return null;
|
||||||
|
|
||||||
return (JetFile) declaration.getContainingFile();
|
PsiFile containingFile = declaration.getContainingFile();
|
||||||
|
if (!(containingFile instanceof JetFile)) return null;
|
||||||
|
return (JetFile) containingFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO these helper methods are added as a workaround to some compiler bugs in Kotlin...
|
// TODO these helper methods are added as a workaround to some compiler bugs in Kotlin...
|
||||||
|
|||||||
Reference in New Issue
Block a user