repeated pattern group can't be used
Created by: jlongster
macro foo {
rule { $($prop:ident = $val) ... } => {
{ $($prop: $val) (,) ... }
}
}
foo bar=3 biz=2
This throws the following error. I'm pretty sure it's a bug. I'm hacking around in patterns.js to fix this, but I'm a little lost. The $prop
variable seems to have 3 matches for some reason (the third being an empty array?), and $val
has 2.
% ./bin/sjs test.js
/Users/james/projects/sweet.js/lib/sweet.js:101
throw err;
^
Error: ASSERT: all non-scalars must have the same length
at assert (/Users/james/projects/sweet.js/lib/syntax.js:17:19)
at /Users/james/projects/sweet.js/lib/patterns.js:737:21
at Array.reduce (native)
at Function._.reduce._.foldl._.inject (/Users/james/projects/sweet.
js/node_modules/underscore/underscore.js:110:28)
at wrapper.(anonymous function) [as reduce] (/Users/james/projects/