mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Fixes #1922
This commit is contained in:
@@ -175,7 +175,7 @@
|
||||
if (tag === 'IF' || tag === 'ELSE' || tag === 'CATCH' || tag === '->' || tag === '=>') {
|
||||
seenSingle = true;
|
||||
}
|
||||
if (tag === 'IF' || tag === 'ELSE' || tag === 'SWITCH' || tag === 'TRY') {
|
||||
if (tag === 'IF' || tag === 'ELSE' || tag === 'SWITCH' || tag === 'TRY' || tag === '=') {
|
||||
seenControl = true;
|
||||
}
|
||||
if ((tag === '.' || tag === '?.' || tag === '::') && this.tag(i - 1) === 'OUTDENT') {
|
||||
|
||||
@@ -152,7 +152,7 @@ class exports.Rewriter
|
||||
[tag] = token
|
||||
return yes if not seenSingle and token.fromThen
|
||||
seenSingle = yes if tag in ['IF', 'ELSE', 'CATCH', '->', '=>']
|
||||
seenControl = yes if tag in ['IF', 'ELSE', 'SWITCH', 'TRY']
|
||||
seenControl = yes if tag in ['IF', 'ELSE', 'SWITCH', 'TRY', '=']
|
||||
return yes if tag in ['.', '?.', '::'] and @tag(i - 1) is 'OUTDENT'
|
||||
not token.generated and @tag(i - 1) isnt ',' and (tag in IMPLICIT_END or
|
||||
(tag is 'INDENT' and not seenControl)) and
|
||||
|
||||
@@ -263,3 +263,9 @@ test "#1102: String literal prevents line continuation", ->
|
||||
test "#1703, ---x is invalid JS", ->
|
||||
x = 2
|
||||
eq (- --x), -1
|
||||
|
||||
test "#1.1.3: Regression with implicit calls against an indented assignment", ->
|
||||
eq 1, a =
|
||||
1
|
||||
|
||||
eq a, 1
|
||||
|
||||
Reference in New Issue
Block a user