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

Issue 29874561: Noissue - Return value of filter match expression directly (Closed)

Created:
Sept. 4, 2018, 1:44 p.m. by Manish Jethani
Modified:
Sept. 6, 2018, 5:56 a.m.
Reviewers:
Jon Sonesen
Base URL:
https://hg.adblockplus.org/adblockpluscore/
Visibility:
Public.

Description

Noissue - Return value of filter match expression directly

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -7 lines) Patch
M lib/filterClasses.js View 1 chunk +4 lines, -7 lines 2 comments Download

Messages

Total messages: 4
Manish Jethani
Sept. 4, 2018, 1:44 p.m. (2018-09-04 13:44:14 UTC) #1
Manish Jethani
Patch Set 1 https://codereview.adblockplus.org/29874561/diff/29874562/lib/filterClasses.js File lib/filterClasses.js (right): https://codereview.adblockplus.org/29874561/diff/29874562/lib/filterClasses.js#newcode722 lib/filterClasses.js:722: return (this.contentType & typeMask) != 0 ...
Sept. 4, 2018, 1:46 p.m. (2018-09-04 13:46:07 UTC) #2
Manish Jethani
By the way, I tested the performance of this change and it's alright.
Sept. 5, 2018, 6:40 a.m. (2018-09-05 06:40:55 UTC) #3
Jon Sonesen
Sept. 5, 2018, 2:16 p.m. (2018-09-05 14:16:38 UTC) #4
https://codereview.adblockplus.org/29874561/diff/29874562/lib/filterClasses.js
File lib/filterClasses.js (right):

https://codereview.adblockplus.org/29874561/diff/29874562/lib/filterClasses.j...
lib/filterClasses.js:722: return (this.contentType & typeMask) != 0 &&
On 2018/09/04 13:46:06, Manish Jethani wrote:
> The first condition here needs to evaluate to a boolean value, just so the
> function returns false rather than 0 when the check fails.

Yeah, I see what you did there. Stylistically I prefer this as well, it is
easier to read. I think it is not crazy hard to read the masking, as most
programmers are aware of masks but this just looks nicer and is more uniform
with how most programmers do things (my first choice would have been to return a
bool directly with the mask as you have done here had I implemented this)

Thanks!

LGTM

Powered by Google App Engine
This is Rietveld