Hi, Huki, sorry for the late reply, I'm busy those days. Let me explain something after I re-read the patch post months ago.
First, the function AddConstructors() is
not going to handle the case 3, it is going to handle when user is not explicit define a constructor, such as
class BBB
{
public:
int a;
};
Now, we have some code like:
Now, user hover on the "BBB(6)", then generally, a search TokenTree will happen.
But note that we use the keyword "BBB", also, we search under the scope (global namespace and main() function body), the search result contains only one Token, which is the "class Token BBB". But what a user want is "go to function declaration of BBB()", so there is not such kind of Token in the result. So, as a fallback, we go to the class definition Token (class Token BBB).
Another case is:
class AAA
{
public:
AAA(int b){};
int a;
};
int main()
{
AAA * p = new AAA(6);
When user hover on "AAA(6)", we also do a search by keyword "AAA" in our Token (under the global scope and main() function body), then still you get one result "class Token AAA". Note here the constructor AAA is not in the result, because the constructor is a child Token of the class Token AAA. As a general rule, if an identifier is followed by a '(', this gives a hint that user need to go to some function like Tokens. So, I add the function AddConstructors(), which in the last stage of ResolveExpression(). So that both "class Token AAA" and "constructor AAA" is returned.
Later, "class Token AAA" is removed from the result, so we go to the correct declaration of the constructor.
I'm not sure my patch is going to handle "go to implementation xxxxx", I just think it solve some "go to declaration xxxx" issue.