self-compiling switch statements

This commit is contained in:
Jeremy Ashkenas
2010-02-12 16:23:52 -05:00
parent 156a0b13d9
commit 1a6194e9f0
6 changed files with 17 additions and 13 deletions

View File

@@ -381,9 +381,7 @@
SimpleArgs: [o("Expression", function() {
return $1;
}), o("SimpleArgs , Expression", function() {
return ([$1].push($3)).reduce(function(a, b) {
return a.concat(b);
});
return $1 instanceof Array ? $1.concat([$3]) : [$1].concat([$3]);
})
],
// Try/catch/finally exception handling blocks.