adding correct semicolons to bound functions

This commit is contained in:
Jeremy Ashkenas
2010-07-24 00:45:00 -07:00
parent e41abe2d83
commit 85ed376748
3 changed files with 10 additions and 10 deletions

View File

@@ -999,7 +999,7 @@
if (!(this.bound)) { if (!(this.bound)) {
return func; return func;
} }
return "(function(_this) {\n" + (this.idt(1)) + "return " + func + "\n" + this.tab + "})(this)"; return "(function(_this) {\n" + (this.idt(1)) + "return " + func + ";\n" + this.tab + "})(this)";
}; };
CodeNode.prototype.topSensitive = function() { CodeNode.prototype.topSensitive = function() {
return true; return true;

View File

@@ -59,7 +59,7 @@
return 2; return 2;
} }
return 1; return 1;
} };
})(this)); })(this));
}; };
Rewriter.prototype.removeLeadingNewlines = function() { Rewriter.prototype.removeLeadingNewlines = function() {
@@ -78,7 +78,7 @@
} }
_this.tokens.splice(i, 1); _this.tokens.splice(i, 1);
return 0; return 0;
} };
})(this)); })(this));
}; };
Rewriter.prototype.closeOpenCallsAndIndexes = function() { Rewriter.prototype.closeOpenCallsAndIndexes = function() {
@@ -112,7 +112,7 @@
} }
} }
return 1; return 1;
} };
})(this)); })(this));
}; };
Rewriter.prototype.addImplicitParentheses = function() { Rewriter.prototype.addImplicitParentheses = function() {
@@ -128,7 +128,7 @@
size = stack[stack.length - 1] + 1; size = stack[stack.length - 1] + 1;
stack[stack.length - 1] = 0; stack[stack.length - 1] = 0;
return size; return size;
} };
})(this); })(this);
return this.scanTokens((function(_this) { return this.scanTokens((function(_this) {
return function(prev, token, post, i) { return function(prev, token, post, i) {
@@ -177,7 +177,7 @@
return 1; return 1;
} }
return 1; return 1;
} };
})(this)); })(this));
}; };
Rewriter.prototype.addImplicitIndentation = function() { Rewriter.prototype.addImplicitIndentation = function() {
@@ -224,7 +224,7 @@
} }
_this.tokens.splice(i, 1); _this.tokens.splice(i, 1);
return 0; return 0;
} };
})(this)); })(this));
}; };
Rewriter.prototype.ensureBalance = function(pairs) { Rewriter.prototype.ensureBalance = function(pairs) {
@@ -255,7 +255,7 @@
} }
} }
return 1; return 1;
} };
})(this)); })(this));
unclosed = (function() { unclosed = (function() {
_c = []; _d = levels; _c = []; _d = levels;
@@ -315,7 +315,7 @@
} else { } else {
return 1; return 1;
} }
} };
})(this)); })(this));
}; };
Rewriter.prototype.indentation = function(token) { Rewriter.prototype.indentation = function(token) {

View File

@@ -892,7 +892,7 @@ exports.CodeNode: class CodeNode extends BaseNode
func: "function(${ params.join(', ') }) {$code${ code and @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 func: "($func)" if top and not @bound
return func unless @bound return func unless @bound
"(function(_this) {\n${@idt(1)}return $func\n$@tab})(this)" "(function(_this) {\n${@idt(1)}return $func;\n$@tab})(this)"
topSensitive: -> topSensitive: ->
true true