-
Notifications
You must be signed in to change notification settings - Fork 504
[immutable-arraybuffer] ArrayBuffer.prototype.transferToImmutable #4542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[immutable-arraybuffer] ArrayBuffer.prototype.transferToImmutable #4542
Conversation
397f433
to
1178b37
Compare
54d4221
to
973e13e
Compare
function repr(value) { | ||
if (typeof value === "string") return JSON.stringify(value); | ||
if (typeof value === "bigint") return String(value) + "n"; | ||
if (!value && 1/value === -Infinity) return "-0"; | ||
return String(value); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this belongs here
return String(value); | ||
} | ||
|
||
var goodLengths = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm willing to accept this test, but I think it would be nicer if we could have a generic helper function that runs through a set of interesting ToIndex arguments; this isn't the only API that could be tested in this way.
]; | ||
|
||
for (var i = 0; i < sourceMakers.length; i++) { | ||
var name = sourceMakers[i].name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't take into account that sourceMakers[i]
might be undefined
.
|
||
for (var i = 0; i < sourceMakers.length; i++) { | ||
var name = sourceMakers[i].name; | ||
var newLength = byteLength + i + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calculating the argument based on the index in the array seems a recipe for confusion
]; | ||
|
||
for (var i = 0; i < sourceMakers.length; i++) { | ||
var name = sourceMakers[i].name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
for ( | ||
var newLength = undefined; | ||
(newLength || 0) < byteLength; | ||
newLength = newLength === undefined ? 0 : newLength + 1 | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very convoluted, probably too much so
Ref #4509