diff --git a/lib/lexer.js b/lib/lexer.js index 3f81a3ef..ac8b63eb 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -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' : ''); diff --git a/src/lexer.coffee b/src/lexer.coffee index a252f76f..a6c626df 100644 --- a/src/lexer.coffee +++ b/src/lexer.coffee @@ -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) -> diff --git a/test/test_if.coffee b/test/test_if.coffee index 4fea51b3..42ba54b7 100644 --- a/test/test_if.coffee +++ b/test/test_if.coffee @@ -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