Merge pull request #4744 from atom/remove-unneeded-results-collecting

Remove unneeded results collecting/returning
This commit is contained in:
Kevin Sawicki 2016-03-11 09:36:02 -08:00
commit 1346122d35
3 changed files with 18 additions and 37 deletions

View file

@ -132,9 +132,8 @@ Menu.prototype._init = function() {
return function() { return function() {
// Make sure radio groups have at least one menu item seleted. // Make sure radio groups have at least one menu item seleted.
var checked, group, id, j, len, radioItem, ref1, results; var checked, group, id, j, len, radioItem, ref1;
ref1 = _this.groupsMap; ref1 = _this.groupsMap;
results = [];
for (id in ref1) { for (id in ref1) {
group = ref1[id]; group = ref1[id];
checked = false; checked = false;
@ -147,12 +146,9 @@ Menu.prototype._init = function() {
break; break;
} }
if (!checked) { if (!checked) {
results.push(v8Util.setHiddenValue(group[0], 'checked', true)); v8Util.setHiddenValue(group[0], 'checked', true);
} else {
results.push(void 0);
} }
} }
return results;
}; };
})(this) })(this)
}; };
@ -249,25 +245,19 @@ Menu.prototype.insert = function(pos, item) {
// Force menuWillShow to be called // Force menuWillShow to be called
Menu.prototype._callMenuWillShow = function() { Menu.prototype._callMenuWillShow = function() {
var item, j, len, ref1, ref2, results; if (this.delegate != null) {
if ((ref1 = this.delegate) != null) { this.delegate.menuWillShow();
ref1.menuWillShow();
} }
ref2 = this.items; this.items.forEach(function(item) {
results = [];
for (j = 0, len = ref2.length; j < len; j++) {
item = ref2[j];
if (item.submenu != null) { if (item.submenu != null) {
results.push(item.submenu._callMenuWillShow()); item.submenu._callMenuWillShow();
} }
} });
return results;
}; };
var applicationMenu = null; var applicationMenu = null;
Menu.setApplicationMenu = function(menu) { Menu.setApplicationMenu = function(menu) {
var j, len, results, w, windows;
if (!(menu === null || menu.constructor === Menu)) { if (!(menu === null || menu.constructor === Menu)) {
throw new TypeError('Invalid menu'); throw new TypeError('Invalid menu');
} }
@ -279,15 +269,11 @@ Menu.setApplicationMenu = function(menu) {
return; return;
} }
menu._callMenuWillShow(); menu._callMenuWillShow();
return bindings.setApplicationMenu(menu); bindings.setApplicationMenu(menu);
} else { } else {
windows = BrowserWindow.getAllWindows(); BrowserWindow.getAllWindows().forEach(function(window) {
results = []; window.setMenu(menu);
for (j = 0, len = windows.length; j < len; j++) { });
w = windows[j];
results.push(w.setMenu(menu));
}
return results;
} }
}; };

View file

@ -24,14 +24,12 @@
// Clean cache on quit. // Clean cache on quit.
process.on('exit', function() { process.on('exit', function() {
var archive, p, results; var archive, p;
results = [];
for (p in cachedArchives) { for (p in cachedArchives) {
if (!hasProp.call(cachedArchives, p)) continue; if (!hasProp.call(cachedArchives, p)) continue;
archive = cachedArchives[p]; archive = cachedArchives[p];
results.push(archive.destroy()); archive.destroy();
} }
return results;
}); });
// Separate asar package's path from full path. // Separate asar package's path from full path.

View file

@ -297,7 +297,6 @@ class BlinkFeaturesAttribute extends WebViewAttribute {
// Sets up all of the webview attributes. // Sets up all of the webview attributes.
WebViewImpl.prototype.setupWebViewAttributes = function() { WebViewImpl.prototype.setupWebViewAttributes = function() {
var attribute, autosizeAttributes, i, len, results;
this.attributes = {}; this.attributes = {};
this.attributes[webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY] = new AllowTransparencyAttribute(this); this.attributes[webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY] = new AllowTransparencyAttribute(this);
this.attributes[webViewConstants.ATTRIBUTE_AUTOSIZE] = new AutosizeAttribute(this); this.attributes[webViewConstants.ATTRIBUTE_AUTOSIZE] = new AutosizeAttribute(this);
@ -311,11 +310,9 @@ WebViewImpl.prototype.setupWebViewAttributes = function() {
this.attributes[webViewConstants.ATTRIBUTE_ALLOWPOPUPS] = new BooleanAttribute(webViewConstants.ATTRIBUTE_ALLOWPOPUPS, this); this.attributes[webViewConstants.ATTRIBUTE_ALLOWPOPUPS] = new BooleanAttribute(webViewConstants.ATTRIBUTE_ALLOWPOPUPS, this);
this.attributes[webViewConstants.ATTRIBUTE_PRELOAD] = new PreloadAttribute(this); this.attributes[webViewConstants.ATTRIBUTE_PRELOAD] = new PreloadAttribute(this);
this.attributes[webViewConstants.ATTRIBUTE_BLINKFEATURES] = new BlinkFeaturesAttribute(this); this.attributes[webViewConstants.ATTRIBUTE_BLINKFEATURES] = new BlinkFeaturesAttribute(this);
autosizeAttributes = [webViewConstants.ATTRIBUTE_MAXHEIGHT, webViewConstants.ATTRIBUTE_MAXWIDTH, webViewConstants.ATTRIBUTE_MINHEIGHT, webViewConstants.ATTRIBUTE_MINWIDTH];
results = []; const autosizeAttributes = [webViewConstants.ATTRIBUTE_MAXHEIGHT, webViewConstants.ATTRIBUTE_MAXWIDTH, webViewConstants.ATTRIBUTE_MINHEIGHT, webViewConstants.ATTRIBUTE_MINWIDTH];
for (i = 0, len = autosizeAttributes.length; i < len; i++) { autosizeAttributes.forEach((attribute) => {
attribute = autosizeAttributes[i]; this.attributes[attribute] = new AutosizeDimensionAttribute(attribute, this);
results.push(this.attributes[attribute] = new AutosizeDimensionAttribute(attribute, this)); });
}
return results;
}; };