@@ -71,17 +71,8 @@ public sealed class RubberduckParserState : IDisposable, IDeclarationFinderProvi
71
71
72
72
public RubberduckParserState ( IVBE vbe , IDeclarationFinderFactory declarationFinderFactory )
73
73
{
74
- if ( vbe == null )
75
- {
76
- throw new ArgumentNullException ( nameof ( vbe ) ) ;
77
- }
78
- if ( declarationFinderFactory == null )
79
- {
80
- throw new ArgumentNullException ( nameof ( declarationFinderFactory ) ) ;
81
- }
82
-
83
- _vbe = vbe ;
84
- _declarationFinderFactory = declarationFinderFactory ;
74
+ _vbe = vbe ?? throw new ArgumentNullException ( nameof ( vbe ) ) ;
75
+ _declarationFinderFactory = declarationFinderFactory ?? throw new ArgumentNullException ( nameof ( declarationFinderFactory ) ) ;
85
76
86
77
var values = Enum . GetValues ( typeof ( ParserState ) ) ;
87
78
foreach ( var value in values )
@@ -436,12 +427,12 @@ private ParserState OverallParserStateFromModuleStates()
436
427
{
437
428
if ( moduleState != moduleStates [ 0 ] )
438
429
{
439
- state = default ( ParserState ) ;
430
+ state = default ;
440
431
break ;
441
432
}
442
433
}
443
434
444
- if ( state != default ( ParserState ) )
435
+ if ( state != default )
445
436
{
446
437
// if all modules are in the same state, we have our result.
447
438
return state ;
@@ -600,8 +591,7 @@ public List<IAnnotation> AllAnnotations
600
591
601
592
public IEnumerable < IAnnotation > GetModuleAnnotations ( QualifiedModuleName module )
602
593
{
603
- ModuleState result ;
604
- if ( _moduleStates . TryGetValue ( module , out result ) )
594
+ if ( _moduleStates . TryGetValue ( module , out var result ) )
605
595
{
606
596
return result . Annotations ;
607
597
}
@@ -732,8 +722,7 @@ public void ClearStateCache(string projectId, bool notifyStateChanged = false)
732
722
{
733
723
// store project module name
734
724
var qualifiedModuleName = moduleState . Key ;
735
- ModuleState state ;
736
- if ( _moduleStates . TryRemove ( qualifiedModuleName , out state ) )
725
+ if ( _moduleStates . TryRemove ( qualifiedModuleName , out var state ) )
737
726
{
738
727
state . Dispose ( ) ;
739
728
}
@@ -943,8 +932,7 @@ public bool IsNewOrModified(IVBComponent component)
943
932
944
933
public bool IsNewOrModified ( QualifiedModuleName key )
945
934
{
946
- ModuleState moduleState ;
947
- if ( _moduleStates . TryGetValue ( key , out moduleState ) )
935
+ if ( _moduleStates . TryGetValue ( key , out var moduleState ) )
948
936
{
949
937
// existing/modified
950
938
return moduleState . IsNew || key . ContentHashCode != moduleState . ModuleContentHashCode ;
@@ -964,8 +952,7 @@ public void RemoveBuiltInDeclarations(IReference reference)
964
952
var projectName = reference . Name ;
965
953
var key = new QualifiedModuleName ( projectName , reference . FullPath , projectName ) ;
966
954
ClearAsTypeDeclarationPointingToReference ( key ) ;
967
- ModuleState moduleState ;
968
- if ( _moduleStates . TryRemove ( key , out moduleState ) )
955
+ if ( _moduleStates . TryRemove ( key , out var moduleState ) )
969
956
{
970
957
moduleState ? . Dispose ( ) ;
971
958
Logger . Warn ( "Could not remove declarations for removed reference '{0}' ({1})." , reference . Name , QualifiedModuleName . GetProjectId ( reference ) ) ;
0 commit comments