Skip to content

Commit 9b893e1

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: #30907 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 78dcdee commit 9b893e1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/repl.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,11 +1294,9 @@ function complete(line, callback) {
12941294
completionGroups.push(getGlobalLexicalScopeNames(this[kContextId]));
12951295
let contextProto = this.context;
12961296
while (contextProto = ObjectGetPrototypeOf(contextProto)) {
1297-
completionGroups.push(
1298-
filteredOwnPropertyNames.call(this, contextProto));
1297+
completionGroups.push(filteredOwnPropertyNames(contextProto));
12991298
}
1300-
const contextOwnNames =
1301-
filteredOwnPropertyNames.call(this, this.context);
1299+
const contextOwnNames = filteredOwnPropertyNames(this.context);
13021300
if (!this.useGlobal) {
13031301
// When the context is not `global`, builtins are not own
13041302
// properties of it.
@@ -1313,7 +1311,7 @@ function complete(line, callback) {
13131311
if (obj != null) {
13141312
if (typeof obj === 'object' || typeof obj === 'function') {
13151313
try {
1316-
memberGroups.push(filteredOwnPropertyNames.call(this, obj));
1314+
memberGroups.push(filteredOwnPropertyNames(obj));
13171315
} catch {
13181316
// Probably a Proxy object without `getOwnPropertyNames` trap.
13191317
// We simply ignore it here, as we don't want to break the
@@ -1331,7 +1329,7 @@ function complete(line, callback) {
13311329
p = obj.constructor ? obj.constructor.prototype : null;
13321330
}
13331331
while (p !== null) {
1334-
memberGroups.push(filteredOwnPropertyNames.call(this, p));
1332+
memberGroups.push(filteredOwnPropertyNames(p));
13351333
p = ObjectGetPrototypeOf(p);
13361334
// Circular refs possible? Let's guard against that.
13371335
sentinel--;

0 commit comments

Comments
 (0)