diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-01-05 22:21:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-05 22:21:18 +0800 |
commit | 9f23185f2bb0d23d5dd2e2334c589e97132a37a8 (patch) | |
tree | da7073d594df8d69e9ebec145a438856419575cb /test/compress/typeof.js | |
parent | b82feb9302adddb1763e9915b0daf9ff35ab2af2 (diff) | |
download | tracifyjs-9f23185f2bb0d23d5dd2e2334c589e97132a37a8.tar.gz tracifyjs-9f23185f2bb0d23d5dd2e2334c589e97132a37a8.zip |
fix corner case with `arguments` as function name (#2729)
fixes #2728
Diffstat (limited to 'test/compress/typeof.js')
-rw-r--r-- | test/compress/typeof.js | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/test/compress/typeof.js b/test/compress/typeof.js index 72e77beb..b5f14016 100644 --- a/test/compress/typeof.js +++ b/test/compress/typeof.js @@ -178,3 +178,126 @@ duplicate_lambda_arg_name: { } expect_stdout: "undefined" } + +issue_2728_1: { + options = { + evaluate: true, + reduce_vars: true, + typeofs: true, + } + input: { + (function arguments() { + console.log(typeof arguments); + })(); + } + expect: { + (function arguments() { + console.log(typeof arguments); + })(); + } + expect_stdout: "object" +} + +issue_2728_2: { + options = { + evaluate: true, + reduce_vars: true, + typeofs: true, + } + input: { + function arguments() { + return typeof arguments; + } + console.log(typeof arguments, arguments()); + } + expect: { + function arguments() { + return typeof arguments; + } + console.log(typeof arguments, arguments()); + } + expect_stdout: "function object" +} + +issue_2728_3: { + options = { + evaluate: true, + reduce_vars: true, + typeofs: true, + } + input: { + (function() { + function arguments() { + } + console.log(typeof arguments); + })(); + } + expect: { + (function() { + function arguments() { + } + console.log("function"); + })(); + } + expect_stdout: "function" +} + +issue_2728_4: { + options = { + evaluate: true, + reduce_vars: true, + toplevel: true, + typeofs: true, + } + input: { + function arguments() { + } + console.log(typeof arguments); + } + expect: { + function arguments() { + } + console.log("function"); + } + expect_stdout: "function" +} + +issue_2728_5: { + options = { + evaluate: true, + reduce_vars: true, + typeofs: true, + } + input: { + (function arguments(arguments) { + console.log(typeof arguments); + })(); + } + expect: { + (function arguments(arguments) { + console.log(typeof arguments); + })(); + } + expect_stdout: "undefined" +} + +issue_2728_6: { + options = { + evaluate: true, + reduce_vars: true, + typeofs: true, + } + input: { + function arguments(arguments) { + return typeof arguments; + } + console.log(typeof arguments, arguments()); + } + expect: { + function arguments(arguments) { + return typeof arguments; + } + console.log(typeof arguments, arguments()); + } + expect_stdout: "function undefined" +} |