Browse Source

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.
Nathan Rajlich 14 years ago
committed by Ryan Dahl
parent
commit
8ec31a3362
  1. 2
      lib/repl.js

2
lib/repl.js

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

Loading…
Cancel
Save