Use __proto__ on the object in the REPL tab-completion. #1572

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@TooTallNate

Some people (me) use __proto__ to augment an Object's prototype after it's been created.
This patch helps make the "new" prototype properties visible if necessary in the REPL's tab completion.

I would attach a test case but I'm not sure how to test for this tab-completion behavior. At least I couldn't find an existing one.

Thanks in advance!

@TooTallNate TooTallNate Use __proto__ 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.
8bf25e7
@koichik

__proto__ is not a part of ECMA262, I think that Object.getPrototypeOf() is better:

var p = Object.getPrototypeOf(obj);
Owner

I don't disagree, in fact that was my initial instinct. I wen't with __proto__ because of the comment above this line "works for non-objects". Object.getPrototypeOf() throws on non-objects so I figured that's why that was there.

Though, I couldn't seem to get any tab-completion working on literals anyways, so making it "work for non-objects" might be pointless.

@TooTallNate

@koichik Here's a perhaps better patch: https://gist.github.com/1165960

@TooTallNate

Closed by 8ec31a3...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment