Given this sweet.js macro
macro m {
case { _ ( $a, $b ) } => {
return #{$a + $b};
}
case { _ ( $a ) } => {
return #{$a};
}
case { _ } => {
return #{no};
}
}
export m;
And this source code:
m(1, [m(2)]);
m(1, m(2));
How do you create a case that yields this output:
1 + [2];
1 + 2;
Instead of this?
1 + [2];
no(1, 2);
P.S. the actual use case requires case macros, not rule macros.