Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Create from Usage

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
Alan Baljeu Posted - Jan 15 2021 : 12:05:40 PM
I am not getting the right options here with Alt-Shift-Q context menu. I want to generate a function in the class indicated by the variable type.



Native C++.

Also, I'm getting a few such failures to perform from VA, such that I'm wondering if there's a problem with VA database. Is there a rebuild option or anything like this?
7   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jan 18 2021 : 11:36:30 AM
Thank you for that, I am seeing the same problem now. Nothing to do with code confusing our parser, as I had guessed, instead a bug inside the logic for when to offer create method:

case=144320

Hopefully you won't run into this problem to often, but at least now we know what the trigger is.
Alan Baljeu Posted - Jan 18 2021 : 10:20:43 AM
Move this to the cpp file:

class FelinePartManagerPresenter : public IFelinePartManagerPresenter
{
private:
FelineMainPartManager mainPartManager;
public:
void testCallingCreateFromUsage();
};
feline Posted - Jan 18 2021 : 10:17:09 AM
I have set up the following test case, the header file holds:

class FelineMainPartManager
{
};
	
class IFelinePartManagerPresenter
{
};
	
class FelinePartManagerPresenter : public IFelinePartManagerPresenter
{
private:
	FelineMainPartManager mainPartManager;
public:
	void testCallingCreateFromUsage();
};


and the matching cpp file contains:

void FelinePartManagerPresenter::testCallingCreateFromUsage()
{
	mainPartManager.NewMemberFunc(3, 4);
	mainPartManager.Foo();
}

and still no sign of any problem here. Am I moving in the right direction with my test?

In your code, what happens if you try Create from Usage inside a member function of the "MainPartManager" class directly? I am wondering if this class is a factor, or if something else might be going on.

If you show VA Outline, does it look correct for your cpp file and the matching header file? If something is confusing our parser then sometimes it will show up here, and this can make it easier to get a clue as to the trigger for the problem.
Alan Baljeu Posted - Jan 18 2021 : 09:08:09 AM
I tried your test and it worked. It also worked moving it to the MainPartManager header file, and it also worked moving the test method into my presenter class. It also worked changing the declaration to
MainPartManager mainPartManager;

It finally stopped working when I removed that declaration and it's supposed to fall back to the member variable of the same name.

Declared as:
class PartManagerPresenter : public IPartManagerPresenter
{
private:
CKPartLogged mainPart;
MainPartManager mainPartManager;


and of note, this declaration is in the .cpp file, the interface is declared in a header.
feline Posted - Jan 18 2021 : 07:15:32 AM
Strange. At a guess, there is something going on in this code that is confusing our parser, but that's just a guess.

Can you please try adding the following simple test code to the top of the file where this is happening, and see if VA offers Create Method correctly on the two new methods:

class FelineCreateMemberVATest
{
public:
	FelineCreateMemberVATest() { }
};
	
void testCallingCreateFromUsage()
{
	FelineCreateMemberVATest mainPartManager;
	mainPartManager.NewMemberFunc(3, 4);
	mainPartManager.Foo();
}

if this works correctly, does it still work correctly if you move the testCallingCreateFromUsage() function to below the function where you are seeing this problem?

I am trying to find out if this is a general problem in the file, or if it might be more limited in scope.
Alan Baljeu Posted - Jan 15 2021 : 1:21:45 PM
Clicked rebuild database. Restarted program. No improvement.

Putting the carat on the variable, I see the variable is correctly identified, both its membership and type.
feline Posted - Jan 15 2021 : 12:36:18 PM
Something isn't right here, clearly. It is certainly possible that a VA symbol database rebuild will help, you can trigger this via:

VA Options -> Performance -> Rebuild symbol databases

if this doesn't help, can you please place the caret into "mainPartManger" and see what, if anything, VA shows in its context and definition fields? These are normally at the top of the editor, and are where the Alt-M list appears.

If VA is confused by this symbol, then it would explain why Create From Usage isn't working correctly on a new function call from this symbol.

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