rewrite DeadStoreOfProperty to improve worst-case complexity

This commit is contained in:
Erik Krogh Kristensen
2020-07-09 10:09:20 +02:00
parent dbeef312ca
commit 97aa3cc8a3
5 changed files with 205 additions and 70 deletions

View File

@@ -1,6 +1,5 @@
| fieldInit.ts:10:3:10:8 | f = 4; | This write to property 'f' is useless, since $@ always overrides it. | fieldInit.ts:13:5:13:14 | this.f = 5 | another property write |
| fieldInit.ts:18:22:18:22 | h | This write to property 'h' is useless, since $@ always overrides it. | fieldInit.ts:19:5:19:14 | this.h = h | another property write |
| fieldInit.ts:24:3:24:20 | static static() {} | This write to property 'static' is useless, since $@ always overrides it. | fieldInit.ts:30:3:30:20 | static static() {} | another property write |
| real-world-examples.js:5:4:5:11 | o.p = 42 | This write to property 'p' is useless, since $@ always overrides it. | real-world-examples.js:10:2:10:9 | o.p = 42 | another property write |
| real-world-examples.js:15:9:15:18 | o.p1 += 42 | This write to property 'p1' is useless, since $@ always overrides it. | real-world-examples.js:15:2:15:18 | o.p1 = o.p1 += 42 | another property write |
| real-world-examples.js:16:11:16:20 | o.p2 *= 42 | This write to property 'p2' is useless, since $@ always overrides it. | real-world-examples.js:16:2:16:21 | o.p2 -= (o.p2 *= 42) | another property write |

View File

@@ -19,13 +19,3 @@ class G {
this.h = h;
}
}
class Foo {
static static() {}
static *foo() {}
static set() {}
static static() {}
}

View File

@@ -92,7 +92,7 @@
o.defaulted2 = 42;
var o = {};
o.pure18 = 42; // NOT OK
o.pure18 = 42; // NOT OK TODO: Currently have duplicate result.
o.pure18 = 42; // NOT OK
o.pure18 = 42;
@@ -124,5 +124,15 @@
var o = {};
Object.defineProperty(o, "prop", {writable:!0,configurable:!0,enumerable:!1}) // OK
o.prop = 42;
o.prop = 42;
var o = {};
o.pure19 = 42; // OK
o.some_other_property = 42;
o.pure19 = 42;
var o = {};
o.pure20 = 42; // OK
some_other_obj.some_other_property = 42;
o.pure20 = 42;
});