Skip to content

Commit ad6b9c0

Browse files
committed
Added IsReferencedByModule and HasReferenceToModule to ModuleState
1 parent 1349239 commit ad6b9c0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Rubberduck.Parsing/VBA/ModuleState.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Antlr4.Runtime.Tree;
77
using Rubberduck.Parsing.Annotations;
88
using Rubberduck.Parsing.Symbols;
9+
using Rubberduck.VBEditor;
910

1011
namespace Rubberduck.Parsing.VBA
1112
{
@@ -20,6 +21,8 @@ public class ModuleState
2021
public List<IAnnotation> Annotations { get; private set; }
2122
public SyntaxErrorException ModuleException { get; private set; }
2223
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; }
2326

2427
public bool IsNew { get; private set; }
2528

@@ -43,6 +46,8 @@ public ModuleState(ConcurrentDictionary<Declaration, byte> declarations)
4346
Annotations = new List<IAnnotation>();
4447
ModuleException = null;
4548
ModuleAttributes = new Dictionary<Tuple<string, DeclarationType>, Attributes>();
49+
HasReferenceToModule = new HashSet<QualifiedModuleName>();
50+
IsReferencedByModule = new ConcurrentDictionary<QualifiedModuleName, byte>();
4651

4752
IsNew = true;
4853
}
@@ -58,6 +63,8 @@ public ModuleState(ParserState state)
5863
Annotations = new List<IAnnotation>();
5964
ModuleException = null;
6065
ModuleAttributes = new Dictionary<Tuple<string, DeclarationType>, Attributes>();
66+
HasReferenceToModule = new HashSet<QualifiedModuleName>();
67+
IsReferencedByModule = new ConcurrentDictionary<QualifiedModuleName, byte>();
6168

6269
IsNew = true;
6370
}
@@ -73,6 +80,8 @@ public ModuleState(SyntaxErrorException moduleException)
7380
Annotations = new List<IAnnotation>();
7481
ModuleException = moduleException;
7582
ModuleAttributes = new Dictionary<Tuple<string, DeclarationType>, Attributes>();
83+
HasReferenceToModule = new HashSet<QualifiedModuleName>();
84+
IsReferencedByModule = new ConcurrentDictionary<QualifiedModuleName, byte>();
7685

7786
IsNew = true;
7887
}
@@ -88,6 +97,8 @@ public ModuleState(IDictionary<Tuple<string, DeclarationType>, Attributes> modul
8897
Annotations = new List<IAnnotation>();
8998
ModuleException = null;
9099
ModuleAttributes = moduleAttributes;
100+
HasReferenceToModule = new HashSet<QualifiedModuleName>();
101+
IsReferencedByModule = new ConcurrentDictionary<QualifiedModuleName, byte>();
91102

92103
IsNew = true;
93104
}
@@ -141,6 +152,17 @@ public ModuleState SetModuleAttributes(IDictionary<Tuple<string, DeclarationType
141152
return this;
142153
}
143154

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+
144166
private bool _isDisposed;
145167
public void Dispose()
146168
{

0 commit comments

Comments
 (0)