From c3410e722e1543516d564621cf72e6840b19d541 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Mon, 12 Jul 2010 22:51:10 -0400 Subject: [PATCH] (cosmetic) removing occasional extra linebreaks in JS generated from class definitions. --- lib/nodes.js | 8 ++++---- src/nodes.coffee | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/nodes.js b/lib/nodes.js index 33fed78f..23c23f6b 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -771,10 +771,10 @@ } construct = this.idt() + (new AssignNode(this.variable, constructor)).compile(merge(o, { sharedScope: constScope - })) + ';\n'; - props = props.empty() ? '' : props.compile(o) + '\n'; - extension = extension ? this.idt() + extension.compile(o) + ';\n' : ''; - returns = this.returns ? new ReturnNode(this.variable).compile(o) : ''; + })) + ';'; + props = !props.empty() ? '\n' + props.compile(o) : ''; + extension = extension ? '\n' + this.idt() + extension.compile(o) + ';' : ''; + returns = this.returns ? '\n' + new ReturnNode(this.variable).compile(o) : ''; return "" + construct + extension + props + returns; }; return ClassNode; diff --git a/src/nodes.coffee b/src/nodes.coffee index c779f702..472f75c7 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -710,10 +710,10 @@ exports.ClassNode: class ClassNode extends BaseNode props.push prop constructor.body.unshift literal "$me = this" if me - construct: @idt() + (new AssignNode(@variable, constructor)).compile(merge o, {sharedScope: constScope}) + ';\n' - props: if props.empty() then '' else props.compile(o) + '\n' - extension: if extension then @idt() + extension.compile(o) + ';\n' else '' - returns: if @returns then new ReturnNode(@variable).compile(o) else '' + construct: @idt() + (new AssignNode(@variable, constructor)).compile(merge o, {sharedScope: constScope}) + ';' + props: if !props.empty() then '\n' + props.compile(o) else '' + extension: if extension then '\n' + @idt() + extension.compile(o) + ';' else '' + returns: if @returns then '\n' + new ReturnNode(@variable).compile(o) else '' "$construct$extension$props$returns" #### AssignNode