-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
repl: refactor to avoid unsafe array iteration #36444
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
Closed
RaisinTen
wants to merge
20
commits into
nodejs:master
from
RaisinTen:lib/refactor-to-remove-for-of-loop-with-let-in-repl.js
Closed
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b81f448
lib: refactor to remove for-let-of loop in repl.js
RaisinTen f5d6c33
Apply suggestion from code review
RaisinTen b6b3c5b
lib: require ArrayPrototypeForEach in repl.js
RaisinTen 0a167a1
lib: fix syntax error repl.js
RaisinTen 3a9491e
lib: replace another loop repl.js
RaisinTen 846ac65
lib: fix lint error repl.js
RaisinTen 9367f9b
Apply suggestions from code review
RaisinTen 61cb3b7
lib: replace all for loops with ArrayPrototypeForEach in repl.js
RaisinTen 10c1759
lib: fix syntax error repl.js
RaisinTen 669f93e
lib: fix lint error
RaisinTen dc678b0
lib: replace ArrayPrototypeSort with ArrayPrototypeForEach in repl.js
RaisinTen ddfbfc4
test: add unsafe array iteration test to repl
RaisinTen 77a6be5
test: add notStrictEqual check instead for repl.js
RaisinTen 6c19991
Update test/parallel/test-repl-unsafe-array-iteration.js
RaisinTen ccc860a
test: add test using child_process instead
RaisinTen 81776d6
test: remove error code check
RaisinTen a45f1ed
Update test/parallel/test-repl-unsafe-array-iteration.js
RaisinTen c61b0b9
Update test/parallel/test-repl-unsafe-array-iteration.js
RaisinTen 71350bd
Update test/parallel/test-repl-unsafe-array-iteration.js
RaisinTen 1ec7036
Update test/parallel/test-repl-unsafe-array-iteration.js
RaisinTen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,22 @@ | ||
| 'use strict'; | ||
| const common = require('../common'); | ||
| const assert = require('assert'); | ||
| const { spawn } = require('child_process'); | ||
|
|
||
| function run(input, expectation) { | ||
| const node = spawn(process.argv0); | ||
|
|
||
| node.stderr.on('data', common.mustNotCall()); | ||
| node.on('exit', common.mustCall((code) => assert.strictEqual(code, 0))); | ||
|
|
||
| node.stdin.write(input); | ||
| node.stdin.end(); | ||
| } | ||
|
|
||
| run('delete Array.prototype[Symbol.iterator];', | ||
| 'TypeError: Found non-callable @@iterator'); | ||
|
|
||
| run('const ArrayIteratorPrototype =' + | ||
| 'Object.getPrototypeOf(Array.prototype[Symbol.iterator]());' + | ||
| 'delete ArrayIteratorPrototype.next;', | ||
| 'TypeError: fn is not a function'); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.