Skip to content

Commit

Permalink
do not try to use enumHints when resolving parts of a ReferenceExpres…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
m0rkeulv committed Mar 25, 2024
1 parent 71b67da commit 990c0df
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/main/java/com/intellij/plugins/haxe/lang/psi/HaxeResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@
import com.intellij.plugins.haxe.util.HaxeDebugUtil;
import com.intellij.plugins.haxe.util.HaxeResolveUtil;
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiNameHelper;
import com.intellij.psi.ResolveState;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.resolve.ResolveCache;
import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.psi.util.PsiTreeUtil;
Expand Down Expand Up @@ -317,18 +314,23 @@ private List<? extends PsiElement> checkEnumMemberHints(HaxeReference reference)
HaxeAssignExpression assignExpression = PsiTreeUtil.getParentOfType(reference, HaxeAssignExpression.class);
if (assignExpression != null) {
HaxeExpression left = assignExpression.getLeftExpression();
if (left instanceof HaxeReferenceExpression referenceExpression) {
PsiElement resolve = referenceExpression.resolve();
if (resolve instanceof HaxePsiField psiField) {
fieldFromReferenceExpression = psiField;
//guard to avoid another resolve of the same reference, and attempts to check assignExpression for only part of a reference expression
if (left != reference && !(reference.getParent() instanceof HaxeReferenceExpression)) {
if (left instanceof HaxeReferenceExpression referenceExpression) {
PsiElement resolve = referenceExpression.resolve();
if (resolve instanceof HaxePsiField psiField) {
fieldFromReferenceExpression = psiField;
}
}
}
}
if (reference.getParent() instanceof HaxeCompareExpression compareExpression ) {
if (compareExpression.getLeftExpression() instanceof HaxeReferenceExpression referenceExpression) {
PsiElement resolve = referenceExpression.resolve();
if (resolve instanceof HaxePsiField psiField) {
fieldFromReferenceExpression = psiField;
if (referenceExpression != reference) {//guard to avoid another resolve of the same reference
PsiElement resolve = referenceExpression.resolve();
if (resolve instanceof HaxePsiField psiField) {
fieldFromReferenceExpression = psiField;
}
}
}
}
Expand Down

0 comments on commit 990c0df

Please sign in to comment.