mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-19 21:57:30 +09:00
Fix loops in Dict.jsm
SyntaxError: missing ] after element list
This commit is contained in:
parent
a6699f01f6
commit
8d8b2154ab
1 changed files with 45 additions and 9 deletions
|
|
@ -171,7 +171,12 @@ Dict.prototype = Object.freeze({
|
||||||
* Returns a list of all the keys in the dictionary in an arbitrary order.
|
* Returns a list of all the keys in the dictionary in an arbitrary order.
|
||||||
*/
|
*/
|
||||||
listkeys: function Dict_listkeys() {
|
listkeys: function Dict_listkeys() {
|
||||||
return [unconvert(k) for (k in this._state.items)];
|
// Tycho: return [unconvert(k) for (k in this._state.items)];
|
||||||
|
let rv = [];
|
||||||
|
for (let k in this._state.items) {
|
||||||
|
rv.push(unconvert(k));
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -179,7 +184,12 @@ Dict.prototype = Object.freeze({
|
||||||
*/
|
*/
|
||||||
listvalues: function Dict_listvalues() {
|
listvalues: function Dict_listvalues() {
|
||||||
var items = this._state.items;
|
var items = this._state.items;
|
||||||
return [items[k] for (k in items)];
|
// Tycho: return [items[k] for (k in items)];
|
||||||
|
let rv = [];
|
||||||
|
for (let k in items) {
|
||||||
|
rv.push(items[k]);
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -188,7 +198,12 @@ Dict.prototype = Object.freeze({
|
||||||
*/
|
*/
|
||||||
listitems: function Dict_listitems() {
|
listitems: function Dict_listitems() {
|
||||||
var items = this._state.items;
|
var items = this._state.items;
|
||||||
return [[unconvert(k), items[k]] for (k in items)];
|
//Tycho: return [[unconvert(k), items[k]] for (k in items)];
|
||||||
|
let rv = [];
|
||||||
|
for (let k in items) {
|
||||||
|
rv.push([unconvert(k), items[k]]);
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -200,7 +215,12 @@ Dict.prototype = Object.freeze({
|
||||||
// If we don't capture this._state.items here then the this-binding will be
|
// If we don't capture this._state.items here then the this-binding will be
|
||||||
// incorrect when the generator is executed
|
// incorrect when the generator is executed
|
||||||
var items = this._state.items;
|
var items = this._state.items;
|
||||||
return (unconvert(k) for (k in items));
|
// Tycho: return (unconvert(k) for (k in items));
|
||||||
|
let rv = [];
|
||||||
|
for (let k in items) {
|
||||||
|
rv.push(unconvert(k));
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -212,7 +232,12 @@ Dict.prototype = Object.freeze({
|
||||||
// If we don't capture this._state.items here then the this-binding will be
|
// If we don't capture this._state.items here then the this-binding will be
|
||||||
// incorrect when the generator is executed
|
// incorrect when the generator is executed
|
||||||
var items = this._state.items;
|
var items = this._state.items;
|
||||||
return (items[k] for (k in items));
|
// Tycho: return (items[k] for (k in items));
|
||||||
|
let rv = [];
|
||||||
|
for (let k in items) {
|
||||||
|
rv.push(items[k]);
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -224,16 +249,27 @@ Dict.prototype = Object.freeze({
|
||||||
// If we don't capture this._state.items here then the this-binding will be
|
// If we don't capture this._state.items here then the this-binding will be
|
||||||
// incorrect when the generator is executed
|
// incorrect when the generator is executed
|
||||||
var items = this._state.items;
|
var items = this._state.items;
|
||||||
return ([unconvert(k), items[k]] for (k in items));
|
// Tycho: return ([unconvert(k), items[k]] for (k in items));
|
||||||
|
let rv = [];
|
||||||
|
for (let k in items) {
|
||||||
|
rv.push([unconvert(k), items[k]]);
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a String representation of this dictionary.
|
* Returns a String representation of this dictionary.
|
||||||
*/
|
*/
|
||||||
toString: function Dict_toString() {
|
toString: function Dict_toString() {
|
||||||
return "{" +
|
// Tycho:
|
||||||
[(key + ": " + val) for ([key, val] in this.items)].join(", ") +
|
// return "{" +
|
||||||
"}";
|
// [(key + ": " + val) for ([key, val] in this.items)].join(", ") +
|
||||||
|
// "}";
|
||||||
|
let dictString = [];
|
||||||
|
for (let [key, val] in this.items) {
|
||||||
|
dictString.push(key + ": " + value);
|
||||||
|
}
|
||||||
|
return "{" + dictString.join(", ") + "}";
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue