From 725fe8e0187f6657ad3f786ca68af829eea225ad Mon Sep 17 00:00:00 2001 From: Geoffrey Booth Date: Tue, 4 Apr 2017 00:04:50 -0700 Subject: [PATCH] Code golf --- lib/coffeescript/lexer.js | 2 +- src/lexer.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/coffeescript/lexer.js b/lib/coffeescript/lexer.js index 13100f2a96..f5be046710 100644 --- a/lib/coffeescript/lexer.js +++ b/lib/coffeescript/lexer.js @@ -129,7 +129,7 @@ } else if (tag === 'IDENTIFIER' && this.seenFor && id === 'from' && isForFrom(prev)) { tag = 'FORFROM'; this.seenFor = false; - } else if (tag === 'PROPERTY' && prev && prev.spaced && (ref9 = prev[0], indexOf.call(CALLABLE, ref9) >= 0) && /^[g|s]et$/.test(prev[1])) { + } else if (tag === 'PROPERTY' && prev && prev.spaced && (ref9 = prev[0], indexOf.call(CALLABLE, ref9) >= 0) && /^[gs]et$/.test(prev[1])) { this.error(`'${prev[1]}' cannot be used as a keyword, or as a function call without parentheses`, prev[2]); } if (tag === 'IDENTIFIER' && indexOf.call(RESERVED, id) >= 0) { diff --git a/src/lexer.coffee b/src/lexer.coffee index 92c59030bc..0a63cc5fc8 100644 --- a/src/lexer.coffee +++ b/src/lexer.coffee @@ -170,7 +170,7 @@ exports.Lexer = class Lexer isForFrom(prev) tag = 'FORFROM' @seenFor = no - else if tag is 'PROPERTY' and prev and prev.spaced and prev[0] in CALLABLE and /^[g|s]et$/.test(prev[1]) + else if tag is 'PROPERTY' and prev and prev.spaced and prev[0] in CALLABLE and /^[gs]et$/.test(prev[1]) @error "'#{prev[1]}' cannot be used as a keyword, or as a function call without parentheses", prev[2] if tag is 'IDENTIFIER' and id in RESERVED