Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Extract method from a case-statement creates junk

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
Mordachai Posted - Dec 16 2010 : 11:12:29 AM
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).
1   L A T E S T    R E P L I E S    (Newest First)
accord Posted - Dec 16 2010 : 8:29:41 PM
I am seeing the same effect here. Thank you for the clear description.

case=53396

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