Rather than have withSyntax
be an expansion of syntaxCase
use the approach of #216 but localized rather than trying to simulate the full lexical scope of a let
binding.
To get a sense of how it works:
function foo() {
return withSyntax ($y = [makeValue(42, null)]) {
return withSyntax ($z = [makeValue(100, null)]) {
return #{$x + $y + $z}
}
}
}
expands:
function foo() {
return function () {
var res = function () {
match.patternEnv = patternModule.extendEnv(match.patternEnv);
match.patternEnv['$y'] = {
level: 0,
match: [makeValue(42, null)]
};
return function () {
var res$2 = function () {
match.patternEnv = patternModule.extendEnv(match.patternEnv);
match.patternEnv['$z'] = {
level: 0,
match: [makeValue(100, null)]
};
return patternModule.transcribe(getTemplate(339), name_stx, match.patternEnv);
}();
match.patternEnv = match.patternEnv.parent;
return res$2;
}();
}();
match.patternEnv = match.patternEnv.parent;
return res;
}();
}
@natefaubion does this look good to you?