Skip to content

Commit d5efed8

Browse files
committed
Merge pull request #1352 from autoboosh/paramarrayfix
fix paramarray incorrectly flagged as missing ByRef param mechanism (…
2 parents b62455a + debc72e commit d5efed8

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

RetailCoder.VBE/Inspections/ImplicitByRefParameterInspection.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
2424
var interfaceMembers = UserDeclarations.FindInterfaceImplementationMembers();
2525

2626
var issues = (from item in UserDeclarations
27-
where !item.IsInspectionDisabled(AnnotationName)
27+
where
28+
!item.IsInspectionDisabled(AnnotationName)
2829
&& item.DeclarationType == DeclarationType.Parameter
30+
// ParamArray parameters do not allow an explicit "ByRef" parameter mechanism.
31+
&& !((ParameterDeclaration)item).IsParamArray
2932
&& !interfaceMembers.Select(m => m.Scope).Contains(item.ParentScope)
3033
let arg = item.Context as VBAParser.ArgContext
3134
where arg != null && arg.BYREF() == null && arg.BYVAL() == null

RetailCoder.VBE/Inspections/InspectionsUI.de.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@
423423
<value>Deklariere explizit als 'Variant'</value>
424424
</data>
425425
<data name="ImplicitByRefParameterQuickFix" xml:space="preserve">
426-
<value>Über gebe den Parameter explizit als Referenz</value>
426+
<value>Parameter explizit als Referenz angeben</value>
427427
</data>
428428
<data name="Inspections_DeclarationOf" xml:space="preserve">
429429
<value>Deklaration von</value>

RubberduckTests/Inspections/ImplicitByRefParameterInspectionTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public void ImplicitByRefParameter_QuickFixWorks_PassByRef()
200200
}
201201

202202
[TestMethod]
203-
public void ImplicitByRefParameter_QuickFixWorks_ParamArrayMustBePassedByRef()
203+
public void ImplicitByRefParameter_QuickFixWorks_ParamArrayIsIgnored()
204204
{
205205
const string inputCode =
206206
@"Sub Foo(ParamArray arg1 As Integer)
@@ -220,7 +220,7 @@ public void ImplicitByRefParameter_QuickFixWorks_ParamArrayMustBePassedByRef()
220220
var inspection = new ImplicitByRefParameterInspection(parser.State);
221221
var inspectionResults = inspection.GetInspectionResults();
222222

223-
Assert.AreEqual(2, inspectionResults.First().QuickFixes.Count());
223+
Assert.AreEqual(0, inspectionResults.Count());
224224
}
225225

226226
[TestMethod]

0 commit comments

Comments
 (0)