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.
...
Code Block |
---|
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:
...
Code Block |
---|
<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> |
Another example
Notice the remove@migPattern, does not specify the original method: It is %1d, not %1d.method. Also notice that for the sub replacement we include "\c" to terminate the statement, but for the function call this must not be used as doing so will usually result in malformations.
Code Block |
---|
<ScriptRule id="Lang.DataField" Condition="%TaskTag%=='upg'"> <PreAnalyse> <Refactor Condition="%SrcName%=='CIMS'"> <Remove identifier="CIMS.CListenerCollection.BindVBFormToADORecordset" migPattern="%1d(%2d,%3d,%4d, this.dataSourcer1)" /> <Remove identifier="CIMS.CListenerCollection.BindADORecordsetToVBForm" migPattern="%1d(%2d,%3d,%4d, this.dataSourcer1)\c" /> <Reauthor subprogram="VBControlHasDataFieldProperty"><![CDATA[ // UPGRADE_INFO: hand-coded. Add DataSourcer object to signature and simplify implementation . public bool BindVBFormToADORecordset(MigrationSupport.DataLib.SqlClient.Recordset rs,System.Windows.Forms.Form obFrm,string strRecordsetKey, MigrationSupport.UI.DataSourcer ds) ... ]]> </Reauthor> <Reauthor subprogram="BindADORecordsetToVBForm"><![CDATA[ // UPGRADE_INFO: hand-coded. Add DataSourcer object to signature and updated some of the code using the "dynamic" keyword. public void BindADORecordsetToVBForm(MigrationSupport.DataLib.SqlClient.Recordset rs,System.Windows.Forms.Form obFrm,string strRecordsetKey, MigrationSupport.UI.DataSourcer ds) ... ]]></Reauthor> </Refactor> </PreAnalyse> </ScriptRule> |