Skip to content

Commit 25a3f58

Browse files
committed
Update (base update)
[ghstack-poisoned]
1 parent 5b19dc0 commit 25a3f58

29 files changed

+1504
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
2+
## Input
3+
4+
```javascript
5+
/**
6+
* props.b *does* influence `a`
7+
*/
8+
function Component(props) {
9+
const a = [];
10+
a.push(props.a);
11+
label: {
12+
if (props.b) {
13+
break label;
14+
}
15+
a.push(props.c);
16+
}
17+
a.push(props.d);
18+
return a;
19+
}
20+
21+
export const FIXTURE_ENTRYPOINT = {
22+
fn: Component,
23+
params: ['TodoAdd'],
24+
isComponent: 'TodoAdd',
25+
};
26+
27+
```
28+
29+
## Code
30+
31+
```javascript
32+
import { c as _c } from "react/compiler-runtime"; /**
33+
* props.b *does* influence `a`
34+
*/
35+
function Component(props) {
36+
const $ = _c(2);
37+
let a;
38+
if ($[0] !== props) {
39+
a = [];
40+
a.push(props.a);
41+
bb0: {
42+
if (props.b) {
43+
break bb0;
44+
}
45+
46+
a.push(props.c);
47+
}
48+
49+
a.push(props.d);
50+
$[0] = props;
51+
$[1] = a;
52+
} else {
53+
a = $[1];
54+
}
55+
return a;
56+
}
57+
58+
export const FIXTURE_ENTRYPOINT = {
59+
fn: Component,
60+
params: ["TodoAdd"],
61+
isComponent: "TodoAdd",
62+
};
63+
64+
```
65+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* props.b *does* influence `a`
3+
*/
4+
function Component(props) {
5+
const a = [];
6+
a.push(props.a);
7+
label: {
8+
if (props.b) {
9+
break label;
10+
}
11+
a.push(props.c);
12+
}
13+
a.push(props.d);
14+
return a;
15+
}
16+
17+
export const FIXTURE_ENTRYPOINT = {
18+
fn: Component,
19+
params: ['TodoAdd'],
20+
isComponent: 'TodoAdd',
21+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
2+
## Input
3+
4+
```javascript
5+
/**
6+
* props.b does *not* influence `a`
7+
*/
8+
function ComponentA(props) {
9+
const a_DEBUG = [];
10+
a_DEBUG.push(props.a);
11+
if (props.b) {
12+
return null;
13+
}
14+
a_DEBUG.push(props.d);
15+
return a_DEBUG;
16+
}
17+
18+
/**
19+
* props.b *does* influence `a`
20+
*/
21+
function ComponentB(props) {
22+
const a = [];
23+
a.push(props.a);
24+
if (props.b) {
25+
a.push(props.c);
26+
}
27+
a.push(props.d);
28+
return a;
29+
}
30+
31+
/**
32+
* props.b *does* influence `a`, but only in a way that is never observable
33+
*/
34+
function ComponentC(props) {
35+
const a = [];
36+
a.push(props.a);
37+
if (props.b) {
38+
a.push(props.c);
39+
return null;
40+
}
41+
a.push(props.d);
42+
return a;
43+
}
44+
45+
/**
46+
* props.b *does* influence `a`
47+
*/
48+
function ComponentD(props) {
49+
const a = [];
50+
a.push(props.a);
51+
if (props.b) {
52+
a.push(props.c);
53+
return a;
54+
}
55+
a.push(props.d);
56+
return a;
57+
}
58+
59+
export const FIXTURE_ENTRYPOINT = {
60+
fn: ComponentA,
61+
params: [{a: 1, b: false, d: 3}],
62+
};
63+
64+
```
65+
66+
## Code
67+
68+
```javascript
69+
import { c as _c } from "react/compiler-runtime"; /**
70+
* props.b does *not* influence `a`
71+
*/
72+
function ComponentA(props) {
73+
const $ = _c(3);
74+
let a_DEBUG;
75+
let t0;
76+
if ($[0] !== props) {
77+
t0 = Symbol.for("react.early_return_sentinel");
78+
bb0: {
79+
a_DEBUG = [];
80+
a_DEBUG.push(props.a);
81+
if (props.b) {
82+
t0 = null;
83+
break bb0;
84+
}
85+
86+
a_DEBUG.push(props.d);
87+
}
88+
$[0] = props;
89+
$[1] = a_DEBUG;
90+
$[2] = t0;
91+
} else {
92+
a_DEBUG = $[1];
93+
t0 = $[2];
94+
}
95+
if (t0 !== Symbol.for("react.early_return_sentinel")) {
96+
return t0;
97+
}
98+
return a_DEBUG;
99+
}
100+
101+
/**
102+
* props.b *does* influence `a`
103+
*/
104+
function ComponentB(props) {
105+
const $ = _c(2);
106+
let a;
107+
if ($[0] !== props) {
108+
a = [];
109+
a.push(props.a);
110+
if (props.b) {
111+
a.push(props.c);
112+
}
113+
114+
a.push(props.d);
115+
$[0] = props;
116+
$[1] = a;
117+
} else {
118+
a = $[1];
119+
}
120+
return a;
121+
}
122+
123+
/**
124+
* props.b *does* influence `a`, but only in a way that is never observable
125+
*/
126+
function ComponentC(props) {
127+
const $ = _c(3);
128+
let a;
129+
let t0;
130+
if ($[0] !== props) {
131+
t0 = Symbol.for("react.early_return_sentinel");
132+
bb0: {
133+
a = [];
134+
a.push(props.a);
135+
if (props.b) {
136+
a.push(props.c);
137+
t0 = null;
138+
break bb0;
139+
}
140+
141+
a.push(props.d);
142+
}
143+
$[0] = props;
144+
$[1] = a;
145+
$[2] = t0;
146+
} else {
147+
a = $[1];
148+
t0 = $[2];
149+
}
150+
if (t0 !== Symbol.for("react.early_return_sentinel")) {
151+
return t0;
152+
}
153+
return a;
154+
}
155+
156+
/**
157+
* props.b *does* influence `a`
158+
*/
159+
function ComponentD(props) {
160+
const $ = _c(3);
161+
let a;
162+
let t0;
163+
if ($[0] !== props) {
164+
t0 = Symbol.for("react.early_return_sentinel");
165+
bb0: {
166+
a = [];
167+
a.push(props.a);
168+
if (props.b) {
169+
a.push(props.c);
170+
t0 = a;
171+
break bb0;
172+
}
173+
174+
a.push(props.d);
175+
}
176+
$[0] = props;
177+
$[1] = a;
178+
$[2] = t0;
179+
} else {
180+
a = $[1];
181+
t0 = $[2];
182+
}
183+
if (t0 !== Symbol.for("react.early_return_sentinel")) {
184+
return t0;
185+
}
186+
return a;
187+
}
188+
189+
export const FIXTURE_ENTRYPOINT = {
190+
fn: ComponentA,
191+
params: [{ a: 1, b: false, d: 3 }],
192+
};
193+
194+
```
195+
196+
### Eval output
197+
(kind: ok) [1,3]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* props.b does *not* influence `a`
3+
*/
4+
function ComponentA(props) {
5+
const a_DEBUG = [];
6+
a_DEBUG.push(props.a);
7+
if (props.b) {
8+
return null;
9+
}
10+
a_DEBUG.push(props.d);
11+
return a_DEBUG;
12+
}
13+
14+
/**
15+
* props.b *does* influence `a`
16+
*/
17+
function ComponentB(props) {
18+
const a = [];
19+
a.push(props.a);
20+
if (props.b) {
21+
a.push(props.c);
22+
}
23+
a.push(props.d);
24+
return a;
25+
}
26+
27+
/**
28+
* props.b *does* influence `a`, but only in a way that is never observable
29+
*/
30+
function ComponentC(props) {
31+
const a = [];
32+
a.push(props.a);
33+
if (props.b) {
34+
a.push(props.c);
35+
return null;
36+
}
37+
a.push(props.d);
38+
return a;
39+
}
40+
41+
/**
42+
* props.b *does* influence `a`
43+
*/
44+
function ComponentD(props) {
45+
const a = [];
46+
a.push(props.a);
47+
if (props.b) {
48+
a.push(props.c);
49+
return a;
50+
}
51+
a.push(props.d);
52+
return a;
53+
}
54+
55+
export const FIXTURE_ENTRYPOINT = {
56+
fn: ComponentA,
57+
params: [{a: 1, b: false, d: 3}],
58+
};

0 commit comments

Comments
 (0)