OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 %CheckIsBootstrapping(); | 7 %CheckIsBootstrapping(); |
8 | 8 |
9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
10 // Imports | 10 // Imports |
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 } | 1105 } |
1106 | 1106 |
1107 | 1107 |
1108 // ------------------------------------------------------------------- | 1108 // ------------------------------------------------------------------- |
1109 // String methods related to templates | 1109 // String methods related to templates |
1110 | 1110 |
1111 // ES6 Draft 03-17-2015, section 21.1.2.4 | 1111 // ES6 Draft 03-17-2015, section 21.1.2.4 |
1112 function StringRaw(callSite) { | 1112 function StringRaw(callSite) { |
1113 // TODO(caitp): Use rest parameters when implemented | 1113 // TODO(caitp): Use rest parameters when implemented |
1114 var numberOfSubstitutions = %_ArgumentsLength(); | 1114 var numberOfSubstitutions = %_ArgumentsLength(); |
1115 var cooked = $toObject(callSite); | 1115 var cooked = TO_OBJECT(callSite); |
1116 var raw = $toObject(cooked.raw); | 1116 var raw = TO_OBJECT(cooked.raw); |
1117 var literalSegments = $toLength(raw.length); | 1117 var literalSegments = $toLength(raw.length); |
1118 if (literalSegments <= 0) return ""; | 1118 if (literalSegments <= 0) return ""; |
1119 | 1119 |
1120 var result = $toString(raw[0]); | 1120 var result = $toString(raw[0]); |
1121 | 1121 |
1122 for (var i = 1; i < literalSegments; ++i) { | 1122 for (var i = 1; i < literalSegments; ++i) { |
1123 if (i < numberOfSubstitutions) { | 1123 if (i < numberOfSubstitutions) { |
1124 result += $toString(%_Arguments(i)); | 1124 result += $toString(%_Arguments(i)); |
1125 } | 1125 } |
1126 result += $toString(raw[i]); | 1126 result += $toString(raw[i]); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 to.StringIndexOf = StringIndexOfJS; | 1200 to.StringIndexOf = StringIndexOfJS; |
1201 to.StringLastIndexOf = StringLastIndexOfJS; | 1201 to.StringLastIndexOf = StringLastIndexOfJS; |
1202 to.StringMatch = StringMatchJS; | 1202 to.StringMatch = StringMatchJS; |
1203 to.StringReplace = StringReplace; | 1203 to.StringReplace = StringReplace; |
1204 to.StringSplit = StringSplitJS; | 1204 to.StringSplit = StringSplitJS; |
1205 to.StringSubstr = StringSubstr; | 1205 to.StringSubstr = StringSubstr; |
1206 to.StringSubstring = StringSubstring; | 1206 to.StringSubstring = StringSubstring; |
1207 }); | 1207 }); |
1208 | 1208 |
1209 }) | 1209 }) |
OLD | NEW |