mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Fixes #2916 -- implicit calls with preceding herecomment
This commit is contained in:
@@ -273,7 +273,7 @@
|
||||
startImplicitCall(i + 1);
|
||||
return forward(2);
|
||||
}
|
||||
if (this.matchTags(i, IMPLICIT_FUNC, 'INDENT', null, ':') && !this.findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH', 'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])) {
|
||||
if (__indexOf.call(IMPLICIT_FUNC, tag) >= 0 && this.matchTags(i + 1, 'INDENT', null, ':') && !this.findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH', 'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])) {
|
||||
startImplicitCall(i + 1);
|
||||
stack.push(['INDENT', i + 2]);
|
||||
return forward(3);
|
||||
|
||||
@@ -251,7 +251,7 @@ class exports.Rewriter
|
||||
# which is probably always unintended.
|
||||
# Furthermore don't allow this in literal arrays, as
|
||||
# that creates grammatical ambiguities.
|
||||
if @matchTags(i, IMPLICIT_FUNC, 'INDENT', null, ':') and
|
||||
if tag in IMPLICIT_FUNC and @matchTags(i + 1, 'INDENT', null, ':') and
|
||||
not @findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH',
|
||||
'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])
|
||||
startImplicitCall i + 1
|
||||
|
||||
@@ -205,3 +205,9 @@ test "block comments inside class bodies", ->
|
||||
|
||||
test "#2037: herecomments shouldn't imply line terminators", ->
|
||||
do (-> ### ###; fail)
|
||||
|
||||
test "#2916: block comment before implicit call with implicit object", ->
|
||||
fn = (obj) -> ok obj.a
|
||||
### ###
|
||||
fn
|
||||
a: yes
|
||||
|
||||
Reference in New Issue
Block a user