Commit 281d161
committed
[compiler] Collect temporaries and optional chains from inner functions
Recursively collect identifier / property loads and optional chains from inner functions. This PR is in preparation for the next one.
Previously, we only did this in `collectHoistablePropertyLoads` to understand hoistable property loads from inner functions.
1. collectTemporariesSidemap
2. collectOptionalChainSidemap
3. collectHoistablePropertyLoads
- ^ this recursively calls `collectTemporariesSidemap`, `collectOptionalChainSidemap`, and `collectOptionalChainSidemap` on inner functions
4. collectDependencies
Now, we have
1. collectTemporariesSidemap
- recursively record identifiers in inner functions. Note that we track all temporaries in the same map as `IdentifierIds` are currently unique across functions
2. collectOptionalChainSidemap
- recursively records optional chain sidemaps in inner functions
3. collectHoistablePropertyLoads
- (unchanged, except to remove recursive collection of temporaries)
4. collectDependencies
- unchanged: to be modified to recursively collect dependencies in next PR
-1 parent 1094c77 commit 281d161
File tree
4 files changed
+151
-50
lines changed- compiler/packages/babel-plugin-react-compiler/src/HIR
4 files changed
+151
-50
lines changedLines changed: 0 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
25 | | - | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
| |||
373 | 371 | | |
374 | 372 | | |
375 | 373 | | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | 374 | | |
382 | 375 | | |
383 | 376 | | |
384 | 377 | | |
385 | | - | |
386 | | - | |
387 | 378 | | |
388 | 379 | | |
389 | 380 | | |
| |||
Lines changed: 47 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 33 | + | |
44 | 34 | | |
45 | 35 | | |
46 | 36 | | |
| |||
96 | 86 | | |
97 | 87 | | |
98 | 88 | | |
| 89 | + | |
| 90 | + | |
99 | 91 | | |
100 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
101 | 96 | | |
102 | 97 | | |
103 | 98 | | |
| |||
115 | 110 | | |
116 | 111 | | |
117 | 112 | | |
| 113 | + | |
118 | 114 | | |
119 | 115 | | |
120 | 116 | | |
121 | 117 | | |
122 | 118 | | |
123 | | - | |
| 119 | + | |
124 | 120 | | |
125 | 121 | | |
126 | 122 | | |
127 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
128 | 153 | | |
129 | 154 | | |
130 | 155 | | |
| |||
369 | 394 | | |
370 | 395 | | |
371 | 396 | | |
372 | | - | |
373 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
374 | 401 | | |
375 | | - | |
| 402 | + | |
| 403 | + | |
376 | 404 | | |
377 | 405 | | |
378 | 406 | | |
| |||
Lines changed: 96 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
180 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
181 | 183 | | |
182 | 184 | | |
183 | 185 | | |
| |||
215 | 217 | | |
216 | 218 | | |
217 | 219 | | |
218 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
219 | 243 | | |
220 | 244 | | |
221 | 245 | | |
| |||
224 | 248 | | |
225 | 249 | | |
226 | 250 | | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
234 | 266 | | |
235 | 267 | | |
236 | 268 | | |
237 | 269 | | |
238 | 270 | | |
239 | 271 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
244 | 293 | | |
245 | 294 | | |
246 | 295 | | |
247 | | - | |
248 | 296 | | |
249 | 297 | | |
250 | 298 | | |
| |||
310 | 358 | | |
311 | 359 | | |
312 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
313 | 367 | | |
314 | 368 | | |
315 | 369 | | |
| |||
360 | 414 | | |
361 | 415 | | |
362 | 416 | | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
367 | 431 | | |
368 | 432 | | |
| 433 | + | |
369 | 434 | | |
370 | 435 | | |
371 | 436 | | |
| |||
575 | 640 | | |
576 | 641 | | |
577 | 642 | | |
578 | | - | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
579 | 647 | | |
580 | 648 | | |
581 | 649 | | |
| |||
595 | 663 | | |
596 | 664 | | |
597 | 665 | | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
598 | 672 | | |
599 | 673 | | |
600 | 674 | | |
| |||
614 | 688 | | |
615 | 689 | | |
616 | 690 | | |
617 | | - | |
| 691 | + | |
618 | 692 | | |
619 | 693 | | |
620 | 694 | | |
621 | 695 | | |
622 | | - | |
| 696 | + | |
623 | 697 | | |
624 | 698 | | |
625 | 699 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1215 | 1215 | | |
1216 | 1216 | | |
1217 | 1217 | | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
1218 | 1222 | | |
1219 | 1223 | | |
1220 | 1224 | | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
1221 | 1229 | | |
1222 | 1230 | | |
1223 | 1231 | | |
| |||
0 commit comments