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 introduces invalid syntax

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
legalize Posted - Jun 16 2014 : 10:56:55 AM
See test suite at http://d3dgraphicspipeline.codeplex.com/releases/view/39824
int (*Method2(int x))()
{
    int (*result)();
    if (x < 0)
    {
        // #TEST#: EM2 Extract Method on next line
        result = Function1;
    }
    else
    {
        result = Function2;
    }
    return result;
}

Extracted method looks like this:
int (* MyMethod(int (* result)
{
    result = Function1;
    return result;
}

The syntax is invalid.
There is no need to pass in result as an argument to the extracted method.
2   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jun 16 2014 : 2:46:31 PM
I am seeing the same effect here. Thank you for the clear description.

case=82956

I found the first problem when working through ExtractFunction.cpp. The second example is indeed the same problem, with a slightly different initial state.
legalize Posted - Jun 16 2014 : 10:59:33 AM
Similar problem when the type is a pointer to member function:

void (Bar::*Method3(int x))(int)
{
    void (Bar::*member)(int);
    if (x < 0)
    {
        // #TEST#: EM3 Extract Method on next line
        member = &Bar::Operation1;
    }
    else
    {
        member = &Bar::Operation2;
    }
    return member;
}

Extract Method for EM3 yields:

void (Bar::* MyMethod(void (Bar::* member)
{
    member = &Bar::Operation1;
    return member;
}

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