From a2a9459684462224a93710631dcc29624d010e21 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Fri, 16 Feb 2018 17:21:46 +0800 Subject: fix `unsafe` `evaluate` of `AST_Function` (#2920) fixes #2919 --- test/compress/evaluate.js | 13 +++++++++++++ test/compress/reduce_vars.js | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) (limited to 'test/compress') diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js index 3ac62ef5..2294ca01 100644 --- a/test/compress/evaluate.js +++ b/test/compress/evaluate.js @@ -1489,3 +1489,16 @@ issue_2916_2: { } expect_stdout: "PASS" } + +issue_2919: { + options = { + evaluate: true, + unsafe: true, + } + input: { + console.log([ function() {} ].toString()); + } + expect: { + console.log("function(){}"); + } +} diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index f916e54b..836d7fe2 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -5527,3 +5527,21 @@ issue_2869: { } expect_stdout: "PASS" } + +issue_2919: { + options = { + evaluate: true, + reduce_vars: true, + toplevel: true, + unsafe: true, + unused: true, + } + input: { + var arr = [ function() {} ]; + console.log(typeof arr[0]); + } + expect: { + console.log("function"); + } + expect_stdout: "function" +} -- cgit v1.2.3