aboutsummaryrefslogtreecommitdiff
path: root/test/compress/properties.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress/properties.js')
-rw-r--r--test/compress/properties.js113
1 files changed, 113 insertions, 0 deletions
diff --git a/test/compress/properties.js b/test/compress/properties.js
index 8126d6c6..a5527de3 100644
--- a/test/compress/properties.js
+++ b/test/compress/properties.js
@@ -657,3 +657,116 @@ accessor_this: {
expect_exact: 'var a=1;var b={get this(){return a},set this(c){a=c}};console.log(b.this,b.this=2,b.this);'
expect_stdout: "1 2 2"
}
+
+issue_2208_1: {
+ options = {
+ inline: true,
+ side_effects: true,
+ unsafe: true,
+ }
+ input: {
+ console.log({
+ p: function() {
+ return 42;
+ }
+ }.p());
+ }
+ expect: {
+ console.log(42);
+ }
+ expect_stdout: "42"
+}
+
+issue_2208_2: {
+ options = {
+ inline: true,
+ side_effects: true,
+ unsafe: true,
+ }
+ input: {
+ console.log({
+ a: 42,
+ p: function() {
+ return this.a;
+ }
+ }.p());
+ }
+ expect: {
+ console.log({
+ a: 42,
+ p: function() {
+ return this.a;
+ }
+ }.p());
+ }
+ expect_stdout: "42"
+}
+
+issue_2208_3: {
+ options = {
+ inline: true,
+ side_effects: true,
+ unsafe: true,
+ }
+ input: {
+ a = 42;
+ console.log({
+ p: function() {
+ return function() {
+ return this.a;
+ }();
+ }
+ }.p());
+ }
+ expect: {
+ a = 42;
+ console.log(function() {
+ return this.a;
+ }());
+ }
+ expect_stdout: "42"
+}
+
+issue_2208_4: {
+ options = {
+ inline: true,
+ side_effects: true,
+ unsafe: true,
+ }
+ input: {
+ function foo() {}
+ console.log({
+ a: foo(),
+ p: function() {
+ return 42;
+ }
+ }.p());
+ }
+ expect: {
+ function foo() {}
+ console.log((foo(), function() {
+ return 42;
+ })());
+ }
+ expect_stdout: "42"
+}
+
+issue_2208_5: {
+ options = {
+ inline: true,
+ side_effects: true,
+ unsafe: true,
+ }
+ input: {
+ console.log({
+ p: "FAIL",
+ p: function() {
+ return 42;
+ }
+ }.p());
+ }
+ expect: {
+ console.log(42);
+ }
+ expect_stdout: "42"
+}