mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-19 03:44:23 -05:00
fixing extra spaces in nested empty functions. Issue #527
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
starts = _c.starts;
|
starts = _c.starts;
|
||||||
compact = _c.compact;
|
compact = _c.compact;
|
||||||
exports.Lexer = (function() {
|
exports.Lexer = (function() {
|
||||||
Lexer = function() { };
|
Lexer = function() {};
|
||||||
Lexer.prototype.tokenize = function(code, options) {
|
Lexer.prototype.tokenize = function(code, options) {
|
||||||
var o;
|
var o;
|
||||||
code = code.replace(/(\r|\s+$)/g, '');
|
code = code.replace(/(\r|\s+$)/g, '');
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
starts = _a.starts;
|
starts = _a.starts;
|
||||||
ends = _a.ends;
|
ends = _a.ends;
|
||||||
exports.BaseNode = (function() {
|
exports.BaseNode = (function() {
|
||||||
BaseNode = function() { };
|
BaseNode = function() {};
|
||||||
BaseNode.prototype.compile = function(o) {
|
BaseNode.prototype.compile = function(o) {
|
||||||
var closure, top;
|
var closure, top;
|
||||||
this.options = merge(o || {});
|
this.options = merge(o || {});
|
||||||
@@ -984,7 +984,7 @@
|
|||||||
(o.scope.parameter(param));
|
(o.scope.parameter(param));
|
||||||
}
|
}
|
||||||
code = this.body.expressions.length ? ("\n" + (this.body.compileWithDeclarations(o)) + "\n") : '';
|
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) {
|
if (top && !this.bound) {
|
||||||
func = ("(" + func + ")");
|
func = ("(" + func + ")");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
_b = helpers;
|
_b = helpers;
|
||||||
include = _b.include;
|
include = _b.include;
|
||||||
exports.Rewriter = (function() {
|
exports.Rewriter = (function() {
|
||||||
Rewriter = function() { };
|
Rewriter = function() {};
|
||||||
Rewriter.prototype.rewrite = function(tokens) {
|
Rewriter.prototype.rewrite = function(tokens) {
|
||||||
this.tokens = tokens;
|
this.tokens = tokens;
|
||||||
this.adjustComments();
|
this.adjustComments();
|
||||||
|
|||||||
@@ -882,7 +882,7 @@ exports.CodeNode: class CodeNode extends BaseNode
|
|||||||
@body.makeReturn()
|
@body.makeReturn()
|
||||||
(o.scope.parameter(param)) for param in params
|
(o.scope.parameter(param)) for param in params
|
||||||
code: if @body.expressions.length then "\n${ @body.compileWithDeclarations(o) }\n" else ''
|
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
|
func: "($func)" if top and not @bound
|
||||||
return func unless @bound
|
return func unless @bound
|
||||||
inner: "(function() {\n${@idt(2)}return __func.apply(__this, arguments);\n${@idt(1)}});"
|
inner: "(function() {\n${@idt(2)}return __func.apply(__this, arguments);\n${@idt(1)}});"
|
||||||
|
|||||||
Reference in New Issue
Block a user