Skip to content
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

Add handling of boolean literals to condition evaluation #91

Merged
merged 2 commits into from
Jul 27, 2024

Conversation

GuillaumeGomez
Copy link
Contributor

This PR always checks for booleans in condition_evaluation function. One thing I thought about: we could skip this function entirely if we don't have is (not) defined inside a condition. However, it'd require to either go through all items of the conditions to see if one of them is is (not) defined or to pass a &mut bool to check if the expression encounters one of them.

Another thing I thought: instead of handling the evaluation in the generator, we could potentially handle it in the parser directly (and therefore, not having the branches in the AST if the previous if excluded it). Not sure if it's a good idea or not though.

Anyway, this PR is much simpler than that since it only adds checks for boolean literals. :)

@Kijewski
Copy link
Collaborator

Good idea! Except for the missing newline, approved. :)

@GuillaumeGomez
Copy link
Contributor Author

Woups. Fixed. 😆

@Kijewski Kijewski merged commit ab485df into rinja-rs:master Jul 27, 2024
17 checks passed
@GuillaumeGomez GuillaumeGomez deleted the cond-evaluation branch July 28, 2024 08:23
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