repl: do not insert duplicates into completions
Fix invalid `hasOwnProperty` function usage. For example, before in the REPL: ``` > Ar<Tab> Array Array ArrayBuffer ``` Now: ``` > Ar<Tab> Array ArrayBuffer ``` Fixes #6255. Closes #6498.
This commit is contained in:
parent
2010985354
commit
568072ceae
@ -641,7 +641,7 @@ REPLServer.prototype.complete = function(line, callback) {
|
|||||||
group.sort();
|
group.sort();
|
||||||
for (var j = 0; j < group.length; j++) {
|
for (var j = 0; j < group.length; j++) {
|
||||||
c = group[j];
|
c = group[j];
|
||||||
if (!hasOwnProperty(c)) {
|
if (!hasOwnProperty(uniq, c)) {
|
||||||
completions.push(c);
|
completions.push(c);
|
||||||
uniq[c] = true;
|
uniq[c] = true;
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,9 @@ putIn.run([
|
|||||||
testMe.complete('inner.o', function(error, data) {
|
testMe.complete('inner.o', function(error, data) {
|
||||||
assert.deepEqual(data, doesNotBreak);
|
assert.deepEqual(data, doesNotBreak);
|
||||||
});
|
});
|
||||||
|
testMe.complete('console.lo', function(error, data) {
|
||||||
|
assert.deepEqual(data, [['console.log'], 'console.lo']);
|
||||||
|
});
|
||||||
|
|
||||||
// Tab Complete will return globaly scoped variables
|
// Tab Complete will return globaly scoped variables
|
||||||
putIn.run(['};']);
|
putIn.run(['};']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user