Skip to content

Commit e392b38

Browse files
committed
get prefect cls ty
1 parent 51c709c commit e392b38

File tree

1 file changed

+8
-3
lines changed
  • src/main/java/com/tang/intellij/lua/ty

1 file changed

+8
-3
lines changed

src/main/java/com/tang/intellij/lua/ty/Ty.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,19 @@ class TyUnion : Ty(TyKind.Union) {
300300

301301
fun getPrefectClass(ty: ITy): ITyClass? {
302302
var tc: ITyClass? = null
303+
var anonymous: ITyClass? = null
303304
process(ty) {
304305
if (it is ITyClass) {
305-
tc = it
306-
return@process false
306+
if (it.isAnonymous)
307+
anonymous = it
308+
else {
309+
tc = it
310+
return@process false
311+
}
307312
}
308313
true
309314
}
310-
return tc
315+
return tc ?: anonymous
311316
}
312317
}
313318
}

0 commit comments

Comments
 (0)