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 - return value is not deduced
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Valiko
New Member

6 Posts

Posted - Sep 04 2015 :  07:09:55 AM  Show Profile  Reply with Quote
If you select code between horizontal lines and click Refactor (VA) -> Extract Method, VAX will propose to create method with return type void, whereas it could be deduced that this method should return lineLength.
Thanks!


#include <windows.h>
#include <stdio.h>

int main(int argc, char* argv[])
{
    // Select this text and click Refactor (VA) -> Extract Method
    // VAX will create "void MyMethod()" whereas I expect "unsigned MyMethod()"
    // to return variable lineLength which is used later in printf.
    //-----------------------------------------------
    HANDLE hInput = GetStdHandle(STD_OUTPUT_HANDLE);
    if (hInput == INVALID_HANDLE_VALUE)
        printf("GetStdHandle(STD_OUTPUT_HANDLE) failed.");
    CONSOLE_SCREEN_BUFFER_INFOEX csbie;
    csbie.cbSize = sizeof(csbie);
    unsigned lineLength;
    if (!GetConsoleScreenBufferInfoEx(hInput, &csbie))
    {
        printf("GetConsoleScreenBufferInfoEx() failed.");
        lineLength = 80;
    }
    else
        lineLength = csbie.dwSize.X;
    //-----------------------------------------------

    printf("%u\\n", lineLength);
    return 0;
}


Visual Assist version 10.9.2074.
Visual Studio 2015 Community.

Edited by - Valiko on Sep 04 2015 12:34:11 PM

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 04 2015 :  3:51:37 PM  Show Profile  Reply with Quote
Yes, I was able to reproduce the problem here. We're planing to improve how it works:

case=91596
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