mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-24 12:53:31 +01:00
Avoid using delete operator.
This commit is contained in:
@@ -435,7 +435,7 @@ this.Set = deprecated("RealSet", function Set(ary) {
|
|||||||
* @param {string} key The key to add.
|
* @param {string} key The key to add.
|
||||||
* @returns boolean
|
* @returns boolean
|
||||||
*/
|
*/
|
||||||
Set.add = deprecated("Set#add",
|
Set.add = deprecated("RealSet#add",
|
||||||
curry(function Set__add(set, key) {
|
curry(function Set__add(set, key) {
|
||||||
if (isinstance(set, ["Set"])) {
|
if (isinstance(set, ["Set"])) {
|
||||||
let res = set.has(key);
|
let res = set.has(key);
|
||||||
@@ -469,13 +469,14 @@ Set.has = deprecated("hasOwnProperty or Set#has",
|
|||||||
* @param {object} set The set.
|
* @param {object} set The set.
|
||||||
* @returns {object}
|
* @returns {object}
|
||||||
*/
|
*/
|
||||||
Set.subtract = function set_subtract(set) {
|
Set.subtract = deprecated("RealSet#difference",
|
||||||
set = update({}, set);
|
function set_subtract(set) {
|
||||||
for (let i = 1; i < arguments.length; i++)
|
set = update({}, set);
|
||||||
for (let k in keys(arguments[i]))
|
for (let i = 1; i < arguments.length; i++)
|
||||||
delete set[k];
|
for (let k in keys(arguments[i]))
|
||||||
return set;
|
delete set[k];
|
||||||
};
|
return set;
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an element from a set and returns true if the element was
|
* Removes an element from a set and returns true if the element was
|
||||||
@@ -485,7 +486,7 @@ Set.subtract = function set_subtract(set) {
|
|||||||
* @param {string} key The key to remove.
|
* @param {string} key The key to remove.
|
||||||
* @returns boolean
|
* @returns boolean
|
||||||
*/
|
*/
|
||||||
Set.remove = deprecated("Set#delete",
|
Set.remove = deprecated("RealSet#delete",
|
||||||
curry(function Set__remove(set, key) {
|
curry(function Set__remove(set, key) {
|
||||||
if (isinstance(set, ["Set"]))
|
if (isinstance(set, ["Set"]))
|
||||||
return set.delete(key);
|
return set.delete(key);
|
||||||
@@ -1180,7 +1181,7 @@ function Module(name, prototype, ...args) {
|
|||||||
let proto = callable(prototype) ? args[0] : prototype;
|
let proto = callable(prototype) ? args[0] : prototype;
|
||||||
|
|
||||||
proto._metaInit_ = function () {
|
proto._metaInit_ = function () {
|
||||||
delete module.prototype._metaInit_;
|
module.prototype._metaInit_ = null;
|
||||||
currentModule[name.toLowerCase()] = this;
|
currentModule[name.toLowerCase()] = this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
|
|||||||
closeReader: function closeReader() {
|
closeReader: function closeReader() {
|
||||||
if (cache._cacheReader) {
|
if (cache._cacheReader) {
|
||||||
this.cacheReader.close();
|
this.cacheReader.close();
|
||||||
delete cache._cacheReader;
|
cache._cacheReader = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
|
|||||||
|
|
||||||
if (this._cacheWriter) {
|
if (this._cacheWriter) {
|
||||||
this._cacheWriter.close();
|
this._cacheWriter.close();
|
||||||
delete cache._cacheWriter;
|
cache._cacheWriter = null;
|
||||||
|
|
||||||
// ZipWriter bug.
|
// ZipWriter bug.
|
||||||
if (this.cacheFile.fileSize <= 22)
|
if (this.cacheFile.fileSize <= 22)
|
||||||
|
|||||||
@@ -134,8 +134,12 @@ var Highlights = Module("Highlight", {
|
|||||||
obj.style.enabled = true;
|
obj.style.enabled = true;
|
||||||
else
|
else
|
||||||
this.loaded.__defineSetter__(obj.class, function () {
|
this.loaded.__defineSetter__(obj.class, function () {
|
||||||
delete this[obj.class];
|
Object.defineProperty(this, obj.class, {
|
||||||
this[obj.class] = true;
|
value: true,
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
writable: true
|
||||||
|
});
|
||||||
|
|
||||||
if (obj.class === obj.baseClass)
|
if (obj.class === obj.baseClass)
|
||||||
for (let h in highlight)
|
for (let h in highlight)
|
||||||
|
|||||||
Reference in New Issue
Block a user