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.
This commit is contained in:
Nathan Rajlich 2011-08-23 10:39:23 -07:00 committed by Ryan Dahl
parent b15ab5de51
commit 8ec31a3362

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));