1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00

refactor(ext/streams): remove fake detached (#16431)

Removed "fake detached" logic since it's no longer needed after
[#16294](https://github.com/denoland/deno/pull/16294) landed
This commit is contained in:
Marcos Casagrande 2022-10-26 20:40:26 +02:00 committed by GitHub
parent 6ac603ec88
commit de580cedd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -187,20 +187,12 @@
); );
} }
const isFakeDetached = Symbol("<<detached>>");
/** /**
* @param {ArrayBufferLike} O * @param {ArrayBufferLike} O
* @returns {boolean} * @returns {boolean}
*/ */
function isDetachedBuffer(O) { function isDetachedBuffer(O) {
if (O.byteLength !== 0) { return O.byteLength === 0 && ops.op_arraybuffer_was_detached(O);
return false;
}
// TODO(marcosc90) remove isFakeDetached once transferArrayBuffer
// actually detaches the buffer
return ReflectHas(O, isFakeDetached) ||
core.ops.op_arraybuffer_was_detached(O);
} }
/** /**
@ -225,9 +217,7 @@
* @returns {ArrayBufferLike} * @returns {ArrayBufferLike}
*/ */
function transferArrayBuffer(O) { function transferArrayBuffer(O) {
const v = ops.op_transfer_arraybuffer(O); return ops.op_transfer_arraybuffer(O);
O[isFakeDetached] = true;
return v;
} }
/** /**