Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/filterClasses.js

Issue 29870574: Noissue - Define RegExpFilter's 0 getter statically (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Sept. 1, 2018, 3:05 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterClasses.js
===================================================================
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -621,22 +621,31 @@
RegExpFilter.prototype = extend(ActiveFilter, {
/**
* @see ActiveFilter.domainSourceIsLowerCase
*/
domainSourceIsLowerCase: true,
/**
* Number of filters contained, will always be 1 (required to
- * optimize Matcher).
+ * optimize {@link Matcher}).
* @type {number}
*/
length: 1,
/**
+ * The filter itself (required to optimize {@link Matcher}).
+ * @type {RegExpFilter}
+ */
+ get 0()
+ {
+ return this;
+ },
+
+ /**
* @see ActiveFilter.domainSeparator
*/
domainSeparator: "|",
/**
* Expression from which a regular expression should be generated -
* for delayed creation of the regexp property
* @type {string}
@@ -715,21 +724,16 @@
this.isActiveOnDomain(docDomain, sitekey) && this.regexp.test(location))
{
return true;
}
return false;
}
});
-// Required to optimize Matcher, see also RegExpFilter.prototype.length
-Object.defineProperty(RegExpFilter.prototype, "0", {
- get() { return this; }
-});
-
/**
* Creates a RegExp filter from its text representation
* @param {string} text same as in Filter()
* @return {Filter}
*/
RegExpFilter.fromText = function(text)
{
let blocking = true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld