fixing issue #497 try/catch/finally all empty.

This commit is contained in:
Jeremy Ashkenas
2010-07-13 23:33:59 -04:00
parent 0b87387fab
commit 6a059bfab7
3 changed files with 7 additions and 2 deletions

View File

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

View File

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

View File

@@ -35,4 +35,8 @@ try
finally
# nothing
try
catch err
finally
ok yes