Skip to content

Commit

Permalink
Merge pull request #3638 from lbeschastny/issue3638
Browse files Browse the repository at this point in the history
Invalid block comments compilation
  • Loading branch information
jashkenas committed Sep 23, 2014
2 parents a78cbe7 + 77d5b95 commit 158ca0d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/coffee-script/nodes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/nodes.coffee
Expand Up @@ -576,7 +576,7 @@ exports.Comment = class Comment extends Base
makeReturn: THIS

compileNode: (o, level) ->
comment = @comment.replace /^(\s*)#/gm, "$1 *"
comment = @comment.replace /^(\s*)# /gm, "$1 * "
code = "/*#{multident comment, @tab}#{if '\n' in comment then "\n#{@tab}" else ''} */"
code = o.indent + code if (level or o.level) is LEVEL_TOP
[@makeCode("\n"), @makeCode(code)]
Expand Down
19 changes: 19 additions & 0 deletions test/comments.coffee
Expand Up @@ -399,3 +399,22 @@ test "#3132: Place block-comments nicely", ->
"""
eq CoffeeScript.compile(input, bare: on), result

test "#3638: Demand a whitespace after # symbol", ->
input = """
###
#No
#whitespace
###"""

result = """
/*
#No
#whitespace
*/
"""

eq CoffeeScript.compile(input, bare: on), result

0 comments on commit 158ca0d

Please sign in to comment.