Use Object.getPrototypeOf() on the object in the REPL tab-completion.

Some people use __proto__ to augment an Object's prototype after it's been created.
This patch helps make the "new" prototype properties visible if necessary.

This is also more consistent with the while logic below.
pull/22966/head
Nathan Rajlich 2011-08-23 10:39:23 -07:00 committed by Ryan Dahl
parent b15ab5de51
commit 8ec31a3362
1 changed files with 1 additions and 1 deletions

View File

@ -412,8 +412,8 @@ REPLServer.prototype.complete = function(line) {
memberGroups.push(Object.getOwnPropertyNames(obj));
}
// works for non-objects
var p = obj.constructor ? obj.constructor.prototype : null;
try {
var p = Object.getPrototypeOf(obj);
var sentinel = 5;
while (p !== null) {
memberGroups.push(Object.getOwnPropertyNames(p));