Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Change Signature

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Mike ONeill Posted - Jun 23 2011 : 04:33:08 AM
Am I expecting too much ?

When I use Change Signature , to add a new Parameter into a method , should it update all references to the method

It doesn't seem to

This VS2010 C# VAX 1850

eg private int Test(int anyNumber, int multiplier)
{
return anyNumber * 20;
}

private void UseTest()
{
int z = Test(10);
}

Cheers

Mike
7   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Feb 26 2014 : 10:37:38 AM
case=58410 is implemented in build 2029
feline Posted - Jun 27 2011 : 3:12:21 PM
I have now had a look at how this works in ReSharper, and it is an interesting idea, especially since I now see how optional it is, and easy to ignore if not wanted.

We are trying to keep our refactoring dialogs more streamlined, but something could be done to help here. So I have put in a feature request to see what our developers make of it:

case=58410
feline Posted - Jun 27 2011 : 10:10:02 AM
This is an interesting idea, but I am not quite sure what to make of it. When you are dealing with a simple type, a default parameter is fairly easy to define. But what about more complex types? Class types? Pointers? References?

The other basic question is what are you trying to achieve. Obviously in this case a "default" parameter was acceptable in all cases, but I am wondering how common this is. Because I come from a C++ background in this situation I would just add a new parameter with a default value, so I would only have to add the parameter to function calls where I needed something other than the default value.
Mike ONeill Posted - Jun 26 2011 : 04:15:52 AM
Spot On

What I wanted is as you say a dummy parameter added to each call to that method , after refactoring .

If you look at how other Refactor tools deal with this , this is what they give .

For example R# gives you an option of

a) Not adding ,
b) adding 0 in the case of an int or to
c) add a specified integer .

And similar with other variable types.

On the face of it VAX , adjusts the method itself , but does not adjust any calls to that method , simply showing you where you need to go to adjust them manually .

This is fine if its a few calls but in my initial requirement , it was adjusting a method I had used repeatedly , so the number of manual adjustments was horrendous , maybe even hundreds. I actually used R# to do it and it was done in seconds.

Mike
feline Posted - Jun 23 2011 : 5:02:26 PM
I am not sure I understand. I think you started with this:

private int Test(int anyNumber)
{
	return anyNumber * 20;
}

private void UseTest()
{
	int z = Test(10);
}


ran Change Signature to get:

private int Test(int anyNumber, int multiplier)
{
	return anyNumber * 20;
}

private void UseTest()
{
	int z = Test(10);
}


but wanted:

private int Test(int anyNumber, int multiplier)
{
	return anyNumber * 20;
}

private void UseTest()
{
	int z = Test(10, 0);
}


is this correct? To have VA automatically add a dummy parameter to each of the function calls that need to be updated?
Mike ONeill Posted - Jun 23 2011 : 11:25:55 AM
Sorry maybe not as clear as it could be ...

I set up Test with One Parameter and then used it in the second method.

I now did Refactor Change Signature on Test to add the second parameter (int multipler) , expecting where I called Test to add the second parameter in the Method Call [int z = Test(10, <>)] as say a default 0 value, but it didn't

It did as you say show me where I should make the changes by showing Find Reference.

I tried it to see how it worked, as I wanted to add a new Parameter to a Method I have used hundreds of times already . Its an Exception Manager with 2 Parameters I wanted add "Show Message" bool as a third

In this case it changed the Method and showed me hundreds of places I need to adjust , Not too helpful I am afraid .

Is this the designed behavior

Mike
feline Posted - Jun 23 2011 : 09:44:05 AM
In your example, what would you like VA to do? It is not obvious to me what VA could sensibly do here.

When you run Change Signature and VA detects a change to the parameters, you should get a message box telling you this, and VA triggers a Find References on the function call, to help you locate all of the calls that need to be updated.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000