Skip to content

Commit 22cc8a0

Browse files
BridgeARtargos
authored andcommitted
repl: simplify repl autocompletion
This simplifies calling `filteredOwnPropertyNames()`. The context is not used in that function, so there's no need to call the function as such. PR-URL: nodejs#30907 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 5b6e514 commit 22cc8a0

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

lib/repl.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,11 +1290,9 @@ function complete(line, callback) {
12901290
completionGroups.push(getGlobalLexicalScopeNames(this[kContextId]));
12911291
let contextProto = this.context;
12921292
while (contextProto = ObjectGetPrototypeOf(contextProto)) {
1293-
completionGroups.push(
1294-
filteredOwnPropertyNames.call(this, contextProto));
1293+
completionGroups.push(filteredOwnPropertyNames(contextProto));
12951294
}
1296-
const contextOwnNames =
1297-
filteredOwnPropertyNames.call(this, this.context);
1295+
const contextOwnNames = filteredOwnPropertyNames(this.context);
12981296
if (!this.useGlobal) {
12991297
// When the context is not `global`, builtins are not own
13001298
// properties of it.
@@ -1309,7 +1307,7 @@ function complete(line, callback) {
13091307
if (obj != null) {
13101308
if (typeof obj === 'object' || typeof obj === 'function') {
13111309
try {
1312-
memberGroups.push(filteredOwnPropertyNames.call(this, obj));
1310+
memberGroups.push(filteredOwnPropertyNames(obj));
13131311
} catch {
13141312
// Probably a Proxy object without `getOwnPropertyNames` trap.
13151313
// We simply ignore it here, as we don't want to break the
@@ -1327,7 +1325,7 @@ function complete(line, callback) {
13271325
p = obj.constructor ? obj.constructor.prototype : null;
13281326
}
13291327
while (p !== null) {
1330-
memberGroups.push(filteredOwnPropertyNames.call(this, p));
1328+
memberGroups.push(filteredOwnPropertyNames(p));
13311329
p = ObjectGetPrototypeOf(p);
13321330
// Circular refs possible? Let's guard against that.
13331331
sentinel--;

0 commit comments

Comments
 (0)