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
 1822: Refactoring and the scope of a variable
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

xMRi
Tomato Guru

Germany
315 Posts

Posted - Apr 27 2010 :  07:28:18 AM  Show Profile  Reply with Quote
See the code sample below.
It just tried to rename the it variable in the inner loop, with the refactoring features.
The parser finds also any other it variables in the outer scope.

Is this by design and wanted?

for (TSET_IDS::iterator it=setUsed.begin(); it!=setUsed.end(); ++it)
{
	// check if only used in one context or if we
	// are about to delete this context.
	const TSET_CTableContext &setContext = mapUsage[*it];

	// We count how often this context is in use by the 
	bool bUsedOutSide = false;
	for (TSET_CTableContext::const_iterator it=setContext.begin(); !bUsedOutSide && it!=setContext.end(); ++it)
	{
		if (it->m_lIdAS!=m_context.m_lIdAS ||
		    (m_context.m_lIdPJ!=0 && it->m_lIdPJ!=m_context.m_lIdPJ) ||
			(m_context.m_lIdRL!=0 && it->m_lIdRL!=m_context.m_lIdRL))
		{
			bUsedOutSide = true;
			break;
		}
	}
}

Martin Richter [rMVP] WWJD http://blog.m-ri.de
"A well-written program is its own heaven; a poorly written
program is its own hell!" The Tao of Programming

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 27 2010 :  1:40:59 PM  Show Profile  Reply with Quote
Unfortunately this is a known problem. It is not wanted, and it should not be by design. I think this is covered by:

case=1767

basically VA's parser sometimes gets a little confused by duplicate symbols.

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