- From: isonmad <notifications@github.com>
- Date: Thu, 19 Jan 2017 13:06:38 -0800
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/pull/661/review/17557094@github.com>
isonmad commented on this pull request.
> @@ -2,39 +2,43 @@
const assert = require('assert');
const { IsFiniteNonNegativeNumber } = require('./helpers.js');
-exports.DequeueValue = queue => {
- assert(queue.length > 0, 'Spec-level failure: should never dequeue from an empty queue.');
- const pair = queue.shift();
+exports.DequeueValue = container => {
+ assert('_queue' in container && '_queueTotalSize' in container,
+ 'Spec-level failure: ResetQueue should only be used on containers with [[queue]] and [[queueTotalSize]].');
Copypasted assert text.
>
return pair.value;
};
-exports.EnqueueValueWithSize = (queue, value, size) => {
+exports.EnqueueValueWithSize = (container, value, size) => {
+ assert('_queue' in container && '_queueTotalSize' in container,
+ 'Spec-level failure: ResetQueue should only be used on containers with [[queue]] and [[queueTotalSize]].');
Same here.
> };
-// This implementation is not per-spec. Total size is cached for speed.
-exports.GetTotalQueueSize = queue => {
- if (queue._totalSize === undefined) {
- queue._totalSize = 0;
- }
- return queue._totalSize;
-};
+exports.PeekQueueValue = container => {
+ assert('_queue' in container && '_queueTotalSize' in container,
+ 'Spec-level failure: ResetQueue should only be used on containers with [[queue]] and [[queueTotalSize]].');
Same here.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/661#pullrequestreview-17557094
Received on Thursday, 19 January 2017 21:07:22 UTC