Skip to content

Commit

Permalink
bugfix + fix correct extraction type
Browse files Browse the repository at this point in the history
  • Loading branch information
m0rkeulv committed Aug 4, 2024
1 parent 58ea2ca commit ea4115a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public ResultHolder resolveExtractedValueType(@NotNull HaxeEnumExtractedValueRef

if (parentExtractors.size() > 1) {
ResultHolder switchExpressionType = evaluate(switchStatementExpression, parentResolver).result;

HaxeGenericResolver pathResolver = switchExpressionType.getClassType().getGenericResolver();
SpecificHaxeClassReference classType = switchExpressionType.getClassType();
if (classType != null) {
// LinkedHashMap because order matters
Expand All @@ -181,10 +181,13 @@ public ResultHolder resolveExtractedValueType(@NotNull HaxeEnumExtractedValueRef
}
}
}
if(classType != null) return classType.createHolder();

if(classType != null) {
pathResolver = classType.getGenericResolver();
}
}

ResultHolder resolve = pathResolver.resolve(parameterType);
if(resolve != null && !resolve.isUnknown()) return resolve;
return parameterType;
}

ResultHolder result = evaluate(lookupElement, parentResolver).result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ public HaxeClassReference(String name, @NotNull PsiElement elementContext, boole
}

private String getClassName(HaxeClassModel clazz) {
return CachedValuesManager.getProjectPsiDependentCache(clazz.getPsi(), HaxeClassReference::getNameCached).getValue();
if(clazz.getPsi().getParent() != null) {
return CachedValuesManager.getProjectPsiDependentCache(clazz.getPsi(), HaxeClassReference::getNameCached).getValue();
}else {
return getClassNameInternal(clazz.getPsi().getModel());
}
}

private static CachedValueProvider.Result<String> getNameCached(HaxeClass aClass) {
Expand Down

0 comments on commit ea4115a

Please sign in to comment.