mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Merge branch 'master' of github.com:jashkenas/coffeescript into 2
# Conflicts: # docs/v1/browser-compiler/coffee-script.js # lib/coffee-script/browser.js # lib/coffee-script/cake.js # lib/coffee-script/coffee-script.js # lib/coffee-script/command.js # lib/coffee-script/grammar.js # lib/coffee-script/helpers.js # lib/coffee-script/index.js # lib/coffee-script/lexer.js # lib/coffee-script/nodes.js # lib/coffee-script/optparse.js # lib/coffee-script/register.js # lib/coffee-script/repl.js # lib/coffee-script/rewriter.js # lib/coffee-script/scope.js # lib/coffee-script/sourcemap.js # package.json # src/coffee-script.coffee # src/nodes.coffee
This commit is contained in:
@@ -3279,7 +3279,7 @@
|
||||
};
|
||||
|
||||
StringWithInterpolations.prototype.compileNode = function(o) {
|
||||
var element, elements, expr, fragments, j, len1;
|
||||
var element, elements, expr, fragments, j, len1, value;
|
||||
expr = this.body.unwrap();
|
||||
elements = [];
|
||||
expr.traverseChildren(false, function(node) {
|
||||
@@ -3297,7 +3297,15 @@
|
||||
for (j = 0, len1 = elements.length; j < len1; j++) {
|
||||
element = elements[j];
|
||||
if (element instanceof StringLiteral) {
|
||||
fragments.push(this.makeCode(element.value.slice(1, -1)));
|
||||
value = element.value.slice(1, -1);
|
||||
value = value.replace(/(\\*)(`|\$\{)/g, function(match, backslashes, toBeEscaped) {
|
||||
if (backslashes.length % 2 === 0) {
|
||||
return `${backslashes}\\${toBeEscaped}`;
|
||||
} else {
|
||||
return match;
|
||||
}
|
||||
});
|
||||
fragments.push(this.makeCode(value));
|
||||
} else {
|
||||
fragments.push(this.makeCode('${'));
|
||||
fragments.push(...element.compileToFragments(o, LEVEL_PAREN));
|
||||
|
||||
Reference in New Issue
Block a user