Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

Beautify Edit->Show call tip

<< < (2/4) > >>

ollydbg:
applying your patch to trunk and build the whole C::B.

Than I do the following steps:

1, open the project
F:\cb\codeblocks_trunk\src\plugins\codecompletion\parser\parsertest.cbp

2, edit the file "test.h"
to below:

--- Code: ---aaa & f();
aaa const & g();

--- End code ---

3, run the project, here is the log:

--- Code: ---...
--------------L-i-s-t--L-o-g--------------

000055. function aaa & f() [9,0]
000056. function aaa const & g() [11,0]

--- End code ---

it seems the log is correctly.

Note that the List log comes from: parsertest.cpp



--- Code: ---void ParserTest::PrintList()
{
    TokenList& tokens = m_tokensTree->m_Tokens;
    for (TokenList::iterator it = tokens.begin(); it != tokens.end(); it++)
    {
        wxString log;
        log << (*it)->GetTokenKindString() << _T(" ") << (*it)->DisplayName() << _T("\t[") << (*it)->m_Line;
        log << _T(",") << (*it)->m_ImplLine << _T("]");
        ParserTrace(log);
    }
}

--- End code ---

then, DisplayName() will internally call the function:

--- Code: ---wxString Token::DisplayName() const
{
    wxString result;
    if      (m_TokenKind == tkClass)
        return result << _T("class ")     << m_Name << m_BaseArgs << _T(" {...}");
    else if (m_TokenKind == tkNamespace)
        return result << _T("namespace ") << m_Name << _T(" {...}");
    else if (m_TokenKind == tkEnum)
        return result << _T("enum ")      << m_Name << _T(" {...}");
    else if (m_TokenKind == tkTypedef)
    {
        result << _T("typedef");

        if (!m_Type.IsEmpty())
            result << _T(" ") << m_Type;

        if (result.Find('*', true) != wxNOT_FOUND)
        {
            result.RemoveLast();
            return result << m_Name << _T(")") <<  GetFormattedArgs();
        }

        if (!m_TemplateArgument.IsEmpty())
            result << m_TemplateArgument;

        return result << _T(" ") << m_Name;
    }
    else if (m_TokenKind == tkPreprocessor)
    {
        result << _T("#define ") << m_Name << GetFormattedArgs();
        if (!m_Type.IsEmpty())
            return result << _T(" ") << m_Type;
    }

    // else
    if (!m_Type.IsEmpty())
        result << m_Type << m_TemplateArgument << _T(" ");

    if (m_TokenKind == tkEnumerator)
        return result << GetNamespace() << m_Name << _T("=") << GetFormattedArgs();

    return result << GetNamespace() << m_Name << GetStrippedArgs();
}

--- End code ---

Then, I check the m_Type here, it is correct too.

not sure why your problem happens....

oBFusCATed:
Because I was using m_ActualType, now I am using m_Type and it seems to work.

MortenMacFly:

--- Quote from: oBFusCATed on January 04, 2011, 08:28:51 am ---m_ActualType, [...] m_Type

--- End quote ---
Nah - reminds me that m_ActualType is a bad name for that purpose. It leads to confusion like in your case (and happened to me, too).

killerbot:
when it shows the parent of a local variable, say test which is a local var of the function foo(),

not it shows :  int foo::test

Wouldn't it be better to show : int foo()::test, so a clear distinction is visible between method parents or classes/namespaces ?

What do you think ?

oBFusCATed:
Hm, thanks for the report...

I'll try to limit this patch only to functions/methods. For variables it will be a bit annoying.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version