fixing an overzealous access in the rewriter

This commit is contained in:
Jeremy Ashkenas 2010-02-16 10:12:40 -05:00
parent 79fa4723ab
commit 51e80484e2
3 changed files with 6 additions and 2 deletions

View File

@ -94,7 +94,7 @@
this.tokens.splice(i + 2, 1);
this.tokens.splice(i - 2, 1);
return 0;
} else if (prev && prev[0] === 'TERMINATOR' && after[0] === 'INDENT') {
} else if (prev && prev[0] === 'TERMINATOR' && after && after[0] === 'INDENT') {
this.tokens.splice(i + 2, 1);
this.tokens[i - 1] = after;
return 1;

View File

@ -80,7 +80,7 @@ re::adjust_comments: ->
@tokens.splice(i + 2, 1)
@tokens.splice(i - 2, 1)
return 0
else if prev and prev[0] is 'TERMINATOR' and after[0] is 'INDENT'
else if prev and prev[0] is 'TERMINATOR' and after and after[0] is 'INDENT'
@tokens.splice(i + 2, 1)
@tokens[i - 1]: after
return 1

View File

@ -19,3 +19,7 @@ switch 'string'
# comment
puts func()
func
func
# Line3