From 337ebd3ce9c5fdc2f94c33de9d882c6e45a1e2f3 Mon Sep 17 00:00:00 2001 From: Miao Jiang Date: Fri, 5 Apr 2013 13:20:59 +0800 Subject: [PATCH] Fixes #2908, add "\n" between pure literal header and function body. --- lib/coffee-script/nodes.js | 2 ++ src/nodes.coffee | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/coffee-script/nodes.js b/lib/coffee-script/nodes.js index 2e65af3f..9ffd6081 100644 --- a/lib/coffee-script/nodes.js +++ b/lib/coffee-script/nodes.js @@ -475,6 +475,8 @@ fragments.push(this.makeCode(scope.assignedVariables().join(",\n" + (this.tab + TAB)))); } fragments.push(this.makeCode(";\n" + (this.spaced ? '\n' : ''))); + } else if (fragments.length && post.length) { + fragments.push(this.makeCode("\n")); } } return fragments.concat(post); diff --git a/src/nodes.coffee b/src/nodes.coffee index 7814d440..a17dad71 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -352,6 +352,8 @@ exports.Block = class Block extends Base fragments.push @makeCode ",\n#{@tab + TAB}" if declars fragments.push @makeCode (scope.assignedVariables().join ",\n#{@tab + TAB}") fragments.push @makeCode ";\n#{if @spaced then '\n' else ''}" + else if fragments.length and post.length + fragments.push @makeCode "\n" fragments.concat post # Wrap up the given nodes as a **Block**, unless it already happens