aboutsummaryrefslogtreecommitdiff
path: root/test/compress/functions.js
diff options
context:
space:
mode:
authorkzc <kzc@users.noreply.github.com>2017-05-01 12:10:11 -0400
committerAlex Lam S.L <alexlamsl@gmail.com>2017-05-02 00:10:11 +0800
commitea9289771b79c273347af72fba024ca29cfa035d (patch)
tree8bfe0c9e13be06c03eaaf438298eba4abee1c1a8 /test/compress/functions.js
parent2cb55b2ad0119852bc8714401992724d4fdb224d (diff)
downloadtracifyjs-ea9289771b79c273347af72fba024ca29cfa035d.tar.gz
tracifyjs-ea9289771b79c273347af72fba024ca29cfa035d.zip
improve literal return optimization (#1860)
Diffstat (limited to 'test/compress/functions.js')
-rw-r--r--test/compress/functions.js22
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"
+}