typed-arrays/bigint: fixes per recommendation. (#1473)

Fixes gh-1467
This commit is contained in:
Rick Waldron 2018-03-06 15:14:11 -05:00 committed by Leo Balter
parent ac55e29ed0
commit ce9419779f
4 changed files with 6 additions and 21 deletions

View File

@ -20,18 +20,3 @@ verifyProperty(BigInt.prototype, Symbol.toStringTag, {
enumerable: false, enumerable: false,
configurable: true configurable: true
}); });
assert.sameValue(Object.prototype.toString.call(3n), "[object BigInt]");
assert.sameValue(Object.prototype.toString.call(Object(3n)), "[object BigInt]");
// Verify that Object.prototype.toString does not have special casing for BigInt
// as it does for most other primitive types
Object.defineProperty(BigInt.prototype, Symbol.toStringTag, {
value: "FooBar",
writable: false,
enumerable: false,
configurable: true
});
assert.sameValue(Object.prototype.toString.call(3n), "[object FooBar]");
assert.sameValue(Object.prototype.toString.call(Object(3n)), "[object FooBar]");

View File

@ -38,7 +38,7 @@ Object.defineProperty(newTarget, "prototype", {
} }
}); });
var sample = new Int8Array(); var sample = new BigInt64Array();
testWithBigIntTypedArrayConstructors(function(TA) { testWithBigIntTypedArrayConstructors(function(TA) {
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {

View File

@ -52,7 +52,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
ta.buffer.constructor = bufferConstructor; ta.buffer.constructor = bufferConstructor;
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
var targetType = TA !== Int32Array ? Int32Array : Uint32Array; var targetType = TA !== BigInt64Array ? BigInt64Array : BigUint64Array;
new targetType(ta); new targetType(ta);
}, "TypeError thrown for detached source buffer"); }, "TypeError thrown for detached source buffer");

View File

@ -2,20 +2,20 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-typedarray-typedarray esid: sec-typedarray-typedarray
description: > description: Instantiate a new TypedArray with an existing TypedArray
Return abrupt from getting typedArray argument's buffer.constructor.@@species
info: | info: |
22.2.4.3 TypedArray ( typedArray ) 22.2.4.3 TypedArray ( typedArray )
This description applies only if the TypedArray function is called with at This description applies only if the TypedArray function is called with at
least one argument and the Type of the first argument is Object and that least one argument and the Type of the first argument is Object and that
object has a [[TypedArrayName]] internal slot. object has a [[TypedArrayName]] internal slot.
includes: [testBigIntTypedArray.js] includes: [testBigIntTypedArray.js]
features: [BigInt, TypedArray] features: [BigInt, TypedArray]
---*/ ---*/
var sample1 = new BigInt64Array(); var sample1 = new BigInt64Array(7);
var sample2 = new BigUint64Array(); var sample2 = new BigUint64Array(7);
testWithBigIntTypedArrayConstructors(function(TA) { testWithBigIntTypedArrayConstructors(function(TA) {
var sample = TA === BigInt64Array ? sample2 : sample1; var sample = TA === BigInt64Array ? sample2 : sample1;