Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The code has an optional implicity-byref parameter and I want to suppress the OptionalArguments migration for this method. The methods is called in the VBP where it is declared and from external VBPs (after SharedFiles)other VBPs in the system.

Code Block
Public Function SearchForWindow(PartTitle$, Optional SwitchTo, Optional WholeTitleFoundOUT) As Long  <-- WholeTitleFoundOUT must remain ByRef

Some calls passed all parameters:

hWndLoc& = SearchForWindow(OrigCaption, False, NameString)

Some calls omit the optional parameters:

hWnd = SearchForWindow(ReaderServerWindowName(iServerNo))
hWnd = SearchForWindow(ReaderServerWindowName(iReaderServerNoIN))
hWnd = SearchForWindow(ReaderServerWindowNameFromReader(iReaderIndexIN))
hWnd = SearchForWindow(SReaderServerWindowNamePrefix())


Answer

You can add migStatus=DoNotOverload to a method in a custom IDF or with a Refactor/Migrate command.


Code Block
<accessor id="Cell" type="Variant" migStatus="DoNotOverload" nPram="6" migpattern="%1d.get_Cell(%2d,%3d,%4d,1,1)">


You may use compile/refactor/fixtype:

Code Block
   <refactor>
         <FixType identifier="APPCommon.SearchForWindow.WholeTitleFoundOUT" status="ByRef" type="String" />
   </refactor>

NOTE: type="String" is added because FixType will suppress the automatic type inference to string so you need to do it here.  

While you are at it, you may want to add a fixtype for SwitchTo:

   <FixType identifier="APPCommon.SearchForWindow.SwitchTo" type="Boolean" />


Bonus

Question: How to report cases where an implicit byref explicit optional was migrated to byval optional?

Answer: Search the definition report for byval.*optional.*changed