Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Problems with extract method in C++

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
space_cowboy Posted - Apr 20 2009 : 11:44:00 AM
This is somewhat similar to http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=8347&SearchTerms=Extract,Method, but not quite the same. I have boiled it down to the following testcode :

TestClass.h

#pragma once

namespace test {
	class SomeTestClass
	{
	public:
		void Foo();

		void Bar();
	};
};

TestClass.cpp

#include "TestClass.h"
#include <iostream>

using namespace test;

void SomeTestClass::Foo()
{
	std::cout << "Foo" << std::endl;
}

void SomeTestClass::Bar()
{
	std::cout << "Bar" << std::endl;
}

If I select the content of the method Foo() and then execute the Extract Method refactoring, i get the following in TestClass.cpp:

#include "TestClass.h"
#include <iostream>

using namespace test;

void SomeTestClass::Foo()
{
	MyMethod();
}

void SomeTestClass::Bar()
{
	std::cout << "Bar" << std::endl;

	void MyMethod()
	{
		std::cout << "Foo" << std::endl;
	}
}

If I delete the using directive in TestClass.cpp and put the namespace qualifier in front of the method names, it works fine. Somehow the using namespace messes it up.

Here is my version info:

VA_X.dll file version 10.5.1722.0 built 2009.03.31
Licensed to:
---
DevEnv.exe version 8.0.50727.762
msenv.dll version 8.0.50727.762
Font: Courier New 13(Pixels)
Comctl32.dll version 6.0.2900.5512
Windows XP 5.1 Build 2600 S
2 processors (x86)

Platform: Win32
Stable Includes:
C:\\Programme\\Microsoft Visual Studio 8\\VC\\include;
C:\\Programme\\Microsoft Visual Studio 8\\VC\\atlmfc\\include;
C:\\Programme\\Microsoft Visual Studio 8\\VC\\PlatformSDK\\include;
C:\\Programme\\Microsoft Visual Studio 8\\SDK\\v2.0\\include;
C:\\Programme\\Microsoft DirectX SDK (August 2007)\\Include;
C:\\Programme\\Intel\\IPP\\5.3.4.087\\ia32\\include;
C:\\Programme\\Microsoft SDKs\\Windows\\v6.1\\Include;

Other Includes:

Stable Source Directories:
C:\\Programme\\Microsoft Visual Studio 8\\VC\\atlmfc\\src\\mfc;
C:\\Programme\\Microsoft Visual Studio 8\\VC\\atlmfc\\src\\mfcm;
C:\\Programme\\Microsoft Visual Studio 8\\VC\\atlmfc\\src\\atl;
C:\\Programme\\Microsoft Visual Studio 8\\VC\\crt\\src;

7   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Feb 02 2016 : 7:54:56 PM
case=4135 is fixed in build 2089.
pridehaveit Posted - Jul 13 2009 : 08:52:25 AM
Thank you for the reply.
I'm looking forward to the version this issue is fixed in.
feline Posted - Jul 08 2009 : 11:01:13 AM
Unfortunately I don't have an estimate on when this will be fixed, but both bugs are down as high priority bugs. The basic problem is that it is possible to confuse our parser with namespaces, as you are finding. So I am not sure how easy this will be to fix, but we are working on the whole issue of namespaces.
pridehaveit Posted - Jul 02 2009 : 04:18:13 AM
Is there a plan when this issue will be fixed?
Best regards pridehaveit

EDIT:
This problem also applies to "Create Declaration".

For methods in a class that is in a namespace the refactoring "Change Signature" is not available.
accord Posted - Apr 21 2009 : 3:30:47 PM
I am seeing the same effect here. Thank you for the clear description.

case=4135
space_cowboy Posted - Apr 21 2009 : 07:50:03 AM
I am putting this in the same thread because I think the problems may be related. In the samplecode I gave above any references to this in the implementation of the functions is underlined red, unless I put the namespace qualifier into the method signature.
accord Posted - Apr 20 2009 : 6:12:12 PM
I am seeing the same effect here. Thank you for the clear description.

case=20072

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