diff options
author | kzc <kzc@users.noreply.github.com> | 2017-05-01 12:10:11 -0400 |
---|---|---|
committer | Alex Lam S.L <alexlamsl@gmail.com> | 2017-05-02 00:10:11 +0800 |
commit | ea9289771b79c273347af72fba024ca29cfa035d (patch) | |
tree | 8bfe0c9e13be06c03eaaf438298eba4abee1c1a8 /test/compress/functions.js | |
parent | 2cb55b2ad0119852bc8714401992724d4fdb224d (diff) | |
download | tracifyjs-ea9289771b79c273347af72fba024ca29cfa035d.tar.gz tracifyjs-ea9289771b79c273347af72fba024ca29cfa035d.zip |
improve literal return optimization (#1860)
Diffstat (limited to 'test/compress/functions.js')
-rw-r--r-- | test/compress/functions.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js index 2a2d0965..3a560f00 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -145,3 +145,25 @@ issue_1841_2: { } expect_exact: "42" } + +function_returning_constant_literal: { + options = { + reduce_vars: true, + unsafe: true, + toplevel: true, + evaluate: true, + cascade: true, + unused: true, + } + input: { + function greeter() { + return { message: 'Hello there' }; + } + var greeting = greeter(); + console.log(greeting.message); + } + expect: { + console.log("Hello there"); + } + expect_stdout: "Hello there" +} |