Reviewers: arv, rossberg,

Message:
PTAL

Description:
[parser] parse `CalllExpression TemplateLiteral` production

BUG=v8:4183
[email protected], [email protected]
LOG=N

Please review this at https://codereview.chromium.org/1184373002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+27, -0 lines):
  M src/preparser.h
  M test/mjsunit/es6/templates.js


Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 41ebf97280fbcae62ddc36e86149a1a25aa1f9c8..862b7fb40dd894b53dfcec80d36aedde5b441e3f 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -3095,6 +3095,13 @@ ParserBase<Traits>::ParseLeftHandSideExpression(
         break;
       }

+      case Token::TEMPLATE_SPAN:
+      case Token::TEMPLATE_TAIL: {
+        BindingPatternUnexpectedToken(classifier);
+ result = ParseTemplateLiteral(result, position(), classifier, CHECK_OK);
+        break;
+      }
+
       default:
         return result;
     }
Index: test/mjsunit/es6/templates.js
diff --git a/test/mjsunit/es6/templates.js b/test/mjsunit/es6/templates.js
index 0734f0e5d06936db4d7a6b684243894adaa0e1da..feb7364613db9391665f72700ea0608071945674 100644
--- a/test/mjsunit/es6/templates.js
+++ b/test/mjsunit/es6/templates.js
@@ -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() {
   var a = {
     toString: function() { return "a"; },


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to