1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 20:17:59 +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; let doc = win.document;
memoize(doc, "dactylLabels", () => memoize(doc, "dactylLabels", () =>
iter([l.getAttribute("for"), l] iter(function* () {
for (l of doc.querySelectorAll("label[for]"))) for (let l of doc.querySelectorAll("label[for]"))
.toObject()); yield [l.getAttribute("for"), l];
}()).toObject());
let [offsetX, offsetY] = this.getContainerOffsets(doc); let [offsetX, offsetY] = this.getContainerOffsets(doc);

View File

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

View File

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

View File

@@ -548,7 +548,11 @@ var Option = Class("Option", {
}, },
stringmap: function (vals) { 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(","), regexplist: vals => vals.join(","),

View File

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