Skip to content

Commit 5917a9f

Browse files
committed
Added xml-doc content
1 parent eed336a commit 5917a9f

File tree

1 file changed

+71
-1
lines changed

1 file changed

+71
-1
lines changed

Rubberduck.CodeAnalysis/Inspections/Concrete/UnreachableCaseInspection/UnreachableCaseInspection.cs

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
namespace Rubberduck.Inspections.Concrete.UnreachableCaseInspection
1818
{
1919
/// <summary>
20-
/// Flags 'Case' blocks that are semantically unreachable.
20+
/// Flags 'Case' blocks that will never execute.
2121
/// </summary>
2222
/// <why>
2323
/// Unreachable code is certainly unintended, and is probably either redundant, or a bug.
@@ -41,6 +41,76 @@ namespace Rubberduck.Inspections.Concrete.UnreachableCaseInspection
4141
/// End Sub
4242
/// ]]>
4343
/// </example>
44+
/// <example hasResults="true">
45+
/// <![CDATA[
46+
///
47+
/// 'If the cumulative result of multiple 'Case' statements
48+
/// 'cover the entire range of possible values for a data type,
49+
/// 'then all remaining 'Case' statements are unreachable
50+
///
51+
/// Private Sub ExampleAllValuesCoveredIntegral(ByVal value As Long, ByVal result As Long)
52+
/// Select Case result
53+
/// Case Is < 100
54+
/// ' ...
55+
/// Case Is > -100
56+
/// ' ...
57+
/// 'all possible values are covered by preceding 'Case' statements
58+
/// Case value * value ' unreachable
59+
/// ' ...
60+
/// Case value + value ' unreachable
61+
/// ' ...
62+
/// Case Else ' unreachable
63+
/// ' ...
64+
/// End Select
65+
/// End Sub
66+
/// ]]>
67+
/// </example>
68+
/// <example hasResults="true">
69+
/// <![CDATA[
70+
/// Public Enum ProductID
71+
/// Widget = 1
72+
/// Gadget = 2
73+
/// Gizmo = 3
74+
/// End Enum
75+
///
76+
/// Public Sub ExampleEnumCaseElse(ByVal product As ProductID)
77+
///
78+
/// 'Enums are evaluated as the 'Long' type, so even though all the
79+
/// 'ProductID enum values have a 'Case' statement, the 'Case Else'
80+
/// 'can still be reached for any value of the 'product' parameter that is not
81+
/// 'a ProductID.
82+
///
83+
/// Select Case product
84+
/// Case Widget
85+
/// ' ...
86+
/// Case Gadget
87+
/// ' ...
88+
/// Case Gizmo
89+
/// ' ...
90+
/// Case Else 'is reachable
91+
/// ' Raise an error for unrecognized/unhandled ProductID
92+
/// End Select
93+
/// End Sub
94+
/// ]]>
95+
/// </example>
96+
/// <example hasResults="true">
97+
/// <![CDATA[
98+
///
99+
/// 'The inspecion flags Range Clauses that are not of the required form:
100+
/// '[x] To [y] where [x] less than or equal to [y]
101+
///
102+
/// Private Sub ExampleInvalidRangeExpression(ByVal value As String)
103+
/// Select Case value
104+
/// Case "Beginning" To "End"
105+
/// ' ...
106+
/// Case "Start" To "Finish" ' unreachable: incorrect form.
107+
/// ' ...
108+
/// CaseElse
109+
/// ' ...
110+
/// End Select
111+
/// End Sub
112+
/// ]]>
113+
/// </example>
44114
public sealed class UnreachableCaseInspection : ParseTreeInspectionBase
45115
{
46116
private readonly IUnreachableCaseInspectorFactory _unreachableCaseInspectorFactory;

0 commit comments

Comments
 (0)