withSyntax doesn't work as argument
Created by: jlongster
First, I want to say that sweet.js continues to blow my mind every day and I'm seriously excited about it more than anything else in JS. I'm filing bugs for thoroughness but no pressure to fix them quickly :) Just wanted to say that because I've filed a decent amount of bugs recently.
This works:
macro foo {
case { _ $expr } => {
var expr = #{ $expr };
var res = [];
var out = withSyntax($expr2 = expr) {
return #{ $expr2 }
};
res = res.concat(out);
return res;
}
}
foo 2;
But this doesn't:
macro foo {
case { _ $expr } => {
var expr = #{ $expr };
var res = [];
res = res.concat(withSyntax($expr2 = expr) {
return #{ $expr2 }
});
return res;
}
}
foo 2;
with error:
/Users/james/projects/es6-macros/node_modules/sweet.js/lib/sweet.js:83
throw err$1703;
^
Error: Line 2: Unexpected token ;
at throwError$748 (/Users/james/projects/es6-macros/node_modules/sweet.js/lib/parse
r.js:1082:25)
at throwUnexpected$750 (/Users/james/projects/es6-macros/node_modules/sweet.js/lib/
parser.js:1133:9)
at expect$751 (/Users/james/projects/es6-macros/node_modules/sweet.js/lib/parser.js
:1140:13)
at parseArguments$764 (/Users/james/projects/es6-macros/node_modules/sweet.js/lib/p
arser.js:1409:17)