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 places method inside #if#else

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
al_1111 Posted - May 11 2023 : 06:24:04 AM
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.
1   L A T E S T    R E P L I E S    (Newest First)
feline Posted - May 11 2023 : 11:59:01 AM
I am seeing the same effect here. Thank you for the clear description.

case=149520

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