Testing all leading comments against being PURE comments (#2305)
This commit is contained in:
committed by
Alex Lam S.L
parent
aacf3edc68
commit
8158b1bdcf
@@ -1980,12 +1980,14 @@ merge(Compressor.prototype, {
|
||||
if (!compressor.option("side_effects")) return false;
|
||||
if (this.pure !== undefined) return this.pure;
|
||||
var pure = false;
|
||||
var comments, last_comment;
|
||||
var comments, pure_comment;
|
||||
if (this.start
|
||||
&& (comments = this.start.comments_before)
|
||||
&& comments.length
|
||||
&& /[@#]__PURE__/.test((last_comment = comments[comments.length - 1]).value)) {
|
||||
pure = last_comment;
|
||||
&& (pure_comment = find_if(function (comment) {
|
||||
return /[@#]__PURE__/.test(comment.value);
|
||||
}, comments))) {
|
||||
pure = pure_comment;
|
||||
}
|
||||
return this.pure = pure;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user