Skip to content

Commit

Permalink
typed-arrays/bigint: fixes per recommendation. (#1473)
Browse files Browse the repository at this point in the history
Fixes gh-1467
  • Loading branch information
rwaldron authored and leobalter committed Mar 6, 2018
1 parent ac55e29 commit ce94197
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 21 deletions.
15 changes: 0 additions & 15 deletions test/built-ins/BigInt/prototype/Symbol.toStringTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,3 @@ verifyProperty(BigInt.prototype, Symbol.toStringTag, {
enumerable: false,
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]");
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Object.defineProperty(newTarget, "prototype", {
}
});

var sample = new Int8Array();
var sample = new BigInt64Array();

testWithBigIntTypedArrayConstructors(function(TA) {
assert.throws(Test262Error, function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
ta.buffer.constructor = bufferConstructor;

assert.throws(TypeError, function() {
var targetType = TA !== Int32Array ? Int32Array : Uint32Array;
var targetType = TA !== BigInt64Array ? BigInt64Array : BigUint64Array;
new targetType(ta);
}, "TypeError thrown for detached source buffer");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-typedarray-typedarray
description: >
Return abrupt from getting typedArray argument's buffer.constructor.@@species
description: Instantiate a new TypedArray with an existing TypedArray
info: |
22.2.4.3 TypedArray ( typedArray )
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
object has a [[TypedArrayName]] internal slot.
includes: [testBigIntTypedArray.js]
features: [BigInt, TypedArray]
---*/

var sample1 = new BigInt64Array();
var sample2 = new BigUint64Array();
var sample1 = new BigInt64Array(7);
var sample2 = new BigUint64Array(7);

testWithBigIntTypedArrayConstructors(function(TA) {
var sample = TA === BigInt64Array ? sample2 : sample1;
Expand Down

0 comments on commit ce94197

Please sign in to comment.