Skip to content

Commit

Permalink
optimize tostring
Browse files Browse the repository at this point in the history
  • Loading branch information
tangzx committed Aug 24, 2017
1 parent e392b38 commit 482c87a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/com/tang/intellij/lua/ty/Ty.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,16 @@ abstract class Ty(override val kind: TyKind) : ITy {

override fun toString(): String {
val list = mutableListOf<String>()
TyUnion.each(this) {
if (!it.isAnonymous)
TyUnion.each(this) { //尽量不使用Global
if (!it.isAnonymous && !(it is ITyClass && it.hasFlag(TyFlags.GLOBAL)))
list.add(it.displayName)
}
if (list.isEmpty()) { //使用Global
TyUnion.each(this) {
if (!it.isAnonymous && (it is ITyClass && it.hasFlag(TyFlags.GLOBAL)))
list.add(it.displayName)
}
}
return list.joinToString("|")
}

Expand Down

0 comments on commit 482c87a

Please sign in to comment.