765: -b/--bare <- --no-wrap

This commit is contained in:
satyr
2010-10-14 04:09:56 +09:00
parent 6e89ad3401
commit 88cc1ee35d
13 changed files with 32 additions and 39 deletions

View File

@@ -205,16 +205,15 @@
_result.push(this.compileExpression(node, merge(o)));
}
return _result;
}).call(this).join("\n");
}).call(this).join('\n');
};
Expressions.prototype.compileRoot = function(o) {
var code, wrap;
wrap = (o.wrap != null) ? o.wrap : true;
o.indent = (this.tab = wrap ? TAB : '');
var code;
o.indent = (this.tab = o.bare ? '' : TAB);
o.scope = new Scope(null, this, null);
code = this.compileWithDeclarations(o);
code = code.replace(TRAILING_WHITESPACE, '');
return wrap ? ("(function() {\n" + code + "\n}).call(this);\n") : code;
return o.bare ? code : ("(function() {\n" + code + "\n}).call(this);\n");
};
Expressions.prototype.compileWithDeclarations = function(o) {
var code;
@@ -1138,8 +1137,8 @@
o.top = true;
o.indent = this.idt(1);
empty = this.body.expressions.length === 0;
del(o, 'wrap');
del(o, 'globals');
delete o.bare;
delete o.globals;
splat = undefined;
params = [];
for (i = 0, _len = (_ref2 = this.params).length; i < _len; i++) {