blob: 7a9374bb85c51054f54362b9d2071a99a13601bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Copyright (C) 2016 The V8 Project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-number.prototype.toprecision
description: >
Return abrupt completion from ToInteger(symbol precision)
info: |
20.1.3 Properties of the Number Prototype Object
The Number prototype object is the intrinsic object %NumberPrototype%. The
Number prototype object is an ordinary object. The Number prototype is itself
a Number object; it has a [[NumberData]] internal slot with the value +0.
[...]
The abstract operation thisNumberValue(value) performs the following steps:
1. If Type(value) is Number, return value.
2. If Type(value) is Object and value has a [[NumberData]] internal slot, then
a. Assert: value's [[NumberData]] internal slot is a Number value.
b. Return the value of value's [[NumberData]] internal slot.
3. Throw a TypeError exception.
Number.prototype.toPrecision ( precision )
1. Let x be ? thisNumberValue(this value).
2. If precision is undefined, return ! ToString(x).
3. Let p be ? ToInteger(precision).
[...]
features: [Symbol]
---*/
var p = Symbol("1");
assert.throws(TypeError, function() {
Number.prototype.toPrecision(p);
});
reportCompare(0, 0);
|