Skip to content

Commit 8a9bd3c

Browse files
committed
Make Event and Interface handling in ParameterCanBeByVal consistent with other cases
1 parent a187120 commit 8a9bd3c

File tree

2 files changed

+609
-40
lines changed

2 files changed

+609
-40
lines changed

Rubberduck.CodeAnalysis/Inspections/Concrete/ParameterCanBeByValInspection.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@ private IEnumerable<ParameterDeclaration> InterFaceMembersThatCanBeChangedToBePa
108108
for (var i = 0; i < implementationParameters.Count; i++)
109109
{
110110
parameterCanBeChangedToBeByVal[i] = parameterCanBeChangedToBeByVal[i]
111-
&& !IsPotentiallyUsedAsByRefParameter(implementationParameters[i])
112-
&& ((VBAParser.ArgContext)implementationParameters[i].Context).BYVAL() == null
113-
&& !implementationParameters[i].References.Any(reference => reference.IsAssignment);
111+
&& CanBeChangedToBePassedByValIndividually(implementationParameters[i]);
114112
}
115113
}
116114

@@ -153,9 +151,7 @@ private IEnumerable<ParameterDeclaration> EventMembersThatCanBeChangedToBePassed
153151
for (var i = 0; i < handlerParameters.Count; i++)
154152
{
155153
parameterCanBeChangedToBeByVal[i] = parameterCanBeChangedToBeByVal[i]
156-
&& !IsPotentiallyUsedAsByRefParameter(handlerParameters[i])
157-
&& ((VBAParser.ArgContext)handlerParameters[i].Context).BYVAL() == null
158-
&& !handlerParameters[i].References.Any(reference => reference.IsAssignment);
154+
&& CanBeChangedToBePassedByValIndividually(handlerParameters[i]);
159155
}
160156
}
161157

0 commit comments

Comments
 (0)