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
 refact:or: create new method
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Mordachai
Tomato Guru

USA
224 Posts

Posted - Nov 09 2010 :  12:33:43 PM  Show Profile  Reply with Quote
I often find I need to specify the return type from such a refactoring (or/and the arguments list). It's simply impossible for VAX to understand what the inputs and outputs should be - but the interface forces me to be constrained to its best guess (wrong).

And I generally find that I cannot immediately follow up with "change method signature" - it's disabled. I assume that creating the new method somehow didn't get properly registered with VAX yet, and so it cannot recognize the symbol in order to allow me to further refactor it?

Fixing both would be ideal: I want to be able to correctly specify the interface when I refactor it initially, /and/ I'd like to be able to refactor the signature immediately if I find I need to further refine it.

:)

Mordachai
Tomato Guru

USA
224 Posts

Posted - Nov 09 2010 :  12:52:21 PM  Show Profile  Reply with Quote
BTW, the reason that VAX gets the initial refactoring wrong so commonly is something like:

	CPoint cursor; 
	VERIFY(GetCursorPos(&cursor));
	ScreenToClient(&cursor);
	HWND hChild = ::ChildWindowFromPoint(m_hWnd, cursor);
	UINT id = hChild ? ::GetDlgCtrlID(hChild) : 0;

Asking for the above, it assumes no return value - but id (UINT) is the return value - it's the sum total from that function, and useless to keep it inside the refactored code!

It would be grand if it looked at unused side-effects and decided that they were the likely output from the refactored code. ;)

Edited by - Mordachai on Nov 09 2010 1:01:45 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18948 Posts

Posted - Nov 15 2010 :  11:39:48 AM  Show Profile  Reply with Quote
Apologies for the delay in replying to this.

Are you using the refactoring command "Extract Method" on this code?

From the documentation: http://www.wholetomato.com/products/features/extractMethod.asp

quote:
Use care when including local variable declarations in the selected text to be extracted. Since the declaration is moved to the extracted method, referencing the variable in the original code outside the selection will result in a compile error.


This is something we are looking to catch, and warn you about:

case=4510

but this has not yet been done.

As for Change Signature, our parser does need a few moments to reparse the code after making the change, but this should only take a couple of seconds or so, after which you can run Change Signature on the new method.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000