Skip to content

Commit bbfb100

Browse files
author
Andrin Meier
committed
fix #1422
1 parent 0555aa6 commit bbfb100

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

Rubberduck.Parsing/Annotations/AnnotationListener.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ public IEnumerable<IAnnotation> Annotations
2929
public override void ExitAnnotation([NotNull] VBAParser.AnnotationContext context)
3030
{
3131
var newAnnotation = _factory.Create(context, new QualifiedSelection(_qualifiedName, context.GetSelection()));
32-
_annotations.Add(newAnnotation);
32+
// It might be an annotation we don't support or a typo.
33+
if (newAnnotation != null)
34+
{
35+
_annotations.Add(newAnnotation);
36+
}
3337
}
3438
}
3539
}

Rubberduck.Parsing/Reflection/Member.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ public static bool TryParse(string[] body, QualifiedModuleName qualifiedModuleNa
9595
body = body.Select(line => line.Trim().Replace("\r", string.Empty)).ToArray();
9696

9797
var withoutKeyword = signature.Substring((Keywords.First(keyword => signature.StartsWith(keyword))).Length);
98-
var name = withoutKeyword.Split(' ')[1]
99-
.Split('(')[0];
98+
var name = withoutKeyword.Split('(')[0].Trim();
10099

101100
var type = GetMemberType(signature, withoutKeyword);
102101
var visibility = GetMemberVisibility(signature);

Rubberduck.Parsing/VBComponentExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static IEnumerable<Member> GetMembers(this VBComponent component, vbext_P
3333
private static IEnumerable<Member> GetMembers(this CodeModule module, vbext_ProcKind? procedureKind = null)
3434
{
3535
var currentLine = module.CountOfDeclarationLines + 1;
36-
while (currentLine < module.CountOfLines)
36+
while (currentLine <= module.CountOfLines)
3737
{
3838
vbext_ProcKind kind;
3939
var name = module.get_ProcOfLine(currentLine, out kind);

Rubberduck.SmartIndenter/Indenter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using System;
1+
using Microsoft.Vbe.Interop;
2+
using System;
23
using System.Collections.Generic;
34
using System.Globalization;
45
using System.Linq;
5-
using Microsoft.Vbe.Interop;
66

77
namespace Rubberduck.SmartIndenter
88
{
@@ -106,7 +106,7 @@ public void Indent(VBProject project)
106106
private static bool HasCode(CodeModule module, ref int lineCount)
107107
{
108108
lineCount += module.CountOfLines;
109-
for (var i = 0; i < module.CountOfLines; i++)
109+
for (var i = 1; i <= module.CountOfLines; i++)
110110
{
111111
if (!string.IsNullOrWhiteSpace(module.Lines[i, 1]))
112112
{
@@ -118,7 +118,7 @@ private static bool HasCode(CodeModule module, ref int lineCount)
118118

119119
private static bool HasCode(CodeModule module)
120120
{
121-
for (var i = 0; i < module.CountOfLines; i++)
121+
for (var i = 1; i <= module.CountOfLines; i++)
122122
{
123123
if (!string.IsNullOrWhiteSpace(module.Lines[i, 1]))
124124
{

Rubberduck.SmartIndenter/Rubberduck.SmartIndenter.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@
7070
<None Include="Legacy\frmProgress.frm" />
7171
<None Include="Legacy\frmVBEOnKey.frm" />
7272
</ItemGroup>
73+
<ItemGroup>
74+
<ProjectReference Include="..\Rubberduck.Parsing\Rubberduck.Parsing.csproj">
75+
<Project>{A4A618E1-CBCA-435F-9C6C-5181E030ADFC}</Project>
76+
<Name>Rubberduck.Parsing</Name>
77+
</ProjectReference>
78+
</ItemGroup>
7379
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
7480
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
7581
Other similar extension points exist, see Microsoft.Common.targets.

0 commit comments

Comments
 (0)