Skip to content

Commit 44f7887

Browse files
committed
Add a new IsError function to ParseProgressEventArgs to simplify the check for error state.
1 parent 00472ab commit 44f7887

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Rubberduck.Core/UnitTesting/TestEngine.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ private void StateChangedHandler(object sender, ParserStateEventArgs e)
5353
});
5454
}
5555

56-
if (_testRequested && (e.State == ParserState.ResolverError ||
57-
e.State == ParserState.Error ||
58-
e.State == ParserState.UnexpectedError))
56+
if (_testRequested && !e.IsError)
5957
{
6058
_testRequested = false;
6159
}

Rubberduck.Parsing/VBA/RubberduckParserState.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ public ParserStateEventArgs(ParserState state, CancellationToken token)
5151

5252
public ParserState State { get; }
5353
public CancellationToken Token { get; }
54+
55+
public bool IsError => (State == ParserState.ResolverError ||
56+
State == ParserState.Error ||
57+
State == ParserState.UnexpectedError);
58+
5459
}
5560

5661
public class RubberduckStatusMessageEventArgs : EventArgs
@@ -535,10 +540,7 @@ public ParserState GetModuleState(QualifiedModuleName module)
535540

536541
private readonly object _statusLockObject = new object();
537542
private ParserState _status;
538-
public ParserState Status
539-
{
540-
get => _status;
541-
}
543+
public ParserState Status => _status;
542544

543545
private void SetStatusWithCancellation(ParserState value, CancellationToken token)
544546
{
@@ -659,7 +661,7 @@ private IReadOnlyList<UnboundMemberDeclaration> AllUnresolvedMemberDeclarationsF
659661
}
660662

661663
private readonly ConcurrentBag<SerializableProject> _builtInDeclarationTrees = new ConcurrentBag<SerializableProject>();
662-
public IProducerConsumerCollection<SerializableProject> BuiltInDeclarationTrees { get { return _builtInDeclarationTrees; } }
664+
public IProducerConsumerCollection<SerializableProject> BuiltInDeclarationTrees => _builtInDeclarationTrees;
663665

664666
/// <summary>
665667
/// Gets a copy of the collected declarations, excluding the built-in ones.

0 commit comments

Comments
 (0)