Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

See PRM-1425

 

Abstract
Question/request: to remove an argument from calls to a local method 
Here, "local" means a method declared in the same VBP rather than in an IDF.

This request is based on a possible solution for a project problem.

It is also a request for general help with migrating local symbols..

Background
I am trying to migrate a local method so that one of the arguments is no longer passed to calls. I put together a sample to illustrate the desired effect.

Here is the original VB6:

Public Sub test(arg1 As String, arg2 As String, Optional arg3 As String)
 writeLog "running test"
 writeLog "arg1 = " & arg1
 writeLog "arg2 = " & arg2
 writeLog "arg3 = " & arg3
End Sub
 
Public Sub CallTest()
 test "A", "B", "C"
 test "A", "B"
End Sub 

Here is the desired translation:

public static void test(string arg1,string arg3) // UPGRADE_INFO: hand-coded replacement; removed arg2
{
 writeLog("running test");
 writeLog("arg1 = " + arg1);
 writeLog("arg3 = " + arg3);
}
public static void CallTest()
{
 test("A","C");
 test("A",String.Empty);
}

 

The test provided to includes four scenarios:

  • the method is declared and called locally in a module
  • the method is declared and called locally in a class
  • the method is declared in a class and called from a module
  • the method is declared in a module and called from a class

 

 
<Compile Project="%SrcPath%">
<Refactor>
<Remove identifier="LocalMigrateArg.test" migPattern="%1d(%2d,%4o)\c" />
<Remove identifier="LocalMigrateArg.Class1.test" migPattern="%1d(%2d,%4o)\c"/>
</Refactor>
</Compile>
   
<Refactor>
<Reauthor subprogram="LocalMigrateArg.test"><![CDATA[
public static void test(string arg1,string arg3) // UPGRADE_INFO: hand-coded replacement; removed arg2
{
   writeLog("running test");
   writeLog("arg1 = " + arg1);
   writeLog("arg3 = " + arg3);
}   
]]></Reauthor>
<Reauthor subprogram="LocalMigrateArg.Class1.test"><![CDATA[
public void test(string arg1,string arg3) // UPGRADE_INFO: hand-coded replacement; removed arg2
{
   modLocalMigrateArg.writeLog("running test");
   modLocalMigrateArg.writeLog("arg1 = " + arg1);
   modLocalMigrateArg.writeLog("arg3 = " + arg3);
}   
]]></Reauthor>   
</Refactor>
  • No labels