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

Allow differentiating between macro if and unless #15287

Closed
Blacksmoke16 opened this issue Dec 18, 2024 · 0 comments · Fixed by #15304
Closed

Allow differentiating between macro if and unless #15287

Blacksmoke16 opened this issue Dec 18, 2024 · 0 comments · Fixed by #15304

Comments

@Blacksmoke16
Copy link
Member

Blacksmoke16 commented Dec 18, 2024

Feature Request

A MacroIf ASTNode represents an if statement within a macro:

{% if cond %}
  puts "Then"
{% else %}
  puts "Else"
{% end %}

However, the same node type is used to represent:

{% unless cond %}
  puts "Unless"
{% end %}

But based on the current API there is no way to tell the difference between an if and unless.

I propose we implement some way to be able to differentiate between the two types. Current ideas include:

  1. Either have a dedicated MacroUnless node This would be a breaking change
  2. Add some sort of boolean flag #is_unless? method to the current node type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant