Skip to content

Commit f7eeb8c

Browse files
BridgeARMylesBorins
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 d549dae commit f7eeb8c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/repl.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -1280,11 +1280,9 @@ function complete(line, callback) {
12801280
completionGroups.push(getGlobalLexicalScopeNames(this[kContextId]));
12811281
let contextProto = this.context;
12821282
while (contextProto = ObjectGetPrototypeOf(contextProto)) {
1283-
completionGroups.push(
1284-
filteredOwnPropertyNames.call(this, contextProto));
1283+
completionGroups.push(filteredOwnPropertyNames(contextProto));
12851284
}
1286-
const contextOwnNames =
1287-
filteredOwnPropertyNames.call(this, this.context);
1285+
const contextOwnNames = filteredOwnPropertyNames(this.context);
12881286
if (!this.useGlobal) {
12891287
// When the context is not `global`, builtins are not own
12901288
// properties of it.
@@ -1299,7 +1297,7 @@ function complete(line, callback) {
12991297
if (obj != null) {
13001298
if (typeof obj === 'object' || typeof obj === 'function') {
13011299
try {
1302-
memberGroups.push(filteredOwnPropertyNames.call(this, obj));
1300+
memberGroups.push(filteredOwnPropertyNames(obj));
13031301
} catch {
13041302
// Probably a Proxy object without `getOwnPropertyNames` trap.
13051303
// We simply ignore it here, as we don't want to break the
@@ -1317,7 +1315,7 @@ function complete(line, callback) {
13171315
p = obj.constructor ? obj.constructor.prototype : null;
13181316
}
13191317
while (p !== null) {
1320-
memberGroups.push(filteredOwnPropertyNames.call(this, p));
1318+
memberGroups.push(filteredOwnPropertyNames(p));
13211319
p = ObjectGetPrototypeOf(p);
13221320
// Circular refs possible? Let's guard against that.
13231321
sentinel--;

0 commit comments

Comments
 (0)