-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CPP scope migration #2338
CPP scope migration #2338
Conversation
started making some tweaks in 2ce105d because I noticed some incorrect scopes but ran out of steam. see the new scope fixtures; some are wrong |
Good call. I made some fixes, but there are still some work left to do that will have to wait until tomorrow. |
@pokey I think this is ready now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow yeah getting these right requires work. I did a deep dive on class-like constructs (ie class, enum, struct, and union). I made sure those behave well for "type", "state", "class", "name", and "class name".
I ended up putting multiple scopes in a single file because otherwise the combinatorial explosion was pretty brutal. I know you are not a fan of that style, and I can see your case, but I'm not sure we should be dogmatic about it if it would result in dozens of files. Lmk what you think
Btw one advantage of putting multiple scopes in a single flie is that it can actually catch bugs. You had forgotten to anchor your semicolons to the statement they follow, so we had a bug where you would inadvertently treat two subsequent classes as a single class. Eg
struct aaa {};
struct bbb{};
Would result in one big class for both lines 😳. I was able to notice this because I had tests with multiple scopes, whereas it would not have been caught with a single scope
Anyways, merge if you're happy with my changes
Nicely done. In regards to anchoring the semicolon this is not something that we do in all places. If you search through the code base of scm files you find multiple places where we don't do this. Might of course be okay in those specific scenarios, but I do wonder if that is also an oversight? |
It's a good question. It's possible it works in other places because of the way the hierarchy is. Eg the reason this fails is that the parser will create a series of statements and semicolons all as direct siblings. If other parse trees don't have this flat structure it should be fine. But agreed worth a grep to find examples and test them out at some point |
Checklist