From 92e5ab2857286f7055779a4d80ef43b2e38da158 Mon Sep 17 00:00:00 2001 From: Shuan Wang Date: Wed, 4 Feb 2015 02:06:35 -0800 Subject: [PATCH] Fix incorrect token representation The third element in a token should just be an object containing line number and column info. This PR fixes the problem with one of the tokens being set incorrectly. --- lib/coffee-script/lexer.js | 14 ++++++-------- src/lexer.coffee | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/coffee-script/lexer.js b/lib/coffee-script/lexer.js index e39bcd13..6061c7a6 100644 --- a/lib/coffee-script/lexer.js +++ b/lib/coffee-script/lexer.js @@ -662,14 +662,12 @@ if (interpolated) { ref3 = this.tokens, lastToken = ref3[ref3.length - 1]; rparen = this.token(')', ')'); - rparen[2] = [ - ')', ')', { - first_line: lastToken[2].last_line, - first_column: lastToken[2].last_column + 1, - last_line: lastToken[2].last_line, - last_column: lastToken[2].last_column + 1 - } - ]; + rparen[2] = { + first_line: lastToken[2].last_line, + first_column: lastToken[2].last_column + 1, + last_line: lastToken[2].last_line, + last_column: lastToken[2].last_column + 1 + }; return rparen.stringEnd = true; } }; diff --git a/src/lexer.coffee b/src/lexer.coffee index 8cbc9b5d..e2164032 100644 --- a/src/lexer.coffee +++ b/src/lexer.coffee @@ -582,12 +582,12 @@ exports.Lexer = class Lexer if interpolated [..., lastToken] = @tokens rparen = @token ')', ')' - rparen[2] = [')', ')', + rparen[2] = { first_line: lastToken[2].last_line first_column: lastToken[2].last_column + 1 last_line: lastToken[2].last_line last_column: lastToken[2].last_column + 1 - ] + } rparen.stringEnd = true # Pairs up a closing token, ensuring that all listed pairs of tokens are