implement annotations (#4763)

This commit is contained in:
Alex Lam S.L
2021-03-12 19:40:49 +00:00
committed by GitHub
parent c36c3cb470
commit 3b5d5014e0
15 changed files with 690 additions and 552 deletions

View File

@@ -48,6 +48,7 @@ function Compressor(options, false_by_default) {
return new Compressor(options, false_by_default);
TreeTransformer.call(this, this.before, this.after);
this.options = defaults(options, {
annotations : !false_by_default,
arguments : !false_by_default,
arrows : !false_by_default,
assignments : !false_by_default,
@@ -4725,7 +4726,7 @@ merge(Compressor.prototype, {
|| expr.expression.name == "Math" && expr.property == "random");
}
}
return this.pure || !compressor.pure_funcs(this);
return compressor.option("annotations") && this.pure || !compressor.pure_funcs(this);
});
AST_Node.DEFMETHOD("is_call_pure", return_false);
AST_Call.DEFMETHOD("is_call_pure", function(compressor) {