Skip to content

Conversation

@the-fck
Copy link

@the-fck the-fck commented Nov 1, 2025

The constructor for this specifies that after original_name comes position:

AstBase(const AstBase &ast, const char *original_name, size_t position = 0,
          size_t length = 0, size_t original_choice_count = 0,
          size_t original_choice = 0)

But in this case, choice_count came next.

@yhirose
Copy link
Owner

yhirose commented Nov 2, 2025

@the-fck thanks for the pull request. I don't fully understand what this pull request for. Could you explain more about this issue and provide a unit test for this pull request? Then, I'll start reviewing it. Thanks!

@the-fck
Copy link
Author

the-fck commented Nov 2, 2025

@the-fck thanks for the pull request. I don't fully understand what this pull request for. Could you explain more about this issue and provide a unit test for this pull request? Then, I'll start reviewing it. Thanks!

Sure, I'm happy to better explain the fix here. In struct AstOptimizer, there is a spot where a new AST is constructed, but the parameters to that constructor do not match the expected order. Specifically, this leads to the position, length, and choice_count fields being incorrect in the new node. This PR moves the parameter original->choice_count to be in the expected location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants