Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: mark some known globals or their functions as impure
- Loading branch information
Showing
5 changed files
with
37 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
description: 'Retain functions that consume iterable' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
let effects = []; | ||
|
||
const iterable = { | ||
[Symbol.iterator]() { | ||
return { | ||
next() { | ||
effects.push('effect'); | ||
return { done: true }; | ||
} | ||
}; | ||
} | ||
}; | ||
|
||
new Map(iterable); | ||
new Set(iterable); | ||
new WeakMap(iterable); | ||
new WeakSet(iterable); | ||
Float32Array.from(iterable); | ||
Float64Array.from(iterable); | ||
Int16Array.from(iterable); | ||
Int32Array.from(iterable); | ||
Int8Array.from(iterable); | ||
Uint16Array.from(iterable); | ||
Uint32Array.from(iterable); | ||
Uint8Array.from(iterable); | ||
Uint8ClampedArray.from(iterable); | ||
Object.fromEntries(iterable); | ||
|
||
assert.equal(effects.length, 14); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.