Move: Retain imports when moving top-level declaration

#KT-5049 Fixed
This commit is contained in:
Alexey Sedunov
2014-05-27 14:51:08 +04:00
parent df413c0b47
commit ab5e0c8c9c
21 changed files with 210 additions and 16 deletions
@@ -68,9 +68,9 @@ public fun FqName.plusOneSegment(fullFQN: FqName): FqName? {
return child(fullFQN.tail(this).pathSegments().first!!)
}
public fun FqName.isImported(importPath: ImportPath): Boolean {
public fun FqName.isImported(importPath: ImportPath, skipAliasedImports: Boolean = true): Boolean {
return when {
importPath.hasAlias() -> false
skipAliasedImports && importPath.hasAlias() -> false
importPath.isAllUnder() && !isRoot() -> importPath.fqnPart() == this.parent()
else -> importPath.fqnPart() == this
}