Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelficarra committed May 25, 2023
1 parent 84bf66f commit 54ccd77
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,21 @@ info: |
features: [iterator-helpers]
flags: []
---*/
function* g() {
yield 0;
yield 1;
yield 2;
}

class TestIterator extends Iterator {
constructor() {
super();
this._remaining = 3;
}
next() {
if (this._remaining > 0) {
return {
done: false,
value: this._remaining--,
};
} else {
return {
done: true,
value: undefined,
};
}
get next() {
let n = g();
return function() {
return n.next();
};
}
return() {
if (this._remaining <= 0) {
throw new Test262Error();
}
return {};
throw new Test262Error();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,21 @@ info: |
features: [iterator-helpers]
flags: []
---*/
function* g() {
yield 0;
yield 1;
yield 2;
}

class TestIterator extends Iterator {
constructor() {
super();
this._remaining = 3;
}
next() {
if (this._remaining > 0) {
return {
done: false,
value: this._remaining--,
};
} else {
return {
done: true,
value: undefined,
};
}
get next() {
let n = g();
return function() {
return n.next();
};
}
return() {
if (this._remaining <= 0) {
throw new Test262Error();
}
return {};
throw new Test262Error();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,21 @@ info: |
features: [iterator-helpers]
flags: []
---*/
function* g() {
yield 0;
yield 1;
yield 2;
}

class TestIterator extends Iterator {
constructor() {
super();
this._remaining = 3;
}
next() {
if (this._remaining > 0) {
return {
done: false,
value: this._remaining--,
};
} else {
return {
done: true,
value: undefined,
};
}
get next() {
let n = g();
return function() {
return n.next();
};
}
return() {
if (this._remaining <= 0) {
throw new Test262Error();
}
return {};
throw new Test262Error();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,21 @@ info: |
features: [iterator-helpers]
flags: []
---*/
function* g() {
yield 0;
yield 1;
yield 2;
}

class TestIterator extends Iterator {
constructor() {
super();
this._remaining = 3;
}
next() {
if (this._remaining > 0) {
return {
done: false,
value: this._remaining--,
};
} else {
return {
done: true,
value: undefined,
};
}
get next() {
let n = g();
return function() {
return n.next();
};
}
return() {
if (this._remaining <= 0) {
throw new Test262Error();
}
return {};
throw new Test262Error();
}
}

Expand Down
27 changes: 11 additions & 16 deletions test/built-ins/Iterator/prototype/take/exhaustion-calls-return.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,18 @@ info: |
features: [iterator-helpers]
flags: []
---*/
function* g() {
yield 0;
yield 1;
yield 2;
}

class TestIterator extends Iterator {
constructor() {
super();
this._remaining = 3;
}
next() {
if (this._remaining > 0) {
return {
done: false,
value: this._remaining--,
};
} else {
return {
done: true,
value: undefined,
};
}
get next() {
let n = g();
return function() {
return n.next();
};
}
return() {
throw new Test262Error();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*---
esid: sec-iteratorprototype.toArray
description: >
Iterator.prototype.toArray returns undefined when the iterator has already been exhausted
Iterator.prototype.toArray returns an empty array when the iterator has already been exhausted
info: |
%Iterator.prototype%.toArray ( )
Expand Down

0 comments on commit 54ccd77

Please sign in to comment.