Skip to content

Commit

Permalink
adding prohibitResultCaching to old resolvers recursion guard to ma…
Browse files Browse the repository at this point in the history
…ke sure we dont cache something incorrectly
  • Loading branch information
m0rkeulv committed Apr 21, 2024
1 parent c308562 commit cdf0517
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public class HaxeResolver implements ResolveCache.AbstractResolver<HaxeReference

private final RecursionGuard<PsiElement> resolveInnerRecursionGuard = RecursionManager.createGuard("resolveInnerRecursionGuard");

public static void prohibitResultCaching(@NotNull PsiElement element) {
INSTANCE.resolveInnerRecursionGuard.prohibitResultCaching(element);
}

@Override
public List<? extends PsiElement> resolve(@NotNull HaxeReference reference, boolean incompleteCode) {
/** See docs on {@link HaxeDebugUtil#isCachingDisabled} for how to set this flag. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,9 @@ public static HaxeResolveResult getHaxeClassResolveResult(@Nullable PsiElement e
}

if (stack.search(element) > 0) {
// just to be sure we dont end up caching something incorrectly when unable to resolve type
HaxeResolver.prohibitResultCaching(element);

// We're already trying to resolve this element. Prevent stack overflow.
String msg = "Cannot resolve recursive/cyclic definition of " + element.getText()
+ ", found at " + HaxeDebugUtil.elementLocation(element);
Expand Down

0 comments on commit cdf0517

Please sign in to comment.