gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

expand: eager evaluate macros inside builtin macros

Open liushuyu opened this issue 2 years ago • 3 comments

  • expand: eagerly evaluate the macros inside some of the builtin macros

liushuyu avatar Sep 03 '22 00:09 liushuyu

The current code is a total mess, I know.

The issue was I discovered some issues in the parser that sometimes parse the expressions incorrectly mid-implementation. So some duck-tape code was thrown in to avoid crashing the parser and ensure no apparent regression was detected by the test suite.

I still opened a PR anyways because I want to collect feedback regarding how to drag the declarative macro expander into the built-in macro expansion. My current approach is to save the expander to MacroInvocData so that it can be picked up in the built-in expander along with the invocation data.

liushuyu avatar Sep 03 '22 00:09 liushuyu

Refactored macro expansion and extraction code

liushuyu avatar Sep 03 '22 05:09 liushuyu

I think overall this is a very cool PR! Thank you so much for working on this :) Would it be possible to add test-cases or is that not yet possible?

It's possible, but I want to get the code to pass the review first, and then I will see how brutal the test cases should be :smile:

liushuyu avatar Sep 15 '22 07:09 liushuyu

LGTM! @liushuyu I think this is in a good state to merge now code-wise - I would just like some tests to make sure everything works well and that I can hack on it without fear of breaking anything :DD As soon as there's some we'll merge it :)

I can add some test cases. But it's very late in my timezone at the moment, so probably tomorrow.

liushuyu avatar Sep 26 '22 07:09 liushuyu

LGTM! @liushuyu I think this is in a good state to merge now code-wise - I would just like some tests to make sure everything works well and that I can hack on it without fear of breaking anything :DD As soon as there's some we'll merge it :)

I can add some test cases. But it's very late in my timezone at the moment, so probably tomorrow.

Sounds good! Sorry again for the delay, was a crazy two weeks. Thanks for working on this I really appreciate it.

CohenArthur avatar Sep 26 '22 07:09 CohenArthur

Rebased against the latest master branch and add a testcase.

liushuyu avatar Sep 27 '22 04:09 liushuyu

Build succeeded:

bors[bot] avatar Sep 27 '22 06:09 bors[bot]