Commit 814a418
committed
[compiler] Make unary and binary operator types more precise
Summary: Minor change inspired by #29863: the BuildHIR pass ensures that Binary and UnaryOperator nodes only use a limited set of the operators that babel's operator types represent, which that pr relies on for safe reorderability, but the type of those HIR nodes admits the other operators. For example, even though you can't build an HIR UnaryOperator with `delete` as the operator, it is a valid HIR node--and if we made a mistaken change that let you build such a node, it would be unsafe to reorder.
This pr makes the typing of operators stricter to prevent that.
ghstack-source-id: 9bf3b1a
Pull Request resolved: #298801 parent 7f3911f commit 814a418
File tree
2 files changed
+28
-3
lines changed- compiler/packages/babel-plugin-react-compiler/src/HIR
2 files changed
+28
-3
lines changedLines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1668 | 1668 | | |
1669 | 1669 | | |
1670 | 1670 | | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
1671 | 1680 | | |
1672 | 1681 | | |
1673 | 1682 | | |
| |||
1893 | 1902 | | |
1894 | 1903 | | |
1895 | 1904 | | |
1896 | | - | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
1897 | 1908 | | |
1898 | 1909 | | |
1899 | 1910 | | |
| |||
2307 | 2318 | | |
2308 | 2319 | | |
2309 | 2320 | | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
2310 | 2335 | | |
2311 | 2336 | | |
2312 | 2337 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
866 | 866 | | |
867 | 867 | | |
868 | 868 | | |
869 | | - | |
| 869 | + | |
870 | 870 | | |
871 | 871 | | |
872 | 872 | | |
| |||
881 | 881 | | |
882 | 882 | | |
883 | 883 | | |
884 | | - | |
| 884 | + | |
885 | 885 | | |
886 | 886 | | |
887 | 887 | | |
| |||
0 commit comments