-
Notifications
You must be signed in to change notification settings - Fork 27
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
Refactoring #94
Refactoring #94
Conversation
[expand_macro_application], for better readability.
This leads to a better type error message when the definition of the type [node] evolves.
[expand_list] always preserves [enable_loc]. (Proof: every update of [g.enable_loc] is protected by a call to [preserving_enable_loc].) So, protecting a call to [expand_list] with [preserving_enable_loc] is unnecessary.
…= false]. The previous call to [expand_list ... (text ...)] always leaves [g.require_location] set to [false]. (Proof: [text ...] always ends with a non-space [`Text] item, and processing such an item sets [g.require_location] to [false].) So, this change should not have any impact, and it makes the code cleaner. Ideally, [expand_ordinary_ident] should be a one-line function. We are almost there.
…_loc]. This makes no difference, I believe. Proof (sketch): [g.call_loc] is read only when the macros __FILE__, __LINE__ or CONCAT are expanded. So it is sufficient to update at macro invocations. There is no need to update it here.
This function is now just a one-liner, so it can be expanded away.
What testing did you do to make sure the functionality remained the same? |
I just verified that If you think that the current test suite is too small, I would be happy to strengthen it. We could for instance copy the source code of some packages that have a heavy dependency on |
Or perhaps I could create a script that performs a more heavyweight test, such as creating a fresh |
I think that's part of the CI (which is passing): cppo/.github/workflows/build.yml Lines 176 to 198 in 21f0586
|
Thanks, I didn't know. |
Given that all downstream dependants still compile, propose merging if no other concerns arise by Fri 13 Sep AoE. |
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.
I do think we should improve the test suite, fwiw.
|
This PR introduces the functions
expand_ident
andexpand_macro_application
so as to clarify how identifiers are treated bycppo
. In particular, in the case where an identifier is not a macro, the code is significantly simpler than before; it is now clear that such an identifier is treated as text.There should be no change in functionality.
I wanted to propose this simplification before introducing support for
#scope ... #endscope
.