can we make it work ?
Yes, but that will increase the parsing time, also, we have many many local variables which have the same name....
Currently, function implementation body was just skipped by the parser.
Anyway, Parsing the function body is just like parsing "class declaration". for example:
void main(){
int a;
int b;
}
So, we have "three tokens" here: "main", "a" , "b" (both "a" and "b" have a parent pointer pointing to "main").
Then only time we parse the function body was when we are doing the "autocompletion stage", at this time, we need to collect the "local tokens", but we only parse the function body where our caret locates. Once we move to another function body, the "local tokens" will be regenerated when we do a "autocompletion stage".
New idea:
According to the real time parse theme, why not collect and update the "local tokens" in real-time? if the local tokens were collected already, we don't need to parse the local blocks when doing "autocompletion stage" any more. Using this method, we don't increase the batch parsing time. Really good idea!!!