mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
fixing issue #497 try/catch/finally all empty.
This commit is contained in:
@@ -204,7 +204,7 @@
|
||||
this.tokens.splice.apply(this.tokens, [i, 0].concat(this.indentation(token)));
|
||||
return 2;
|
||||
}
|
||||
if (token[0] === 'CATCH' && this.tokens[i + 2][0] === 'TERMINATOR') {
|
||||
if (token[0] === 'CATCH' && (this.tokens[i + 2][0] === 'TERMINATOR' || this.tokens[i + 2][0] === 'FINALLY')) {
|
||||
this.tokens.splice.apply(this.tokens, [i + 2, 0].concat(this.indentation(token)));
|
||||
return 4;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,8 @@ exports.Rewriter: class Rewriter
|
||||
if token[0] is 'ELSE' and prev[0] isnt 'OUTDENT'
|
||||
@tokens.splice i, 0, @indentation(token)...
|
||||
return 2
|
||||
if token[0] is 'CATCH' and @tokens[i + 2][0] is 'TERMINATOR'
|
||||
if token[0] is 'CATCH' and
|
||||
(@tokens[i + 2][0] is 'TERMINATOR' or @tokens[i + 2][0] is 'FINALLY')
|
||||
@tokens.splice i + 2, 0, @indentation(token)...
|
||||
return 4
|
||||
return 1 unless include(SINGLE_LINERS, token[0]) and
|
||||
|
||||
@@ -35,4 +35,8 @@ try
|
||||
finally
|
||||
# nothing
|
||||
|
||||
try
|
||||
catch err
|
||||
finally
|
||||
|
||||
ok yes
|
||||
Reference in New Issue
Block a user