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 places method inside #if#else
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

al_1111
Starting Member

Germany
1 Posts

Posted - May 11 2023 :  06:24:04 AM  Show Profile  Reply with Quote
Minimal example code:

  struct ProgramContext{};
  struct DebugContext{};

#define SOME_DEBUG_DEFINE 1
#if SOME_DEBUG_DEFINE
  int fun( ProgramContext* pContext, DebugContext* pDebugContext )
#else
  int fun( ProgramContext* pContext )
#endif
  {
    int select_this_line_and_extract_method_with_VA = 1;

    (void)pContext;
#if SOME_DEBUG_DEFINE
    (void)pDebugContext;
#endif 
  }


Selecting the select_this... line and letting VA "Extract Method" the method is reliably placed inside the #else-#endif block below the second function header, even if that #else is turned off. This works with code blocks of any size inside such a code situation, not just one line.

It should not place it inside the #if at all, much less between a function header and its body.

I searched the forums and couldn't find this bug yet.
Thank you.

feline
Whole Tomato Software

United Kingdom
18746 Posts

Posted - May 11 2023 :  11:59:01 AM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the clear description.

case=149520

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