Commit 9501a05
authored
Add a new
* Add a new `Resolve::generate_nominal_type_ids` method
This commit adds a new method to `Resolve` which is intended to resolve
a longstanding issue for bindings generators based on `wit-parser`: #1497.
Specifically this adds functionality to `Resolve` to duplicate exported
interfaces and their contents, if necessary. This is a boon to bindings
generators because it means that a `TypeId`, for example, uniquely
identifies a single generated type. Previously it might refer to one of
two types, either the imported version or the exported version. After
this method, however, there will be two `TypeId`s if necessary.
This is currently modeled as a mutation to `Resolve` which is opt-in.
This is done to avoid tampering with the AST-like structure of `Resolve`
today where other AST-like operations don't want to necessarily have to
keep everything in sync. Once a `Resolve` is nominalized, however, it's
effectively incompatible with other operations such as merging,
printing, etc. My thinking is that for now this is a reasonable tradeoff
as bindings generators can pretty easily invoke this method before
actually running bindings generation.
Closes #1497
* Update MSRV to 1.82
* Fix tests
* Review commentsResolve::generate_nominal_type_ids method (#2447)1 parent 3f50c40 commit 9501a05
18 files changed
Lines changed: 690 additions & 61 deletions
File tree
- crates
- wit-dylib/tests
- wit-parser/src
- ast
- resolve
- fuzz/src
- src/bin/wasm-tools
- tests/cli
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
316 | 317 | | |
317 | 318 | | |
318 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
912 | 912 | | |
913 | 913 | | |
914 | 914 | | |
| 915 | + | |
915 | 916 | | |
916 | 917 | | |
917 | 918 | | |
| |||
968 | 969 | | |
969 | 970 | | |
970 | 971 | | |
| 972 | + | |
971 | 973 | | |
972 | 974 | | |
973 | 975 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
690 | 690 | | |
691 | 691 | | |
692 | 692 | | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
693 | 705 | | |
694 | 706 | | |
695 | 707 | | |
| |||
0 commit comments