Commit 6d22f7a7 authored by caitpotter88's avatar caitpotter88 Committed by Commit bot

[parser] parse `CalllExpression TemplateLiteral` production

BUG=v8:4183
R=arv@chromium.org, rossberg@chromium.org
LOG=N

Review URL: https://codereview.chromium.org/1184373002

Cr-Commit-Position: refs/heads/master@{#29055}
parent 4e0b7b0c
...@@ -3095,6 +3095,13 @@ ParserBase<Traits>::ParseLeftHandSideExpression( ...@@ -3095,6 +3095,13 @@ ParserBase<Traits>::ParseLeftHandSideExpression(
break; break;
} }
case Token::TEMPLATE_SPAN:
case Token::TEMPLATE_TAIL: {
BindingPatternUnexpectedToken(classifier);
result = ParseTemplateLiteral(result, position(), classifier, CHECK_OK);
break;
}
default: default:
return result; return result;
} }
......
...@@ -588,6 +588,26 @@ var global = this; ...@@ -588,6 +588,26 @@ var global = this;
})(); })();
(function testReturnValueAsTagFn() {
"use strict";
var i = 0;
function makeTag() {
return function tag(cs) {
var args = Array.prototype.slice.call(arguments, 1);
var rcs = [];
rcs.raw = cs.map(function(s) {
return '!' + s + '!';
});
args.unshift(rcs);
return String.raw.apply(null, args);
}
}
assertEquals('!hi!', makeTag()`hi`);
assertEquals('!test!0!test!', makeTag()`test${0}test`);
assertEquals('!!', makeTag()``);
});
(function testToStringSubstitutions() { (function testToStringSubstitutions() {
var a = { var a = {
toString: function() { return "a"; }, toString: function() { return "a"; },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment