From a9ab1809172a38530800374ea1deb1e59a0c595a Mon Sep 17 00:00:00 2001 From: Geoffrey Booth Date: Wed, 23 Aug 2017 18:46:36 -0700 Subject: [PATCH] Fix #4589: Unquote all interpolated strings, not just CSX ones, so that quotation marks are not unnecessarily escaped in backtick-delimited strings/template literals --- lib/coffeescript/nodes.js | 2 +- src/nodes.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/coffeescript/nodes.js b/lib/coffeescript/nodes.js index 1d5609bd96..00efaeb044 100644 --- a/lib/coffeescript/nodes.js +++ b/lib/coffeescript/nodes.js @@ -4989,7 +4989,7 @@ for (j = 0, len1 = elements.length; j < len1; j++) { element = elements[j]; if (element instanceof StringLiteral) { - element.value = element.unquote(this.csx); + element.value = element.unquote(true); if (!this.csx) { // Backticks and `${` inside template literals must be escaped. element.value = element.value.replace(/(\\*)(`|\$\{)/g, function(match, backslashes, toBeEscaped) { diff --git a/src/nodes.coffee b/src/nodes.coffee index 677d4df028..9cd0508868 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -3393,7 +3393,7 @@ exports.StringWithInterpolations = class StringWithInterpolations extends Base fragments.push @makeCode '`' unless @csx for element in elements if element instanceof StringLiteral - element.value = element.unquote @csx + element.value = element.unquote yes unless @csx # Backticks and `${` inside template literals must be escaped. element.value = element.value.replace /(\\*)(`|\$\{)/g, (match, backslashes, toBeEscaped) ->