Skip to content

Commit a6ac147

Browse files
committed
Merge branch 'next' of https://github.com/rubberduck-vba/Rubberduck into MiscBugFixes2
2 parents 67e205e + 6129710 commit a6ac147

File tree

106 files changed

+2222
-1514
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+2222
-1514
lines changed

Rubberduck.CodeAnalysis/Inspections/Abstract/QuickFixBase.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics;
34
using System.Linq;
45
using NLog;
56
using Rubberduck.Parsing.Inspections.Abstract;
@@ -24,17 +25,28 @@ public void RegisterInspections(params Type[] inspections)
2425
{
2526
if (!inspections.All(s => s.GetInterfaces().Any(a => a == typeof(IInspection))))
2627
{
27-
#if DEBUG
28-
throw new ArgumentException($"Parameters must implement {nameof(IInspection)}", nameof(inspections));
29-
#else
28+
var dieNow = false;
29+
MustThrowException(ref dieNow);
30+
if (dieNow)
31+
{
32+
throw new ArgumentException($"Parameters must implement {nameof(IInspection)}",
33+
nameof(inspections));
34+
}
35+
3036
inspections.Where(s => s.GetInterfaces().All(i => i != typeof(IInspection))).ToList()
3137
.ForEach(i => Logger.Error($"Type {i.Name} does not implement {nameof(IInspection)}"));
32-
#endif
3338
}
3439

3540
_supportedInspections = inspections.ToHashSet();
3641
}
3742

43+
// ReSharper disable once RedundantAssignment : conditional must be void but we can use ref
44+
[Conditional("DEBUG")]
45+
private static void MustThrowException(ref bool dieNow)
46+
{
47+
dieNow = true;
48+
}
49+
3850
public void RemoveInspections(params Type[] inspections)
3951
{
4052
_supportedInspections = _supportedInspections.Except(inspections).ToHashSet();

Rubberduck.CodeAnalysis/Inspections/Concrete/ArgumentWithIncompatibleObjectTypeInspection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
2121
/// <why>
2222
/// The VBA compiler does not check whether different object types are compatible. Instead there is a runtime error whenever the types are incompatible.
2323
/// </why>
24-
/// <example hasResult="true">
24+
/// <example hasresult="true">
2525
/// <![CDATA[
2626
/// IInterface:
2727
///
@@ -49,7 +49,7 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
4949
/// End Sub
5050
/// ]]>
5151
/// </example>
52-
/// <example hasResult="false">
52+
/// <example hasresult="false">
5353
/// <![CDATA[
5454
/// IInterface:
5555
///

Rubberduck.CodeAnalysis/Inspections/Concrete/DefaultMemberRequiredInspection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
1515
/// <why>
1616
/// The VBA compiler does not check whether the necessary default member is present. Instead there is a runtime error whenever the runtime type fails to have the default member.
1717
/// </why>
18-
/// <example hasResult="true">
18+
/// <example hasresult="true">
1919
/// <![CDATA[
2020
/// Class1:
2121
///
@@ -34,7 +34,7 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
3434
/// End Sub
3535
/// ]]>
3636
/// </example>
37-
/// <example hasResult="false">
37+
/// <example hasresult="false">
3838
/// <![CDATA[
3939
/// Class1:
4040
///

Rubberduck.CodeAnalysis/Inspections/Concrete/ImplicitDefaultMemberAccessInspection.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,31 @@ namespace Rubberduck.Inspections.Concrete
1414
/// Default member accesses hide away the actually called member. This is especially misleading if there is no indication in the expression that such a call is made
1515
/// and can cause errors in which a member was forgotten to be called to go unnoticed.
1616
/// </why>
17-
/// <example hasResult="true">
17+
/// <example hasresult="true">
1818
/// <![CDATA[
1919
/// Public Sub DoSomething(ByVal arg As ADODB.Field)
2020
/// Dim bar As Variant
2121
/// bar = arg
2222
/// End Sub
2323
/// ]]>
2424
/// </example>
25-
/// <example hasResult="true">
25+
/// <example hasresult="true">
2626
/// <![CDATA[
2727
/// Public Sub DoSomething(ByVal arg As ADODB.Connection)
2828
/// Dim bar As String
2929
/// arg = bar
3030
/// End Sub
3131
/// ]]>
3232
/// </example>
33-
/// <example hasResult="false">
33+
/// <example hasresult="false">
3434
/// <![CDATA[
3535
/// Public Sub DoSomething(ByVal arg As ADODB.Field)
3636
/// Dim bar As Variant
3737
/// bar = arg.Value
3838
/// End Sub
3939
/// ]]>
4040
/// </example>
41-
/// <example hasResult="false">
41+
/// <example hasresult="false">
4242
/// <![CDATA[
4343
/// Public Sub DoSomething(ByVal arg As ADODB.Connection)
4444
/// Dim bar As String

Rubberduck.CodeAnalysis/Inspections/Concrete/ImplicitRecursiveDefaultMemberAccessInspection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Rubberduck.Inspections.Concrete
1414
/// Default member accesses hide away the actually called member. This is especially misleading if there is no indication in the expression that such a call is made
1515
/// and the final default member is not on the interface of the object itself. In particular, this can cause errors in which a member was forgotten to be called to go unnoticed.
1616
/// </why>
17-
/// <example hasResult="true">
17+
/// <example hasresult="true">
1818
/// <module name="Class1" type="Class Module">
1919
/// <![CDATA[
2020
/// Public Function Foo() As Class2
@@ -40,7 +40,7 @@ namespace Rubberduck.Inspections.Concrete
4040
/// ]]>
4141
/// </module>
4242
/// </example>
43-
/// <example hasResult="false">
43+
/// <example hasresult="false">
4444
/// <module name="Class1" type="Class Module">
4545
/// <![CDATA[
4646
/// Public Function Foo() As Class2

Rubberduck.CodeAnalysis/Inspections/Concrete/ImplicitUnboundDefaultMemberAccessInspection.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,29 @@ namespace Rubberduck.Inspections.Concrete
1717
/// and if the default member cannot be determined from the declared type of the object. As a consequence, errors in which a member was forgotten to be called can go unnoticed
1818
/// and should there not be a suitable default member at runtime, an error 438 'Object doesn't support this property or method' will be raised.
1919
/// </why>
20-
/// <example hasResult="true">
20+
/// <example hasresult="true">
2121
/// <![CDATA[
2222
/// Public Sub DoSomething(ByVal arg As Object)
2323
/// Dim bar As Variant
2424
/// bar = arg
2525
/// End Sub
2626
/// ]]>
27-
/// <example hasResult="true">
27+
/// <example hasresult="true">
2828
/// <![CDATA[
2929
/// Public Sub DoSomething(ByVal arg As Object)
3030
/// Dim bar As Variant
3131
/// arg = bar
3232
/// End Sub
3333
/// ]]>
3434
/// </example>
35-
/// <example hasResult="false">
35+
/// <example hasresult="false">
3636
/// <![CDATA[
3737
/// Public Sub DoSomething(ByVal arg As Object)
3838
/// Dim bar As Variant
3939
/// bar = arg.SomeValueReturningMember
4040
/// End Sub
4141
/// ]]>
42-
/// <example hasResult="false">
42+
/// <example hasresult="false">
4343
/// <![CDATA[
4444
/// Public Sub DoSomething(ByVal arg As Object)
4545
/// Dim bar As Variant

Rubberduck.CodeAnalysis/Inspections/Concrete/IndexedDefaultMemberAccessInspection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ namespace Rubberduck.Inspections.Concrete
1414
/// <why>
1515
/// An indexed default member access hides away the actually called member.
1616
/// </why>
17-
/// <example hasResult="true">
17+
/// <example hasresult="true">
1818
/// <![CDATA[
1919
/// Public Sub DoSomething(ByVal coll As Collection)
2020
/// Dim bar As Variant
2121
/// bar = coll(23)
2222
/// End Sub
2323
/// ]]>
2424
/// </example>
25-
/// <example hasResult="false">
25+
/// <example hasresult="false">
2626
/// <![CDATA[
2727
/// Public Sub DoSomething(ByVal coll As Collection)
2828
/// Dim bar As Variant

Rubberduck.CodeAnalysis/Inspections/Concrete/IndexedRecursiveDefaultMemberAccessInspection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ namespace Rubberduck.Inspections.Concrete
1414
/// <why>
1515
/// An indexed default member access hides away the actually called member. This is especially problematic if the corresponding parameterized default member is not on the interface of the object itself.
1616
/// </why>
17-
/// <example hasResult="true">
17+
/// <example hasresult="true">
1818
/// <![CDATA[
1919
/// Public Sub DoSomething(ByVal rst As ADODB.Recordset)
2020
/// Dim bar As Variant
2121
/// bar = rst("MyField")
2222
/// End Sub
2323
/// ]]>
2424
/// </example>
25-
/// <example hasResult="false">
25+
/// <example hasresult="false">
2626
/// <![CDATA[
2727
/// Public Sub DoSomething(ByVal rst As ADODB.Recordset)
2828
/// Dim bar As Variant

Rubberduck.CodeAnalysis/Inspections/Concrete/IndexedUnboundDefaultMemberAccessInspection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ namespace Rubberduck.Inspections.Concrete
1717
/// An indexed default member access hides away the actually called member. This is especially problematic if the default member cannot be determined from the declared type of the object.
1818
/// Should there not be a suitable default member at runtime, an error 438 'Object doesn't support this property or method' will be raised.
1919
/// </why>
20-
/// <example hasResult="true">
20+
/// <example hasresult="true">
2121
/// <![CDATA[
2222
/// Public Sub DoSomething(ByVal rst As Object)
2323
/// Dim bar As Variant
2424
/// bar = rst("MyField")
2525
/// End Sub
2626
/// ]]>
2727
/// </example>
28-
/// <example hasResult="false">
28+
/// <example hasresult="false">
2929
/// <![CDATA[
3030
/// Public Sub DoSomething(ByVal rst As Object)
3131
/// Dim bar As Variant

Rubberduck.CodeAnalysis/Inspections/Concrete/ObjectWhereProcedureIsRequiredInspection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Rubberduck.Inspections.Concrete
2020
/// Providing an object where a procedure is required leads to an implicit call to the object's default member.
2121
/// This behavior is not obvious, and most likely unintended.
2222
/// </why>
23-
/// <example hasResult="true">
23+
/// <example hasresult="true">
2424
/// <module name="Class1" type="Class Module">
2525
/// <![CDATA[
2626
/// Public Function Foo() As Long
@@ -37,7 +37,7 @@ namespace Rubberduck.Inspections.Concrete
3737
/// ]]>
3838
/// </module>
3939
/// </example>
40-
/// <example hasResult="false">
40+
/// <example hasresult="false">
4141
/// <module name="Class1" type="Class Module">
4242
/// <![CDATA[
4343
/// Public Function Foo() As Long

0 commit comments

Comments
 (0)