Skip to content

Commit 3650d6e

Browse files
Merge pull request #2933 from marchaefner/master
Fix implicit calls with preceding herecomment
2 parents 174cd7e + 05b74f3 commit 3650d6e

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lib/coffee-script/rewriter.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rewriter.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ class exports.Rewriter
251251
# which is probably always unintended.
252252
# Furthermore don't allow this in literal arrays, as
253253
# that creates grammatical ambiguities.
254-
if @matchTags(i, IMPLICIT_FUNC, 'INDENT', null, ':') and
254+
if tag in IMPLICIT_FUNC and @matchTags(i + 1, 'INDENT', null, ':') and
255255
not @findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH',
256256
'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])
257257
startImplicitCall i + 1

test/comments.coffee

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,9 @@ test "block comments inside class bodies", ->
205205

206206
test "#2037: herecomments shouldn't imply line terminators", ->
207207
do (-> ### ###; fail)
208+
209+
test "#2916: block comment before implicit call with implicit object", ->
210+
fn = (obj) -> ok obj.a
211+
### ###
212+
fn
213+
a: yes

0 commit comments

Comments
 (0)