Skip to content

Commit

Permalink
lib: replace Symbol.asyncIterator by SymbolAsyncIterator
Browse files Browse the repository at this point in the history
PR-URL: #30947
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Sebastien-Ahkrin authored and MylesBorins committed Dec 17, 2019
1 parent 19f05ca commit 92475e9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const {
NumberIsNaN,
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
SymbolAsyncIterator,
} = primordials;

module.exports = Readable;
Expand Down Expand Up @@ -1096,7 +1096,7 @@ Readable.prototype.wrap = function(stream) {
return this;
};

Readable.prototype[Symbol.asyncIterator] = function() {
Readable.prototype[SymbolAsyncIterator] = function() {
if (createReadableStreamAsyncIterator === undefined) {
createReadableStreamAsyncIterator =
require('internal/streams/async_iterator');
Expand Down
3 changes: 2 additions & 1 deletion lib/internal/fs/dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const {
ObjectDefineProperty,
Symbol,
SymbolAsyncIterator,
} = primordials;

const pathModule = require('path');
Expand Down Expand Up @@ -175,7 +176,7 @@ class Dir {
}
}

ObjectDefineProperty(Dir.prototype, Symbol.asyncIterator, {
ObjectDefineProperty(Dir.prototype, SymbolAsyncIterator, {
value: Dir.prototype.entries,
enumerable: false,
writable: true,
Expand Down
6 changes: 3 additions & 3 deletions lib/internal/streams/from.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const {
Symbol,
SymbolAsyncIterator,
SymbolIterator
} = primordials;
const { Buffer } = require('buffer');
Expand All @@ -23,8 +23,8 @@ function from(Readable, iterable, opts) {
});
}

if (iterable && iterable[Symbol.asyncIterator])
iterator = iterable[Symbol.asyncIterator]();
if (iterable && iterable[SymbolAsyncIterator])
iterator = iterable[SymbolAsyncIterator]();
else if (iterable && iterable[SymbolIterator])
iterator = iterable[SymbolIterator]();
else
Expand Down
5 changes: 3 additions & 2 deletions lib/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const {
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
SymbolAsyncIterator,
} = primordials;

const {
Expand Down Expand Up @@ -1078,7 +1079,7 @@ Interface.prototype._ttyWrite = function(s, key) {
}
};

Interface.prototype[Symbol.asyncIterator] = function() {
Interface.prototype[SymbolAsyncIterator] = function() {
if (this[kLineObjectStream] === undefined) {
if (Readable === undefined) {
Readable = require('stream').Readable;
Expand Down Expand Up @@ -1108,7 +1109,7 @@ Interface.prototype[Symbol.asyncIterator] = function() {
this[kLineObjectStream] = readable;
}

return this[kLineObjectStream][Symbol.asyncIterator]();
return this[kLineObjectStream][SymbolAsyncIterator]();
};

/**
Expand Down

0 comments on commit 92475e9

Please sign in to comment.