Commit e1ad53e
authored
Add compatibility layer for extensions relying on old compiler (#264)
The new compiler broke all the extensions doing compiler patches. We promised not to help them when those break but it seems enough people use those extensions that we sort of got forced into finding some solution, so this makes these changes:
- The exports for the new compiler are now in `these_broke_before_and_will_break_again`
- `i_will_not_ask_for_help_when_these_break` now returns some stubs that pretend to be the old compiler. It also emits an event so -gui can show a warning.
- Focus is on compatibility & safety, not performance. There will be unnecessary casts and scripts marked as yielding.
- Extensions that meet these assumptions should work without changes:
- Extensions do not try to combine this compatibility layer with any APIs provided by the new compiler.
- Extensions treat IR nodes received from descendSubstack and similar as opaque objects because they will be the new intermediate objects instead of { kind: "..." }
- Extensions need to implement the JS generators for all AST node kinds they use. Can not rely on the default JS generator because those generators are expecting a different format than { kind: "..." }
Lack of tests is intentional since this will be removed at some point when we have a proper API we can tell people to use1 parent 98df18a commit e1ad53e
File tree
5 files changed
+399
-3
lines changed- src
- compiler
5 files changed
+399
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| |||
201 | 202 | | |
202 | 203 | | |
203 | 204 | | |
| 205 | + | |
204 | 206 | | |
205 | 207 | | |
206 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
99 | 106 | | |
100 | 107 | | |
101 | 108 | | |
| |||
199 | 206 | | |
200 | 207 | | |
201 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
202 | 216 | | |
203 | 217 | | |
204 | 218 | | |
| |||
593 | 607 | | |
594 | 608 | | |
595 | 609 | | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
596 | 617 | | |
597 | 618 | | |
598 | 619 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| 128 | + | |
| 129 | + | |
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
| |||
198 | 201 | | |
199 | 202 | | |
200 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
201 | 207 | | |
202 | 208 | | |
203 | 209 | | |
| |||
540 | 546 | | |
541 | 547 | | |
542 | 548 | | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
543 | 552 | | |
544 | 553 | | |
545 | 554 | | |
| |||
0 commit comments