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
 Technical Support
 Extract method from a case-statement creates junk
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Mordachai
Tomato Guru

USA
224 Posts

Posted - Dec 16 2010 :  11:12:29 AM  Show Profile  Reply with Quote
If I have selected the contents of a case: clause of a switch statement, and ask VA to refactor that into a method, I get very odd method signature.

For example:

void CInactivityBalloonTipEdit::OnTimer(UINT_PTR nIDEvent)
{
	switch (nIDEvent)
	{
	case TIMER_SHOW:
		TRACE("%s TIMER_SHOW\\n",__FUNCTION__);

		// kill outstanding timers (if any)
		if (m_bHideTimer)
			KillTimer(TIMER_HIDE);
		if (m_bShowTimer)
			KillTimer(TIMER_SHOW);
		break;
...


If I highlight the block labeled "kill outstanding timers...", but not including the break, and ask for VA to refactor into a method, I get:

void MyMethod(case TIMER_HIDE:: TIMER_HIDE, case TIMER_SHOW:: TIMER_SHOW)


This makes no sense. It should have suggested a simple void x(void) signature (in this case, since there are no references to anything outside of the highlighted block).

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Dec 16 2010 :  8:29:41 PM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the clear description.

case=53396
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