Skip to content

Commit

Permalink
Fix for slow forward member lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
m0rkeulv committed Sep 15, 2024
1 parent 983461d commit e711f6e
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@
import com.intellij.plugins.haxe.metadata.psi.HaxeMetadataContent;
import com.intellij.plugins.haxe.metadata.util.HaxeMetadataUtils;
import com.intellij.plugins.haxe.model.HaxeAbstractClassModel;
import com.intellij.plugins.haxe.model.HaxeBaseMemberModel;
import com.intellij.plugins.haxe.model.type.HaxeGenericResolver;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;

import static com.intellij.plugins.haxe.model.type.HaxeGenericResolverUtil.getResolverSkipAbstractNullScope;

Expand All @@ -63,10 +61,16 @@ public static List<HaxeNamedComponent> findAbstractForwardingNamedSubComponents(
return HaxeResolveUtil.findNamedSubComponents(forwardResolver, underlyingClass);
}
List<HaxeNamedComponent> haxeNamedComponentList = new ArrayList<>();
List<HaxeBaseMemberModel> members = underlyingClass.getModel().getMembers(resolver);

Map<String, HaxeNamedComponent> namedComponentMap = new HashMap<>();
for (HaxeBaseMemberModel member : members) {
namedComponentMap.put(member.getName(), member.getNamedComponentPsi());
}

for (String fieldName : forwardingFieldsNames) {
HaxeNamedComponent component = HaxeResolveUtil.findNamedSubComponent(underlyingClass, fieldName, resolver);
if (component != null) {
haxeNamedComponentList.add(component);
if (namedComponentMap.containsKey(fieldName)) {
haxeNamedComponentList.add(namedComponentMap.get(fieldName));
}
}
return haxeNamedComponentList;
Expand Down

0 comments on commit e711f6e

Please sign in to comment.