1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Issue #748 -- trailing reserved idenitifer.

This commit is contained in:
Jeremy Ashkenas 2010-10-10 11:42:25 -04:00
parent 45ed62931b
commit f6ca5d814c
3 changed files with 12 additions and 3 deletions

View file

@ -563,7 +563,7 @@
};
Lexer.prototype.unfinished = function() {
var prev, value;
return (prev = last(this.tokens, 1)) && prev[0] !== '.' && (value = this.value()) && NO_NEWLINE.test(value) && !CODE.test(value) && !ASSIGNED.test(this.chunk);
return (prev = last(this.tokens, 1)) && prev[0] !== '.' && (value = this.value()) && !value.reserved && NO_NEWLINE.test(value) && !CODE.test(value) && !ASSIGNED.test(this.chunk);
};
Lexer.prototype.escapeLines = function(str, heredoc) {
return str.replace(MULTILINER, heredoc ? '\\n' : '');

View file

@ -486,8 +486,8 @@ exports.Lexer = class Lexer
# Are we in the midst of an unfinished expression?
unfinished: ->
(prev = last @tokens, 1) and prev[0] isnt '.' and
(value = @value()) and NO_NEWLINE.test(value) and not CODE.test(value) and
not ASSIGNED.test(@chunk)
(value = @value()) and not value.reserved and
NO_NEWLINE.test(value) and not CODE.test(value) and not ASSIGNED.test(@chunk)
# Converts newlines for string literals.
escapeLines: (str, heredoc) ->

View file

@ -135,3 +135,12 @@ ok result is 70
# Issue #738
func = if true then -> 1
eq func(), 1
# Issue #748. Trailing reserved identifiers.
obj = delete: true
result = if obj.delete
101
ok result is 101