This commit is contained in:
Jeremy Ashkenas
2011-12-14 11:32:40 -05:00
parent eb55f2d8f4
commit 00f9e244f2
3 changed files with 8 additions and 2 deletions

View File

@@ -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') {

View File

@@ -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

View File

@@ -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