Author |
Topic |
|
EugeneKozlov
Senior Member
Russia
39 Posts |
Posted - Jan 16 2016 : 02:07:25 AM
|
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
3287 Posts |
Posted - Jan 17 2016 : 06:55:49 AM
|
We are considering to implement this at some point:
case=1140
For now, you can use Change Signature to change parameter names. |
|
|
EugeneKozlov
Senior Member
Russia
39 Posts |
Posted - Jan 17 2016 : 09:46:45 AM
|
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 |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Jan 18 2016 : 2:12:34 PM
|
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 |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Jan 18 2016 : 2:20:12 PM
|
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 |
|
|
EugeneKozlov
Senior Member
Russia
39 Posts |
Posted - Jan 19 2016 : 04:49:33 AM
|
> 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 |
|
|
feline
Whole Tomato Software
United Kingdom
19025 Posts |
Posted - Jan 19 2016 : 4:09:46 PM
|
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 |
|
|
EugeneKozlov
Senior Member
Russia
39 Posts |
Posted - Jan 20 2016 : 1:38:35 PM
|
> 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? |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Jan 20 2016 : 4:05:38 PM
|
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.
|
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Feb 02 2016 : 7:52:24 PM
|
Change Signature failing to rename the parameter in the implementation is fixed in build 2089. However, case=20637 is still open. |
|
|
ChrisG
Whole Tomato Software
USA
299 Posts |
|
|
Topic |
|