Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Improve 'Rename' for function parameters
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

EugeneKozlov
Senior Member

Russia
37 Posts

Posted - Jan 16 2016 :  02:07:25 AM  Show Profile  Reply with Quote
Hello,

I suppose that 'Rename' of function parameter should change both definition and declaration.
It is better than change only one piece of function, isn't it?

Thank you

Edited by - EugeneKozlov on Jan 16 2016 04:42:53 AM

accord
Whole Tomato Software

United Kingdom
3164 Posts

Posted - Jan 17 2016 :  06:55:49 AM  Show Profile  Reply with Quote
We are considering to implement this at some point:

case=1140

For now, you can use Change Signature to change parameter names.
Go to Top of Page

EugeneKozlov
Senior Member

Russia
37 Posts

Posted - Jan 17 2016 :  09:46:45 AM  Show Profile  Reply with Quote
However, Change Signature does not perform Rename for parameters. It just change header without touching body.

PS: I see 10 topics starting from 2007 except my one. So.. It will not be fixed soon, am I right?

Edited by - EugeneKozlov on Jan 17 2016 09:50:35 AM
Go to Top of Page

sean
Whole Tomato Software

USA
2641 Posts

Posted - Jan 18 2016 :  2:12:34 PM  Show Profile  Reply with Quote
Yes, it appears that when the declaration and definition do not use the same parameter name, Change Signature will only make the declaration match the definition. It will not run if the signature is unchanged (as taken from declaration) -- making it impossible to make the definition match the declaration in a single step. Changing the declaration to match the definition is possible in a single step. Getting them in sync as taken from the definition requires two steps.

Once definition and declaration are in sync, Change Signature will modify both as expected.

I have opened a feature request to allow Change Signature to run in this scenario (out of sync, trying to make declaration match definition). case=94526

Edited by - sean on Jan 18 2016 2:13:27 PM
Go to Top of Page

sean
Whole Tomato Software

USA
2641 Posts

Posted - Jan 18 2016 :  2:20:12 PM  Show Profile  Reply with Quote
I should note that my previous comment only applies when the parameter names are out of sync (when comparing definition vs declaration).

This statement is incorrect in other cases:
>However, Change Signature does not perform Rename for parameters. It just change header without touching body.

Change Signature does in fact update both definition and declaration (since 2013 as of build 2007).

Edited by - sean on Jan 18 2016 2:42:32 PM
Go to Top of Page

EugeneKozlov
Senior Member

Russia
37 Posts

Posted - Jan 19 2016 :  04:49:33 AM  Show Profile  Reply with Quote
> This statement is incorrect in other cases
All my classes are placed in the namespace. Change Signature is always adding garbage namespace prefix.
So it always 'thinks' that my definition is out-of-sync.

Edited by - EugeneKozlov on Jan 19 2016 04:50:00 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
15984 Posts

Posted - Jan 19 2016 :  4:09:46 PM  Show Profile  Reply with Quote
I think I am seeing the same problem. Using this simple test case, this code in the header file:

namespace spaceTestingChangeSig
{
	class testRefactoring
	{
		void testRenameParamUsingNamespace(int nSecond);
	};

}

and this code in the matching cpp file:

using namespace spaceTestingChangeSig;

void testRefactoring::testRenameParamUsingNamespace(int nSecond)
{
	nSecond += 2;
}

triggering Change Signature on the function and making a change works, both the declaration and the implementation are updated correctly, but the namespace is added to the implementation, even though it is not needed.

case=85429

Is this what you are seeing?

zen is the art of being at one with the two'ness
Go to Top of Page

EugeneKozlov
Senior Member

Russia
37 Posts

Posted - Jan 20 2016 :  1:38:35 PM  Show Profile  Reply with Quote
> triggering Change Signature on the function and making a change works, both the declaration and the implementation are updated correctly
Implementation is not updated correctly.
I has the following code after Change Singature for your example:
using namespace spaceTestingChangeSig;

void spaceTestingChangeSig::testRefactoring::testRenameParamUsingNamespace(int nFirst)
{
    nSecond += 2;
}


PS: Are cases 20637 and 85429 similar?
Go to Top of Page

sean
Whole Tomato Software

USA
2641 Posts

Posted - Jan 20 2016 :  4:05:38 PM  Show Profile  Reply with Quote
It fails for me as well. It looks like an entirely unrelated issue to the one I thought I was responding to. Thanks for your follow-through.

And yes, it appears that 85429 is a duplicate of 20637.
Go to Top of Page

sean
Whole Tomato Software

USA
2641 Posts

Posted - Feb 02 2016 :  7:52:24 PM  Show Profile  Reply with Quote
Change Signature failing to rename the parameter in the implementation is fixed in build 2089.
However, case=20637 is still open.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000