Created
March 28, 2016 22:35
-
-
Save Ragmaanir/2a8f292bf3d76b2f0ee2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# flatten a tuple literal | |
macro flatten_tuple(t) | |
{% | |
queue = [] of ASTNode | |
res = [] of ASTNode | |
%} | |
{% for e in t %} | |
{% queue << e %} | |
{% end %} | |
{% for e in queue %} | |
{% if e.class_name == "TupleLiteral" %} | |
{% for n in e %} | |
{% queue << n %} | |
{% end %} | |
{% else %} | |
{% res << e %} | |
{% end %} | |
{% end %} | |
{ {{*res}} } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment