fixing extra spaces in nested empty functions. Issue #527
This commit is contained in:
parent
9c4164e7a3
commit
8262070f5c
|
@ -17,7 +17,7 @@
|
|||
starts = _c.starts;
|
||||
compact = _c.compact;
|
||||
exports.Lexer = (function() {
|
||||
Lexer = function() { };
|
||||
Lexer = function() {};
|
||||
Lexer.prototype.tokenize = function(code, options) {
|
||||
var o;
|
||||
code = code.replace(/(\r|\s+$)/g, '');
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
starts = _a.starts;
|
||||
ends = _a.ends;
|
||||
exports.BaseNode = (function() {
|
||||
BaseNode = function() { };
|
||||
BaseNode = function() {};
|
||||
BaseNode.prototype.compile = function(o) {
|
||||
var closure, top;
|
||||
this.options = merge(o || {});
|
||||
|
@ -984,7 +984,7 @@
|
|||
(o.scope.parameter(param));
|
||||
}
|
||||
code = this.body.expressions.length ? ("\n" + (this.body.compileWithDeclarations(o)) + "\n") : '';
|
||||
func = ("function(" + (params.join(', ')) + ") {" + code + (this.idt(this.bound ? 1 : 0)) + "}");
|
||||
func = ("function(" + (params.join(', ')) + ") {" + code + (code && this.idt(this.bound ? 1 : 0)) + "}");
|
||||
if (top && !this.bound) {
|
||||
func = ("(" + func + ")");
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
_b = helpers;
|
||||
include = _b.include;
|
||||
exports.Rewriter = (function() {
|
||||
Rewriter = function() { };
|
||||
Rewriter = function() {};
|
||||
Rewriter.prototype.rewrite = function(tokens) {
|
||||
this.tokens = tokens;
|
||||
this.adjustComments();
|
||||
|
|
|
@ -882,7 +882,7 @@ exports.CodeNode: class CodeNode extends BaseNode
|
|||
@body.makeReturn()
|
||||
(o.scope.parameter(param)) for param in params
|
||||
code: if @body.expressions.length then "\n${ @body.compileWithDeclarations(o) }\n" else ''
|
||||
func: "function(${ params.join(', ') }) {$code${@idt(if @bound then 1 else 0)}}"
|
||||
func: "function(${ params.join(', ') }) {$code${ code and @idt(if @bound then 1 else 0) }}"
|
||||
func: "($func)" if top and not @bound
|
||||
return func unless @bound
|
||||
inner: "(function() {\n${@idt(2)}return __func.apply(__this, arguments);\n${@idt(1)}});"
|
||||
|
|
Loading…
Reference in New Issue