Skip to content

Commit e78d93c

Browse files
committed
hacked a "_force" flag to force tests to walk all parse trees.
1 parent e9f2766 commit e78d93c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Rubberduck.Parsing/VBA/RubberduckParser.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ private void StateOnStateChanged(object sender, EventArgs e)
7272

7373
private void ReparseRequested(object sender, ParseRequestEventArgs e)
7474
{
75+
_force = false;
7576
if (e.IsFullReparseRequest)
7677
{
7778
Cancel();
@@ -84,8 +85,10 @@ private void ReparseRequested(object sender, ParseRequestEventArgs e)
8485
}
8586
}
8687

88+
private bool _force;
8789
public void Parse()
8890
{
91+
_force = true;
8992
if (!_state.Projects.Any())
9093
{
9194
foreach (var project in _vbe.VBProjects.Cast<VBProject>())
@@ -142,6 +145,7 @@ public void Parse()
142145
/// </summary>
143146
private void ParseAll()
144147
{
148+
_force = false;
145149
var projects = _state.Projects
146150
.Where(project => project.Protection == vbext_ProjectProtection.vbext_pp_none)
147151
.ToList();
@@ -283,9 +287,9 @@ private void ResolveInternal(CancellationToken token)
283287
foreach (var kvp in _state.ParseTrees)
284288
{
285289
var qualifiedName = kvp.Key;
286-
if (_state.IsModified(qualifiedName))
290+
if (_force || _state.IsModified(qualifiedName))
287291
{
288-
Debug.WriteLine(string.Format("Module '{0}' was modified since last parse. Walking parse tree for declarations...", kvp.Key.ComponentName));
292+
Debug.WriteLine(string.Format("Module '{0}' is new or was modified since last parse. Walking parse tree for declarations...", kvp.Key.ComponentName));
289293
// modified module; walk parse tree and re-acquire all declarations
290294
if (token.IsCancellationRequested) return;
291295
ResolveDeclarations(qualifiedName.Component, kvp.Value);

0 commit comments

Comments
 (0)