allow multiline comment inside of an object definition [Fixes #3761]

use more CoffeeScript syntax
This commit is contained in:
Nick Doiron 2015-01-23 19:39:26 -05:00
parent 68c0e2dc0f
commit dc44ebbdaa
3 changed files with 13 additions and 0 deletions

View File

@ -301,6 +301,9 @@
} else if (inImplicitObject() && !this.insideForDeclaration && sameLine && tag !== 'TERMINATOR' && prevTag !== ':' && endImplicitObject()) {
} else if (inImplicitObject() && tag === 'TERMINATOR' && prevTag !== ',' && !(startsLine && this.looksObjectish(i + 1))) {
if (nextTag === 'HERECOMMENT') {
return forward(1);
}
endImplicitObject();
} else {
break;

View File

@ -305,6 +305,7 @@ class exports.Rewriter
# the continuation of an object.
else if inImplicitObject() and tag is 'TERMINATOR' and prevTag isnt ',' and
not (startsLine and @looksObjectish(i + 1))
return forward 1 if nextTag is 'HERECOMMENT'
endImplicitObject()
else
break

View File

@ -418,3 +418,12 @@ test "#3638: Demand a whitespace after # symbol", ->
"""
eq CoffeeScript.compile(input, bare: on), result
test "#3761: Multiline comment at end of an object", ->
anObject =
x: 3
###
#Comment
###
ok anObject.x is 3