Index: lib/filterClasses.js |
=================================================================== |
--- a/lib/filterClasses.js |
+++ b/lib/filterClasses.js |
@@ -468,17 +468,17 @@ function RegExpFilter(text, regexpSource |
this.matchCase = matchCase; |
if (thirdParty != null) |
this.thirdParty = thirdParty; |
if (regexpSource.length >= 2 && regexpSource[0] == "/" && regexpSource[regexpSource.length - 1] == "/") |
{ |
// The filter is a regular expression - convert it immediately to catch syntax errors |
let regexp = new RegExp(regexpSource.substr(1, regexpSource.length - 2), this.matchCase ? "" : "i"); |
- this.__defineGetter__("regexp", () => regexp); |
+ Object.defineProperty(this, "regexp", {value: regexp}); |
} |
else |
{ |
// No need to convert this filter to regular expression yet, do it on demand |
this.regexpSource = regexpSource; |
} |
} |
exports.RegExpFilter = RegExpFilter; |
@@ -524,20 +524,18 @@ RegExpFilter.prototype = |
.replace(/\\\^/g, "(?:[\\x00-\\x24\\x26-\\x2C\\x2F\\x3A-\\x40\\x5B-\\x5E\\x60\\x7B-\\x7F]|$)") |
.replace(/^\\\|\\\|/, "^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?") // process extended anchor at expression start |
.replace(/^\\\|/, "^") // process anchor at expression start |
.replace(/\\\|$/, "$") // process anchor at expression end |
.replace(/^(\.\*)/, "") // remove leading wildcards |
.replace(/(\.\*)$/, ""); // remove trailing wildcards |
let regexp = new RegExp(source, this.matchCase ? "" : "i"); |
- |
- delete this.regexpSource; |
- this.__defineGetter__("regexp", () => regexp); |
- return this.regexp; |
+ Object.defineProperty(this, "regexp", {value: regexp}); |
+ return regexp; |
}, |
/** |
* Content types the filter applies to, combination of values from RegExpFilter.typeMap |
* @type Number |
*/ |
contentType: 0x7FFFFFFF, |
/** |
* Defines whether the filter should distinguish between lower and upper case letters |
@@ -567,19 +565,20 @@ RegExpFilter.prototype = |
{ |
return true; |
} |
return false; |
} |
}; |
-RegExpFilter.prototype.__defineGetter__("0", function() |
+// Required to optimize Matcher, see also RegExpFilter.prototype.length |
+Object.defineProperty(RegExpFilter.prototype, "0", |
{ |
- return this; |
+ get: function() { return this; } |
}); |
/** |
* Creates a RegExp filter from its text representation |
* @param {String} text same as in Filter() |
*/ |
RegExpFilter.fromText = function(text) |
{ |