Skip to content

Commit 470a845

Browse files
committed
fixed 308 broken tests by loading VBE.VBProjects into parser state in synchronous Parse() method, which is only used in tests.
1 parent f638b76 commit 470a845

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

RetailCoder.VBE/API/ParserState.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,18 @@ public void Initialize(VBE vbe)
6565
_parser = new RubberduckParser(vbe, _state, _attributeParser);
6666
}
6767

68+
/// <summary>
69+
/// Blocking call, for easier unit-test code
70+
/// </summary>
6871
public void Parse()
6972
{
7073
// blocking call
7174
_parser.Parse();
7275
}
7376

77+
/// <summary>
78+
/// Begins asynchronous parsing
79+
/// </summary>
7480
public void BeginParse()
7581
{
7682
// non-blocking call

Rubberduck.Parsing/VBA/RubberduckParser.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ private void ReparseRequested(object sender, ParseRequestEventArgs e)
8787

8888
public void Parse()
8989
{
90+
if (!_state.Projects.Any())
91+
{
92+
foreach (var project in _vbe.VBProjects.Cast<VBProject>())
93+
{
94+
_state.AddProject(project);
95+
}
96+
}
97+
9098
var projects = _state.Projects
9199
.Where(project => project.Protection == vbext_ProjectProtection.vbext_pp_none)
92100
.ToList();

0 commit comments

Comments
 (0)