Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: ptDev on April 29, 2010, 12:22:23 am

Title: Global static objects ignored by CC
Post by: ptDev on April 29, 2010, 12:22:23 am
I noticed just now that code completion is very thorough while analysing the scope of declared objects, but to the extreme of ignoring global static objects. Is this behaviour intentional?
Title: Re: Global static objects ignored by CC
Post by: ollydbg on April 29, 2010, 04:44:00 am
I noticed just now that code completion is very thorough while analysing the scope of declared objects, but to the extreme of ignoring global static objects. Is this behaviour intentional?
Ok, I don't fully understand what's your meaning. Can you give a simple test code?

eg:

Code
//global static objects
static int aaa;
???

BTW:The parserthread.cpp do the whole "syntax analyze" job, and this file is quite easy to understand.
Title: Re: Global static objects ignored by CC
Post by: MortenMacFly on April 29, 2010, 06:28:05 am
Probably you should start with telling us the version of C::B you are using.
Title: Re: Global static objects ignored by CC
Post by: ptDev on April 29, 2010, 08:24:57 am
Probably you should start with telling us the version of C::B you are using.

I apoplogize, I wrote this quite late last night, and was a bit too tired to explain properly.

I am running Code::Blocks svn revision 6202, built with MinGW-TDM 4.4.1-2 and wxWidgets 2.8.10.
The code which CC didn't parse properly was something similar to:

Code
#include "myarray.h"
#include "myclass.h"

static myspace::myarray a;  // Global static objects typed before any myclass member functions
static myspace::myarray b;

// ...

void myclass::method()
{
   a.  // ... <-- Here, I typed the access operator, but the CC member list did not appear

}

However, declaring local objects from the same namespace and class resulted in the expected behaviour:

Code
void myclass::method()
{
   myspace::myarray a;
   a.  // ... <-- Here, the CC member list appeared normally

}

If I switched between ommiting the local object or not, so would the CC tooltip disappear or reappear.
Title: Re: Global static objects ignored by CC
Post by: ollydbg on April 30, 2010, 03:17:02 am
Ok, I have just test the sample code like below with our parserTest project.

Code
namespace myspace {

class myarray{
public:
int m_aaa;
}

};

 myspace::myarray a;  // Global static objects typed before any myclass member functions
 myspace::myarray b;

And the output of the parser is like below:
Code
...

000058. namespace namespace myspace {...} [1,1]
000059. class class myarray {...} [3,0]
000060. variable int myspace::myarray::m_aaa [5,0]
000061. variable myarray myspace::a [10,0]
000062. variable myarray myspace::b [11,0]

And if I add the "static" before the statement, I found that the parser give the same result:
Code
...
--------------L-i-s-t--L-o-g--------------

000060. namespace namespace myspace {...} [1,1]
000061. class class myarray {...} [3,0]
000062. variable int myspace::myarray::m_aaa [5,0]
000063. variable myarray myspace::a [10,0]
000064. variable myarray myspace::b [11,0]

So, as a conclusion, I think parser works as expected. So, maybe there's a bug in other part of CC.  :D