Skip to content

Commit 84c2173

Browse files
committed
Address PR comment
1 parent 53a707c commit 84c2173

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Rubberduck.Refactorings/ReplacePrivateUDTMemberReferences/UserDefinedTypeInstance.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ private bool HasSameAncestor<T>(IdentifierReference idRef, ParserRuleContext goa
4949
Debug.Assert(goalContext != null);
5050
Debug.Assert(goalContext is VBAParser.MemberAccessExprContext || goalContext is VBAParser.WithStmtContext);
5151

52+
const int maxGetAncestorAttempts = 100;
5253
var guard = 0;
5354
var accessExprContext = idRef.Context.GetAncestor<T>();
54-
while (accessExprContext != null && ++guard < 100)
55+
while (accessExprContext != null && ++guard < maxGetAncestorAttempts)
5556
{
5657
var prCtxt = accessExprContext as ParserRuleContext;
5758
if (prCtxt == goalContext)
@@ -61,7 +62,7 @@ private bool HasSameAncestor<T>(IdentifierReference idRef, ParserRuleContext goa
6162
accessExprContext = accessExprContext.GetAncestor<T>();
6263
}
6364

64-
Debug.Assert(guard < 100);
65+
Debug.Assert(guard < maxGetAncestorAttempts);
6566
return false;
6667
}
6768
}

0 commit comments

Comments
 (0)