We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9a61bbf commit 27f7ef0Copy full SHA for 27f7ef0
lib/coffee_script/rewriter.rb
@@ -35,6 +35,7 @@ class Rewriter
35
def rewrite(tokens)
36
@tokens = tokens
37
adjust_comments
38
+ remove_leading_newlines
39
remove_mid_expression_newlines
40
move_commas_outside_outdents
41
add_implicit_indentation
@@ -82,6 +83,12 @@ def adjust_comments
82
83
end
84
85
86
+ # Leading newlines would introduce an ambiguity in the grammar, so we
87
+ # dispatch them here.
88
+ def remove_leading_newlines
89
+ @tokens.shift if @tokens[0][0] == "\n"
90
+ end
91
+
92
# Some blocks occur in the middle of expressions -- when we're expecting
93
# this, remove their trailing newlines.
94
def remove_mid_expression_newlines
0 commit comments