Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Unified Diff: src/harmony-templates.js

Issue 663683006: Implement ES6 Template Literals (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ensure scanner flag is initialized to false Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | src/messages.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/harmony-templates.js
diff --git a/src/harmony-templates.js b/src/harmony-templates.js
new file mode 100644
index 0000000000000000000000000000000000000000..9afbe27f5207d3a35cce2747ce276958e14c6591
--- /dev/null
+++ b/src/harmony-templates.js
@@ -0,0 +1,39 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+'use strict';
+
+function GetTemplateCallSite(cookedStrings, rawStrings) {
+ // TODO(caitp): ensure same template callsite is used for subsequent tag calls
+ var count = cookedStrings.length;
+ var siteObj = new $Array(count);
+ var rawObj = new $Array(count);
+
+ for (var index = 0; index < count; ++index) {
+ var prop = ToString(index);
+ var cookedValue = cookedStrings[index];
+ DefineArrayProperty(siteObj, prop, ToPropertyDescriptor({
arv (Not doing code reviews) 2014/11/12 15:06:05 I feel like this is doing too much work. Nothing
caitp (gmail) 2014/11/12 15:12:32 Done. It's a lot tinier that way.
+ value: cookedValue,
+ configurable: false,
+ writable: false,
+ enumerable: true
+ }), false);
+ var rawValue = rawStrings[index];
+ DefineArrayProperty(rawObj, prop, ToPropertyDescriptor({
+ value: rawValue,
+ configurable: false,
+ writable: false,
+ enumerable: true
+ }), false);
+ }
+
+ DefineObjectProperty(siteObj, "raw", ToPropertyDescriptor({
+ value: %ObjectFreeze(rawObj),
+ configurable: false,
+ writable: false,
+ enumerable: false
+ }), false);
+
+ return %ObjectFreeze(siteObj);
+}
« no previous file with comments | « src/flag-definitions.h ('k') | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698