Skip to content

Commit

Permalink
避免 indexing 时查询 index
Browse files Browse the repository at this point in the history
  • Loading branch information
tangzx committed Dec 27, 2023
1 parent d700664 commit c0c927b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.tang.intellij.lua.ty.ITyClass
class LuaShortNamesManagerImpl : LuaShortNamesManager() {

override fun findClass(name: String, context: SearchContext): LuaClass? {
if (context.forStub) return null
return LuaClassIndex.find(name, context)
}

Expand All @@ -38,14 +39,16 @@ class LuaShortNamesManagerImpl : LuaShortNamesManager() {
}

override fun processClassesWithName(name: String, context: SearchContext, processor: Processor<LuaClass>): Boolean {
return LuaClassIndex.process(name, context.project, context.scope, Processor { processor.process(it) })
return LuaClassIndex.process(name, context.project, context.scope) { processor.process(it) }
}

override fun getClassMembers(clazzName: String, context: SearchContext): Collection<LuaClassMember> {
if (context.forStub) return emptyList()
return LuaClassMemberIndex.instance.get(clazzName.hashCode(), context.project, context.scope)
}

override fun processMembers(type: ITyClass, context: SearchContext, processor: Processor<LuaClassMember>): Boolean {
if (context.forStub) return true;
return LuaClassMemberIndex.processAll(type, context, processor)
}

Expand All @@ -56,10 +59,12 @@ class LuaShortNamesManagerImpl : LuaShortNamesManager() {
processor: Processor<LuaClassMember>,
visitSuper: Boolean
): Boolean {
if (context.forStub) return true;
return LuaClassMemberIndex.process(className, fieldName, context, processor, visitSuper)
}

override fun findAlias(name: String, context: SearchContext): LuaTypeAlias? {
if (context.forStub) return null
return LuaAliasIndex.find(name, context)
}

Expand Down

0 comments on commit c0c927b

Please sign in to comment.