Skip to content

Commit

Permalink
JavaScriptIdentifierReference only from JavaScriptIdentifierExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
ris58h committed Jun 20, 2023
1 parent 452be5d commit 99d8ab2
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ class JavaScriptIdentifier(node: ASTNode) : ASTWrapperPsiElement(node), PsiNameI
if (introducesName() || parent is JavaScriptIdentifierOwner) return null
val rangeInElement = TextRange(0, node.textLength)
return when (parent) {
is JavaScriptBreakStatement, is JavaScriptContinueStatement -> return JavaScriptLabelReference(this, rangeInElement)
else -> JavaScriptIdentifierReference(this, rangeInElement)
is JavaScriptBreakStatement, is JavaScriptContinueStatement -> JavaScriptLabelReference(this, rangeInElement)
is JavaScriptIdentifierExpression -> JavaScriptIdentifierReference(this, rangeInElement)
else -> null
}
}

Expand Down Expand Up @@ -96,7 +97,8 @@ class JavaScriptIdentifier(node: ASTNode) : ASTWrapperPsiElement(node), PsiNameI
}

private fun useScopeForVariableDeclaration(variableDeclaration: JavaScriptVariableDeclaration): LocalSearchScope? {
val variableDeclarationList = PsiTreeUtil.getParentOfType(variableDeclaration, JavaScriptVariableDeclarationList::class.java)
val variableDeclarationList =
PsiTreeUtil.getParentOfType(variableDeclaration, JavaScriptVariableDeclarationList::class.java)
val variableDeclarationListParent = variableDeclarationList?.parent
if (variableDeclarationListParent is JavaScriptIterationStatement) {
return LocalSearchScope(variableDeclarationListParent)
Expand Down

0 comments on commit 99d8ab2

Please sign in to comment.