Skip to content

Conversation

@olivia-banks
Copy link
Contributor

@olivia-banks olivia-banks commented Nov 4, 2025

Fixes: #145
Updates test case: #146
Supersedes: #148

This refactors the Loader to accept an existing Parser instance. The change fixes the issue by creating a new parser that inherits variables from the parent environment and recursively calls itself as needed.

subninja now behaves as intended according to reference Ninja. However, changes made in included files currently don’t propagate back to the parent environment as they normally should. Although this technically changes behavior, #145 hasn't been reported before now, suggesting it's not a common case. I tested this against several projects generated by Meson and CMake, including LLVM/Clang, and didn’t encounter any new bugs or regressions.

I ran into borrow checking issues when trying to handle the aforementioned include scope issue (see TODO comment), and since I’m not familiar with Rust—which is why I originally offloaded this issue—I left that part for follow-up work. I figure this is fine since it already wasn't implemented.

Sorry for the delay and PR ping-pong.

Screenshot 2025-11-04 at 10 51 44 AM

Copy link
Owner

@evmar evmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I only have a few requests around the comments

@evmar evmar merged commit b1fead5 into evmar:main Nov 10, 2025
3 checks passed
@evmar
Copy link
Owner

evmar commented Nov 10, 2025

Thank you!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants