Skip to content

Commit 4cce7b0

Browse files
committed
performance! optimize local/global ty
1 parent e65c299 commit 4cce7b0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ private fun LuaNameDef.infer(context: SearchContext): ITy {
142142
}
143143

144144
//anonymous
145-
type = type.union(TyClass.createAnonymousType(this))
145+
if (type !is TyPrimitive)
146+
type = type.union(TyClass.createAnonymousType(this))
146147
}
147148
}
148149
return type

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ private fun getType(context: SearchContext, def: PsiElement): ITy {
261261
}
262262

263263
//Global
264-
if (isGlobal(def)) {
264+
if (isGlobal(def) && type !is TyPrimitive) {
265265
//use globalClassTy to store class members, that's very important
266266
type = type.union(TyClass.createGlobalType(def, context.forStore))
267267
}

0 commit comments

Comments
 (0)