Closed kkirby closed 11 years ago
The problem is that args is in fact an array of AST nodes, and when injected in a macro, it turns into a block. In the expression syntax, this is done through the comma operator.
So what you're doing is essentially console.log(('testing', 'one', 'two', 'three'))
, and since the first three are no-ops in that position, they are ignored, leaving just console.log('three')
.
What you need to do is convert the args
into an array using @internal-call \array, args
, then you can use it as an array node in your macro.
Here is a full example:
macro A
syntax args as InvocationArguments
let arr = @internal-call \array, args
ASTE console.log ...$arr
A \testing,\one,\two,\three
Hello,
I have this macro:
One would expect this code:
To output:
However, the output is actually:
Is there anyway to return the arguments in the AST expression?