@samitouri / QOS-React / commits / 978215eae6

[test] Add test that resolves property loads to expanded places incorrectly

Ideally this should happen only for temporary places containing property loads.

Sathya Gunasekaran committed Jan 26, 2023 at 13:38 UTC 978215eae6282e13f1e36e5034fd3f5c529c5663
2 files changed +37
compiler/forget/src/__tests__/fixtures/hir/_bug_object-pattern.expect.md new
+32
@@ -0,0 +1,32 @@
1 +
2 +## Input
3 +
4 +```javascript
5 +function component(t) {
6 + let { a } = t;
7 + let y = { a };
8 + return y;
9 +}
10 +
11 +```
12 +
13 +## Code
14 +
15 +```javascript
16 +function component(t) {
17 + const $ = React.useMemoCache();
18 + const a = t.a;
19 + const c_0 = $[0] !== t6.a;
20 + let y;
21 + if (c_0) {
22 + y = { a: a };
23 + $[0] = t6.a;
24 + $[1] = y;
25 + } else {
26 + y = $[1];
27 + }
28 + return y;
29 +}
30 +
31 +```
32 +
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/hir/_bug_object-pattern.js new
+5
@@ -0,0 +1,5 @@
1 +function component(t) {
2 + let { a } = t;
3 + let y = { a };
4 + return y;
5 +}