jamesjuett / lobster

Interactive Program Visualization Tools
8 stars 3 forks source link

fix processFunctionDeclarator does not check function const-qualifier… #325

Open iteemhe opened 2 years ago

iteemhe commented 2 years ago

… and if it is a member function

296

iteemhe commented 2 years ago

False positive has been fixed. Convert to a pull request

Screen Shot 2022-03-09 at 18 52 12

jamesjuett commented 2 years ago

Your fix is I think the best way to handle this given that the Declarator itself doesn't carry any information about the presence of that const other than in the recieverType, which will be undefined if it's not a member function.

But, I think the best approach would be to fix the underlying issues/bugs (which are obviously not your fault!):

In FunctionDefinition.ts there's some relevant code: image

Here, in the case of an out-of-line definition, the declarator that's created actually comes out with a type is a function type with an undefined receiverType. We'd need to either fix this somehow by comparing to the linked entity it's matched against, or I suppose ensure the proper class context was originally provided to the declarator somehow. Perhaps the Declarator class could actually preprocess the qualified name to determine that?

I'm not sure - this issue goes a bit deeper. Lobster unfortunately wasn't built with qualified names in mind and the support is a little bit shaky.

I'll need to think about this a bit more...