Commit 4c4818c
* Split out the `Option` and `Expected` types from `Variant`
This commit is like prior PRs to split out specializations of types into
their own AST type to avoid conflicting with the main type (in this case
`variant`). I originally thought these two types would be relatively
simple but this is probably one of the more complicated transitions, as
evidenced by the lines changed here. The main churn was that variants
already have a significant amount of code to support them and this is in
some places "duplicating" code for option/expected and in other cases
splitting what was already an if/else.
Overall I think that the generated code gets a little better since it's
clear when something is and `option` vs `expected` now rather than
trying to have everything shoehorned into one. Notably the C code
generator now generates descriptive fields like `bool is_some` or `bool
is_err` instead of a bland `uint8_t tag` with some comments about how to
use it.
* Remove `Variant::as_{option,expected}`
... as these are separate variants now.
* Review comments
1 parent 74cbb3b commit 4c4818c
File tree
42 files changed
+2081
-1157
lines changed- crates
- gen-core/src
- gen-c/src
- gen-js/src
- gen-markdown/src
- gen-rust-wasm/src
- gen-rust/src
- gen-spidermonkey/src
- gen-wasmtime-py/src
- gen-wasmtime
- src
- tests
- parser
- src
- ast
- tests
- ui
- test-helpers/src
- test-modules/modules/crates/variants
- wasmlink
- src
- adapter
- tests
- wit-component
- src
- tests
- interfaces/variants
- tests
- codegen
- runtime
- flavorful
- handles
- variants
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
42 files changed
+2081
-1157
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
68 | 84 | | |
69 | 85 | | |
70 | 86 | | |
| |||
97 | 113 | | |
98 | 114 | | |
99 | 115 | | |
| 116 | + | |
| 117 | + | |
100 | 118 | | |
101 | 119 | | |
102 | 120 | | |
| |||
215 | 233 | | |
216 | 234 | | |
217 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
218 | 243 | | |
219 | 244 | | |
220 | 245 | | |
| |||
252 | 277 | | |
253 | 278 | | |
254 | 279 | | |
255 | | - | |
256 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
257 | 287 | | |
258 | 288 | | |
259 | 289 | | |
| |||
0 commit comments