OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 'use strict'; |
| 6 |
| 7 function GetTemplateCallSite(cookedStrings, rawStrings) { |
| 8 // TODO(caitp): ensure same template callsite is used for subsequent tag calls |
| 9 var count = cookedStrings.length; |
| 10 var siteObj = new $Array(count); |
| 11 var rawObj = new $Array(count); |
| 12 |
| 13 for (var index = 0; index < count; ++index) { |
| 14 var prop = ToString(index); |
| 15 var cookedValue = cookedStrings[index]; |
| 16 DefineArrayProperty(siteObj, prop, ToPropertyDescriptor({ |
| 17 value: cookedValue, |
| 18 configurable: false, |
| 19 writable: false, |
| 20 enumerable: true |
| 21 }), false); |
| 22 var rawValue = rawStrings[index]; |
| 23 DefineArrayProperty(rawObj, prop, ToPropertyDescriptor({ |
| 24 value: rawValue, |
| 25 configurable: false, |
| 26 writable: false, |
| 27 enumerable: true |
| 28 }), false); |
| 29 } |
| 30 |
| 31 DefineObjectProperty(siteObj, "raw", ToPropertyDescriptor({ |
| 32 value: %ObjectFreeze(rawObj), |
| 33 configurable: false, |
| 34 writable: false, |
| 35 enumerable: false |
| 36 }), false); |
| 37 |
| 38 return %ObjectFreeze(siteObj); |
| 39 } |
OLD | NEW |