1
+
2
+## Input
3
+
4
+```javascript
5
+import {makeArray} from 'shared-runtime';
6
+
7
+function Component(props) {
8
+ const x = {};
9
+ let y;
10
+ if (props.cond) {
11
+ if (props.cond2) {
12
+ y = [props.value];
13
+ } else {
14
+ y = [props.value2];
15
+ }
16
+ } else {
17
+ y = [];
18
+ }
19
+ // This should be inferred as `<store> y` s.t. `x` can still
20
+ // be independently memoized. *But* this also must properly
21
+ // extend the mutable range of the array literals in the
22
+ // if/else branches
23
+ y.push(x);
24
+
25
+ return [x, y];
26
+}
27
+
28
+export const FIXTURE_ENTRYPOINT = {
29
+ fn: Component,
30
+ params: [{cond: true, cond2: true, value: 42}],
31
+ sequentialRenders: [
32
+ {cond: true, cond2: true, value: 3.14},
33
+ {cond: true, cond2: true, value: 42},
34
+ {cond: true, cond2: true, value: 3.14},
35
+ {cond: true, cond2: false, value2: 3.14},
36
+ {cond: true, cond2: false, value2: 42},
37
+ {cond: true, cond2: false, value2: 3.14},
38
+ {cond: false},
39
+ {cond: false},
40
+ ],
41
+};
42
+
43
+```
44
+
45
+## Code
46
+
47
+```javascript
48
+import { c as _c } from "react/compiler-runtime";
49
+import { makeArray } from "shared-runtime";
50
+
51
+function Component(props) {
52
+ const $ = _c(3);
53
+ let t0;
54
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
55
+ t0 = {};
56
+ $[0] = t0;
57
+ } else {
58
+ t0 = $[0];
59
+ }
60
+ const x = t0;
61
+ let t1;
62
+ if ($[1] !== props) {
63
+ let y;
64
+ if (props.cond) {
65
+ if (props.cond2) {
66
+ y = [props.value];
67
+ } else {
68
+ y = [props.value2];
69
+ }
70
+ } else {
71
+ y = [];
72
+ }
73
+
74
+ y.push(x);
75
+
76
+ t1 = [x, y];
77
+ $[1] = props;
78
+ $[2] = t1;
79
+ } else {
80
+ t1 = $[2];
81
+ }
82
+ return t1;
83
+}
84
+
85
+export const FIXTURE_ENTRYPOINT = {
86
+ fn: Component,
87
+ params: [{ cond: true, cond2: true, value: 42 }],
88
+ sequentialRenders: [
89
+ { cond: true, cond2: true, value: 3.14 },
90
+ { cond: true, cond2: true, value: 42 },
91
+ { cond: true, cond2: true, value: 3.14 },
92
+ { cond: true, cond2: false, value2: 3.14 },
93
+ { cond: true, cond2: false, value2: 42 },
94
+ { cond: true, cond2: false, value2: 3.14 },
95
+ { cond: false },
96
+ { cond: false },
97
+ ],
98
+};
99
+
100
+```
101
+
102
+### Eval output
103
+(kind: ok) [{},[3.14,"[[ cyclic ref *1 ]]"]]
104
+[{},[42,"[[ cyclic ref *1 ]]"]]
105
+[{},[3.14,"[[ cyclic ref *1 ]]"]]
106
+[{},[3.14,"[[ cyclic ref *1 ]]"]]
107
+[{},[42,"[[ cyclic ref *1 ]]"]]
108
+[{},[3.14,"[[ cyclic ref *1 ]]"]]
109
+[{},["[[ cyclic ref *1 ]]"]]
110
+[{},["[[ cyclic ref *1 ]]"]]
\ No newline at end of file