Commit 46fa6c2
committed
[compiler] More fbt compatibility
In my previous PR I fixed some cases but broke others. So, new approach. Two phase algorithm:
* First pass is forward data flow to determine all usages of macros. This is necessary because many of Meta's macros have variants that can be accessed via properties, eg you can do `macro(...)` but also `macro.variant(...)`.
* Second pass is backwards data flow to find macro invocations (JSX and calls) and then merge their operands into the same scope as the macro call.
Note that this required updating PromoteUsedTemporaries to avoid promoting macro calls that have interposing instructions between their creation and usage. Macro calls in general are pure so it should be safe to reorder them.1 parent 1324e1b commit 46fa6c2
File tree
15 files changed
+475
-295
lines changed- compiler/packages/babel-plugin-react-compiler/src
- Entrypoint
- HIR
- ReactiveScopes
- Utils
- __tests__/fixtures/compiler
- fbt
15 files changed
+475
-295
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
502 | | - | |
| 502 | + | |
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
| |||
Lines changed: 1 addition & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
| 86 | + | |
96 | 87 | | |
97 | 88 | | |
98 | 89 | | |
99 | 90 | | |
100 | | - | |
101 | 91 | | |
102 | 92 | | |
103 | 93 | | |
| |||
0 commit comments