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

Minor fixes to docs of UnaryExpression macro nodes #10816

Merged
merged 2 commits into from
Jun 17, 2021

Conversation

HertzDevil
Copy link
Contributor

@HertzDevil HertzDevil commented Jun 12, 2021

  • Indicates that Crystal::Macros::Splat is a subclass of Crystal::Macros::UnaryExpression. This is indeed the case for the underlying ASTNode types (Crystal::Splat < Crystal::UnaryExpression), from which the "subtyping" relationship in the macro language is derived.
  • Documents Crystal::Macros::DoubleSplat. This already works in the language:
    macro foo(node)
      {% arg = node.args[0] %}
      {% arg %}                # => **x
      {% arg.class_name %}     # => "DoubleSplat"
      {% arg.exp %}            # => x
      {% arg.exp.class_name %} # => "Call"
    end
    
    foo(bar(**x))
  • Removes a bit of code in the macro interpreter, since it is exactly the same as the superclass's definition (Crystal::UnaryExpression#interpret).

I left MacroVerbatim untouched. This is intentional because the rest of the macro nodes are undocumented.

Copy link
Member

@sdogruyol sdogruyol left a comment

Choose a reason for hiding this comment

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

Thank you @HertzDevil 🙏

@straight-shoota straight-shoota added this to the 1.1.0 milestone Jun 15, 2021
@straight-shoota straight-shoota merged commit 3a5baba into crystal-lang:master Jun 17, 2021
@straight-shoota
Copy link
Member

Thank you @HertzDevil

@HertzDevil HertzDevil deleted the doc/macro-splats branch June 17, 2021 21:11
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.

3 participants