Chromium Code Reviews| 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) { | |
|
arv (Not doing code reviews)
2014/11/07 16:55:50
Eventually I think we need to pass in some kind of
| |
| 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 var index = 0; | |
| 14 for (; index < count; ++index) { | |
| 15 var cookedValue = cookedStrings[index]; | |
| 16 DefineArrayProperty(siteObj, ToString(index), ToPropertyDescriptor({ | |
| 17 value: cookedValue, | |
| 18 configurable: false, | |
| 19 writable: false, | |
| 20 enumerable: true | |
| 21 }), false); | |
| 22 var rawValue = rawStrings[index]; | |
| 23 DefineArrayProperty(rawObj, ToString(index), 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 |