a touch of safety from trailing catches falling off the end of the rewriter.

This commit is contained in:
Jeremy Ashkenas 2010-08-17 20:04:34 -04:00
parent a8c6a641d7
commit f41ca2e5e8
2 changed files with 2 additions and 2 deletions

View File

@ -222,7 +222,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' || this.tokens[i + 2][0] === 'FINALLY')) {
if (token[0] === 'CATCH' && (this.tag(i + 2) === 'TERMINATOR' || this.tag(i + 2) === 'FINALLY')) {
this.tokens.splice.apply(this.tokens, [i + 2, 0].concat(this.indentation(token)));
return 4;
}

View File

@ -187,7 +187,7 @@ exports.Rewriter = class Rewriter
@tokens.splice i, 0, @indentation(token)...
return 2
if token[0] is 'CATCH' and
(@tokens[i + 2][0] is 'TERMINATOR' or @tokens[i + 2][0] is 'FINALLY')
(@tag(i + 2) is 'TERMINATOR' or @tag(i + 2) is 'FINALLY')
@tokens.splice i + 2, 0, @indentation(token)...
return 4
if include(SINGLE_LINERS, token[0]) and @tag(i + 1) isnt 'INDENT' and