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

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: Remove TemplateLiteral AST node, do it all in parsing 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
Index: src/harmony-templates.js
diff --git a/src/harmony-templates.js b/src/harmony-templates.js
new file mode 100644
index 0000000000000000000000000000000000000000..b161f606ffe474584c977860b98d9964523d824e
--- /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) {
arv (Not doing code reviews) 2014/11/07 16:55:50 Eventually I think we need to pass in some kind of
+ // 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);
+
+ var index = 0;
+ for (; index < count; ++index) {
+ var cookedValue = cookedStrings[index];
+ DefineArrayProperty(siteObj, ToString(index), ToPropertyDescriptor({
+ value: cookedValue,
+ configurable: false,
+ writable: false,
+ enumerable: true
+ }), false);
+ var rawValue = rawStrings[index];
+ DefineArrayProperty(rawObj, ToString(index), 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') | test/cctest/test-parsing.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698