Move: Fix exception on moving top-level declaration from/to script file
#KT-20260 Fixed
This commit is contained in:
@@ -578,4 +578,13 @@ fun KtNamedDeclaration.safeFqNameForLazyResolve(): FqName? {
|
||||
//NOTE: should only create special names for package level declarations, so we can safely rely on real fq name for parent
|
||||
val parentFqName = KtNamedDeclarationUtil.getParentFqName(this)
|
||||
return parentFqName?.child(safeNameForLazyResolve())
|
||||
}
|
||||
|
||||
fun isTopLevelInFileOrScript(element: PsiElement): Boolean {
|
||||
val parent = element.parent
|
||||
return when (parent) {
|
||||
is KtFile -> true
|
||||
is KtBlockExpression -> parent.parent is KtScript
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user