6
6
using Antlr4 . Runtime . Tree ;
7
7
using Rubberduck . Parsing . Annotations ;
8
8
using Rubberduck . Parsing . Symbols ;
9
+ using Rubberduck . VBEditor ;
9
10
10
11
namespace Rubberduck . Parsing . VBA
11
12
{
@@ -20,6 +21,8 @@ public class ModuleState
20
21
public List < IAnnotation > Annotations { get ; private set ; }
21
22
public SyntaxErrorException ModuleException { get ; private set ; }
22
23
public IDictionary < Tuple < string , DeclarationType > , Attributes > ModuleAttributes { get ; private set ; }
24
+ public HashSet < QualifiedModuleName > HasReferenceToModule { get ; private set ; }
25
+ public ConcurrentDictionary < QualifiedModuleName , byte > IsReferencedByModule { get ; private set ; }
23
26
24
27
public bool IsNew { get ; private set ; }
25
28
@@ -43,6 +46,8 @@ public ModuleState(ConcurrentDictionary<Declaration, byte> declarations)
43
46
Annotations = new List < IAnnotation > ( ) ;
44
47
ModuleException = null ;
45
48
ModuleAttributes = new Dictionary < Tuple < string , DeclarationType > , Attributes > ( ) ;
49
+ HasReferenceToModule = new HashSet < QualifiedModuleName > ( ) ;
50
+ IsReferencedByModule = new ConcurrentDictionary < QualifiedModuleName , byte > ( ) ;
46
51
47
52
IsNew = true ;
48
53
}
@@ -58,6 +63,8 @@ public ModuleState(ParserState state)
58
63
Annotations = new List < IAnnotation > ( ) ;
59
64
ModuleException = null ;
60
65
ModuleAttributes = new Dictionary < Tuple < string , DeclarationType > , Attributes > ( ) ;
66
+ HasReferenceToModule = new HashSet < QualifiedModuleName > ( ) ;
67
+ IsReferencedByModule = new ConcurrentDictionary < QualifiedModuleName , byte > ( ) ;
61
68
62
69
IsNew = true ;
63
70
}
@@ -73,6 +80,8 @@ public ModuleState(SyntaxErrorException moduleException)
73
80
Annotations = new List < IAnnotation > ( ) ;
74
81
ModuleException = moduleException ;
75
82
ModuleAttributes = new Dictionary < Tuple < string , DeclarationType > , Attributes > ( ) ;
83
+ HasReferenceToModule = new HashSet < QualifiedModuleName > ( ) ;
84
+ IsReferencedByModule = new ConcurrentDictionary < QualifiedModuleName , byte > ( ) ;
76
85
77
86
IsNew = true ;
78
87
}
@@ -88,6 +97,8 @@ public ModuleState(IDictionary<Tuple<string, DeclarationType>, Attributes> modul
88
97
Annotations = new List < IAnnotation > ( ) ;
89
98
ModuleException = null ;
90
99
ModuleAttributes = moduleAttributes ;
100
+ HasReferenceToModule = new HashSet < QualifiedModuleName > ( ) ;
101
+ IsReferencedByModule = new ConcurrentDictionary < QualifiedModuleName , byte > ( ) ;
91
102
92
103
IsNew = true ;
93
104
}
@@ -141,6 +152,17 @@ public ModuleState SetModuleAttributes(IDictionary<Tuple<string, DeclarationType
141
152
return this ;
142
153
}
143
154
155
+ public void RefreshHasReferenceToModule ( )
156
+ {
157
+ HasReferenceToModule = new HashSet < QualifiedModuleName > ( ) ;
158
+ }
159
+
160
+ public void RefreshIsReferencedByModule ( )
161
+ {
162
+ IsReferencedByModule = new ConcurrentDictionary < QualifiedModuleName , byte > ( ) ;
163
+ }
164
+
165
+
144
166
private bool _isDisposed ;
145
167
public void Dispose ( )
146
168
{
0 commit comments