diff --git a/lib/6to5/file.js b/lib/6to5/file.js index 66c86d7fce..fa2967e3d2 100644 --- a/lib/6to5/file.js +++ b/lib/6to5/file.js @@ -42,7 +42,8 @@ File.helpers = [ File.excludeHelpersFromRuntime = [ "async-to-generator", - "typeof" + "typeof", + "tagged-template-literal-loose" ]; File.normaliseOptions = function (opts) { diff --git a/lib/6to5/transformation/transformers/es6-template-literals.js b/lib/6to5/transformation/transformers/es6-template-literals.js index 81872a7766..5e4f824cf3 100644 --- a/lib/6to5/transformation/transformers/es6-template-literals.js +++ b/lib/6to5/transformation/transformers/es6-template-literals.js @@ -20,11 +20,10 @@ exports.TaggedTemplateExpression = function (node, parent, file) { strings = t.arrayExpression(strings); raw = t.arrayExpression(raw); - var template = file.isLoose("templateLiterals") ? - "tagged-template-literal-loose" : - "tagged-template-literal"; + var templateName = "tagged-template-literal"; + if (file.isLoose("templateLiterals")) templateName += "-loose"; + args.push(t.callExpression(file.addHelper(templateName), [strings, raw])); - args.push(t.callExpression(file.addHelper(template), [strings, raw])); args = args.concat(quasi.expressions); return t.callExpression(node.tag, args);