| 1 |
// Copyright (C) 2015 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
/*--- |
| 4 |
es6id: 21.1.2.4 |
| 5 |
description: > |
| 6 |
Returns abrupt completion from ToObject(template.raw.length). |
| 7 |
info: | |
| 8 |
21.1.2.4 String.raw ( template , ...substitutions ) |
| 9 |
|
| 10 |
1. Let substitutions be a List consisting of all of the arguments passed to |
| 11 |
this function, starting with the second argument. If fewer than two arguments |
| 12 |
were passed, the List is empty. |
| 13 |
2. Let numberOfSubstitutions be the number of elements in substitutions. |
| 14 |
3. Let cooked be ToObject(template). |
| 15 |
4. ReturnIfAbrupt(cooked). |
| 16 |
5. Let raw be ToObject(Get(cooked, "raw")). |
| 17 |
6. ReturnIfAbrupt(raw). |
| 18 |
7. Let literalSegments be ToLength(Get(raw, "length")). |
| 19 |
8. ReturnIfAbrupt(literalSegments). |
| 20 |
---*/ |
| 21 |
|
| 22 |
var obj = { |
| 23 |
raw: {} |
| 24 |
}; |
| 25 |
Object.defineProperty(obj.raw, 'length', { |
| 26 |
get: function() { |
| 27 |
throw new Test262Error(); |
| 28 |
} |
| 29 |
}); |
| 30 |
|
| 31 |
assert.throws(Test262Error, function() { |
| 32 |
String.raw(obj); |
| 33 |
}); |