mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-04-11 03:00:13 -04:00
Issue #748 -- trailing reserved idenitifer.
This commit is contained in:
@@ -563,7 +563,7 @@
|
|||||||
};
|
};
|
||||||
Lexer.prototype.unfinished = function() {
|
Lexer.prototype.unfinished = function() {
|
||||||
var prev, value;
|
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) {
|
Lexer.prototype.escapeLines = function(str, heredoc) {
|
||||||
return str.replace(MULTILINER, heredoc ? '\\n' : '');
|
return str.replace(MULTILINER, heredoc ? '\\n' : '');
|
||||||
|
|||||||
@@ -486,8 +486,8 @@ exports.Lexer = class Lexer
|
|||||||
# Are we in the midst of an unfinished expression?
|
# Are we in the midst of an unfinished expression?
|
||||||
unfinished: ->
|
unfinished: ->
|
||||||
(prev = last @tokens, 1) and prev[0] isnt '.' and
|
(prev = last @tokens, 1) and prev[0] isnt '.' and
|
||||||
(value = @value()) and NO_NEWLINE.test(value) and not CODE.test(value) and
|
(value = @value()) and not value.reserved and
|
||||||
not ASSIGNED.test(@chunk)
|
NO_NEWLINE.test(value) and not CODE.test(value) and not ASSIGNED.test(@chunk)
|
||||||
|
|
||||||
# Converts newlines for string literals.
|
# Converts newlines for string literals.
|
||||||
escapeLines: (str, heredoc) ->
|
escapeLines: (str, heredoc) ->
|
||||||
|
|||||||
@@ -135,3 +135,12 @@ ok result is 70
|
|||||||
# Issue #738
|
# Issue #738
|
||||||
func = if true then -> 1
|
func = if true then -> 1
|
||||||
eq func(), 1
|
eq func(), 1
|
||||||
|
|
||||||
|
|
||||||
|
# Issue #748. Trailing reserved identifiers.
|
||||||
|
obj = delete: true
|
||||||
|
|
||||||
|
result = if obj.delete
|
||||||
|
101
|
||||||
|
|
||||||
|
ok result is 101
|
||||||
|
|||||||
Reference in New Issue
Block a user