aboutsummaryrefslogtreecommitdiff
path: root/test/compress/sequences.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-05-03 19:14:56 +0800
committerGitHub <noreply@github.com>2018-05-03 19:14:56 +0800
commitd51a00a4508022e54e257d93442abff42c4442b7 (patch)
tree43e7c7c32e046f3ca65e6763fff049e933a920c8 /test/compress/sequences.js
parentfc0f168a0c4d81d724339af881b6ad466e02b0b5 (diff)
downloadtracifyjs-d51a00a4508022e54e257d93442abff42c4442b7.tar.gz
tracifyjs-d51a00a4508022e54e257d93442abff42c4442b7.zip
compress `AST_Sequence` within `AST_Call` (#3117)
Diffstat (limited to 'test/compress/sequences.js')
-rw-r--r--test/compress/sequences.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/compress/sequences.js b/test/compress/sequences.js
index 12acbcf7..8aede12b 100644
--- a/test/compress/sequences.js
+++ b/test/compress/sequences.js
@@ -876,3 +876,59 @@ forin: {
}
expect_stdout: "PASS"
}
+
+call: {
+ options = {
+ sequences: true,
+ }
+ input: {
+ var a = function() {
+ return this;
+ }();
+ function b() {
+ console.log("foo");
+ }
+ b.c = function() {
+ console.log(this === b ? "bar" : "baz");
+ };
+ (a, b)();
+ (a, b.c)();
+ (a, function() {
+ console.log(this === a);
+ })();
+ new (a, b)();
+ new (a, b.c)();
+ new (a, function() {
+ console.log(this === a);
+ })();
+ }
+ expect: {
+ var a = function() {
+ return this;
+ }();
+ function b() {
+ console.log("foo");
+ }
+ b.c = function() {
+ console.log(this === b ? "bar" : "baz");
+ },
+ a, b(),
+ (a, b.c)(),
+ a, function() {
+ console.log(this === a);
+ }(),
+ a, new b(),
+ a, new b.c(),
+ a, new function() {
+ console.log(this === a);
+ }();
+ }
+ expect_stdout: [
+ "foo",
+ "baz",
+ "true",
+ "foo",
+ "baz",
+ "false",
+ ]
+}