-
Notifications
You must be signed in to change notification settings - Fork 302
ParameterCanBeByValInspection
Description: Parameter can be passed by value
Type: CodeInspectionType.CodeQualityIssues
Default severity: CodeInspectionSeverity.Suggestion
This inspection finds procedure parameters that are passed by reference, but never assigned to.
Parameter foo
is passed ByRef
, but is never assigned to - passing it ByVal
would be more appropriate:
Public Sub DoSomething(ByRef foo As Integer)
DoSomethingElse foo
End Sub
A ByRef
parameter can technically be reassigned by the called procedure, and the modified value is visible to the caller; if a method doesn't assign such a parameter, that parameter can safely be passed by value instead.
QuickFix: Pass parameter by value
Public Sub DoSomething(ByVal foo As Integer)
DoSomethingElse foo
End Sub
This quickfix replaces ByRef
with ByVal
in the method's signature for the unassigned parameter.
rubberduckvba.com
© 2014-2021 Rubberduck project contributors
- Contributing
- Build process
- Version bump
- Architecture Overview
- IoC Container
- Parser State
- The Parsing Process
- How to view parse tree
- UI Design Guidelines
- Strategies for managing COM object lifetime and release
- COM Registration
- Internal Codebase Analysis
- Projects & Workflow
- Adding other Host Applications
- Inspections XML-Doc
-
VBE Events