Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of https://github.com/glenjamin/node-bunker int…

…o glenjamin-master
  • Loading branch information...
commit 72485ec7c67017064b8cac86cd70646c52b114f0 2 parents 2b29ce8 + b21eb2b
@substack authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 index.js
View
11 index.js
@@ -44,6 +44,17 @@ Bunker.prototype.compile = function () {
nodes.push(node);
node.wrap('{' + names.stat + '(' + i + ');%s}');
}
+ else if (node.name === 'return') {
+ nodes.push(node);
+ // We need to wrap the new source in a function definition
+ // so that UglifyJS will allow the presence of return
+ var stat = names.stat + '(' + i + ');';
+ var wrapped = 'function a(){{' + stat + node.source() +'}}';
+ var parsed = burrito.parse(wrapped);
+ // Remove the function definition from the AST
+ parsed[1] = parsed[1][0][3];
+ node.state.update(parsed, true);
+ }
else if (node.name === 'binary') {
nodes.push(node);
node.wrap(names.expr + '(' + i + ')(%s)');
Please sign in to comment.
Something went wrong with that request. Please try again.