1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 15:07:57 +01:00

Remove remaining comprehensions.

This commit is contained in:
Doug Kearns
2016-01-29 23:26:05 +11:00
parent b9849df565
commit c9c9cea6d0
5 changed files with 32 additions and 19 deletions

View File

@@ -290,9 +290,10 @@ var HintSession = Class("HintSession", CommandMode, {
let doc = win.document;
memoize(doc, "dactylLabels", () =>
iter([l.getAttribute("for"), l]
for (l of doc.querySelectorAll("label[for]")))
.toObject());
iter(function* () {
for (let l of doc.querySelectorAll("label[for]"))
yield [l.getAttribute("for"), l];
}()).toObject());
let [offsetX, offsetY] = this.getContainerOffsets(doc);

View File

@@ -542,14 +542,18 @@ var Contexts = Module("contexts", {
var makeParams = function makeParams(self, args) {
let obj = params.apply(self, args);
return iter.toObject([k, Proxy(obj, k)]
for (k of properties(obj)));
return iter.toObject(function* () {
for (let k of properties(obj))
yield [k, Proxy(obj, k)];
}());
};
else if (params)
makeParams = function makeParams(self, args) {
return iter.toObject([name, process(args[i])]
for ([i, name] of iter(params)));
return iter.toObject(function* () {
for (let [i, name] of iter(params))
yield [name, process(args[i])];
}());
};
let rhs = args.literalArg;

View File

@@ -378,14 +378,16 @@ var Highlights = Module("Highlight", {
template.tabular(["Key", "Sample", "Link", "CSS"],
["padding: 0 1em 0 0; vertical-align: top; max-width: 16em; overflow: hidden;",
"text-align: center"],
([h.class,
["span", { style: "text-align: center; line-height: 1em;" + h.value + style }, "XXX"],
template.map(h.extends, s => template.highlight(s), ","),
template.highlightRegexp(h.value, /\b[-\w]+(?=:)|\/\*.*?\*\//g,
match => ["span", { highlight: match[0] == "/" ? "Comment" : "Key" }, match])
]
for (h of highlight)
if (!key || h.class.indexOf(key) > -1))));
(function* () {
for (let h of highlight)
if (!key || h.class.indexOf(key) > -1)
yield [h.class,
["span", { style: "text-align: center; line-height: 1em;" + h.value + style }, "XXX"],
template.map(h.extends, s => template.highlight(s), ","),
template.highlightRegexp(h.value, /\b[-\w]+(?=:)|\/\*.*?\*\//g,
match => ["span", { highlight: match[0] == "/" ? "Comment" : "Key" }, match])];
}())
));
else if (!key && clear)
highlight.clear();
else if (key)

View File

@@ -548,7 +548,11 @@ var Option = Class("Option", {
},
stringmap: function (vals) {
return [Option.quote(k, /:/) + ":" + Option.quote(v, /:/) for ([k, v] of iter(vals))].join(",");
return Array.from(iter(vals),
([k, v]) => Option.quote(k, /:/) +
":" +
Option.quote(v, /:/))
.join(",");
},
regexplist: vals => vals.join(","),

View File

@@ -304,9 +304,11 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
// Urgh. Hack.
let namespaces;
if (attrs)
namespaces = iter([k.slice(6), DOM.fromJSON.namespaces[v] || v]
for ([k, v] of iter(attrs))
if (/^xmlns(?:$|:)/.test(k))).toObject();
namespaces = iter(function* () {
for (let [k, v] of iter(attrs))
if (/^xmlns(?:$|:)/.test(k))
yield [k.slice(6), DOM.fromJSON.namespaces[v] || v];
}()).toObject();
let node = DOM.fromJSON(xml, doc, obj.objects, namespaces);