@@ -26,9 +26,7 @@ interface IJuliaFunctionDeclaration : PsiNameIdentifierOwner, DocStringOwner {
2626 * Common super class for declaration
2727 */
2828abstract class JuliaDeclaration (node : ASTNode ) : JuliaExprMixin(node), PsiNameIdentifierOwner {
29- private var refCache: Array <PsiReference >? = null
3029 override fun setName (newName : String ) = also {
31- references.forEach { it.handleElementRename(newName) }
3230 nameIdentifier?.replace(JuliaTokenType .fromText(newName, project))
3331 }
3432
@@ -37,37 +35,25 @@ abstract class JuliaDeclaration(node: ASTNode) : JuliaExprMixin(node), PsiNameId
3735 get() = PsiTreeUtil .getParentOfType(this , JuliaStatements ::class .java) ? : parent
3836
3937 override fun getName () = nameIdentifier?.text.orEmpty()
40- override fun getReferences () = refCache
41- ? : nameIdentifier
42- ?.let { collectFrom(startPoint, it.text, it) }
43- ?.also { refCache = it }
44- ? : emptyArray()
45-
46- override fun subtreeChanged () {
47- refCache = null
48- super .subtreeChanged()
49- }
5038
5139 override fun processDeclarations (
5240 processor : PsiScopeProcessor , substitutor : ResolveState , lastParent : PsiElement ? , place : PsiElement ) =
53- nameIdentifier?.let { processor.execute(it, substitutor) }.orFalse () and
41+ nameIdentifier?.let { processor.execute(it, substitutor) }.orTrue () &&
5442 processDeclTrivial(processor, substitutor, lastParent, place)
5543}
5644
5745abstract class JuliaForComprehensionMixin (node : ASTNode ) : ASTWrapperPsiElement(node), JuliaForComprehension {
5846 override fun processDeclarations (
5947 processor : PsiScopeProcessor , state : ResolveState , lastParent : PsiElement ? , place : PsiElement ) =
60- comprehensionElementList.all { it.processDeclarations(processor, state, lastParent, place) } and
61- super .processDeclarations(processor, state, lastParent, place)
48+ comprehensionElementList.all { it.processDeclarations(processor, state, lastParent, place) }
6249
6350 override var type: Type ? = null
6451}
6552
6653abstract class JuliaComprehensionElementMixin (node : ASTNode ) : ASTWrapperPsiElement(node), JuliaComprehensionElement {
6754 override fun processDeclarations (
6855 processor : PsiScopeProcessor , state : ResolveState , lastParent : PsiElement ? , place : PsiElement ) =
69- singleComprehensionList.all { it.processDeclarations(processor, state, lastParent, place) } and
70- super .processDeclarations(processor, state, lastParent, place)
56+ singleComprehensionList.all { it.processDeclarations(processor, state, lastParent, place) }
7157}
7258
7359abstract class JuliaSingleComprehensionMixin (node : ASTNode ) : JuliaDeclaration(node), JuliaSingleComprehension {
@@ -76,8 +62,8 @@ abstract class JuliaSingleComprehensionMixin(node: ASTNode) : JuliaDeclaration(n
7662
7763 override fun processDeclarations (
7864 processor : PsiScopeProcessor , substitutor : ResolveState , lastParent : PsiElement ? , place : PsiElement ) =
79- singleIndexer?.let { processor.execute(it.firstChild, substitutor) }.orFalse () and
80- multiIndexer?.let { it.children.all { processor.execute(it, substitutor) } }.orFalse () and
65+ singleIndexer?.let { processor.execute(it.firstChild, substitutor) }.orTrue () &&
66+ multiIndexer?.let { it.children.all { processor.execute(it, substitutor) } }.orTrue () &&
8167 super .processDeclarations(processor, substitutor, lastParent, place)
8268}
8369
@@ -133,7 +119,7 @@ abstract class JuliaFunctionMixin(node: ASTNode) : JuliaDeclaration(node), Julia
133119 processor : PsiScopeProcessor , substitutor : ResolveState , lastParent : PsiElement ? , place : PsiElement ) =
134120 functionSignature?.run {
135121 typedNamedVariableList.all { processor.execute(it.firstChild, substitutor) }
136- }.orFalse () && super .processDeclarations(processor, substitutor, lastParent, place)
122+ }.orTrue () && super .processDeclarations(processor, substitutor, lastParent, place)
137123
138124 override fun toString (): String {
139125 return " JuliaFunctionImpl(FUNCTION)"
@@ -244,10 +230,9 @@ abstract class JuliaTypeDeclarationMixin : StubBasedPsiElementBase<JuliaTypeDecl
244230 override fun setName (name : String ) = also { nameIdentifier?.replace(JuliaTokenType .fromText(name, project)) }
245231 override fun getName () = nameIdentifier?.text
246232 override fun getIcon (flags : Int ): Icon ? = JuliaIcons .JULIA_TYPE_ICON
247- // override fun processDeclarations(
248- // processor: PsiScopeProcessor, state: ResolveState, lastParent: PsiElement?, place: PsiElement) =
249- // nameIdentifier?.let { processor.execute(it, state) }.orFalse() &&
250- // super.processDeclarations(processor, state, lastParent, place)
233+ override fun processDeclarations (
234+ processor : PsiScopeProcessor , state : ResolveState , lastParent : PsiElement ? , place : PsiElement ) =
235+ nameIdentifier?.let { processor.execute(it, state) }.orTrue()
251236
252237 override fun subtreeChanged () {
253238 nameCache = null
@@ -268,10 +253,9 @@ abstract class JuliaAbstractTypeDeclarationMixin : StubBasedPsiElementBase<Julia
268253 override fun setName (name : String ) = also { nameIdentifier?.replace(JuliaTokenType .fromText(name, project)) }
269254 override fun getName () = nameIdentifier?.text
270255 override fun getIcon (flags : Int ): Icon ? = JuliaIcons .JULIA_ABSTRACT_TYPE_ICON
271- // override fun processDeclarations(
272- // processor: PsiScopeProcessor, state: ResolveState, lastParent: PsiElement?, place: PsiElement) =
273- // nameIdentifier?.let { processor.execute(it, state) }.orFalse() &&
274- // super.processDeclarations(processor, state, lastParent, place)
256+ override fun processDeclarations (
257+ processor : PsiScopeProcessor , state : ResolveState , lastParent : PsiElement ? , place : PsiElement ) =
258+ nameIdentifier?.let { processor.execute(it, state) }.orTrue()
275259
276260 override fun subtreeChanged () {
277261 nameCache = null
@@ -439,7 +423,7 @@ abstract class JuliaLambdaMixin(node: ASTNode) : JuliaDeclaration(node), JuliaLa
439423 .asReversed()
440424 .all { it.processDeclarations(processor, substitutor, lastParent, place) }
441425 }
442- }.orFalse () && super .processDeclarations(processor, substitutor, lastParent, place)
426+ }.orTrue () && super .processDeclarations(processor, substitutor, lastParent, place)
443427}
444428
445429// class JuliaReferenceManager(val psiManager: PsiManager, val dumbService: DumbService) {
@@ -448,4 +432,4 @@ abstract class JuliaLambdaMixin(node: ASTNode) : JuliaDeclaration(node), JuliaLa
448432// return ServiceManager.getService(project, JuliaReferenceManager::class.java)
449433// }
450434// }
451- // }
435+ // }
0 commit comments