diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-03-01 04:12:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-01 04:12:10 +0800 |
commit | f5cbe19b753bf84f8b11f96e2c91a8ca49525dba (patch) | |
tree | 75569231e92b9d72baab77ed81961b415e13e1e7 /test | |
parent | b34fa11a13221b7ad26ea48f18fcf2f5903c94c1 (diff) | |
download | tracifyjs-f5cbe19b753bf84f8b11f96e2c91a8ca49525dba.tar.gz tracifyjs-f5cbe19b753bf84f8b11f96e2c91a8ca49525dba.zip |
invert `reduce_vars` tracking flag (#1519)
Modules like webpack and grunt-contrib-uglify still uses `ast.transform(compressor)` before `Compressor.compress(ast)` was introduced.
Workaround this compatibility issue by deactivating `reduce_vars` in such case.
Also fix use case with omitted `options` when calling `Compressor()`.
fixes #1516
Diffstat (limited to 'test')
-rw-r--r-- | test/mocha/minify.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/mocha/minify.js b/test/mocha/minify.js index baac2a41..2cc800fe 100644 --- a/test/mocha/minify.js +++ b/test/mocha/minify.js @@ -182,4 +182,13 @@ describe("minify", function() { }); }); + describe("Compressor", function() { + it("should be backward compatible with ast.transform(compressor)", function() { + var ast = Uglify.parse("function f(a){for(var i=0;i<a;i++)console.log(i)}"); + ast.figure_out_scope(); + ast = ast.transform(Uglify.Compressor()); + assert.strictEqual(ast.print_to_string(), "function f(a){for(var i=0;i<a;i++)console.log(i)}"); + }); + }) + }); |