Commit 9d7b320
authored
Update the guest C generator for world-based generation (#396)
This commit removes the `Generator` trait impl for the C generator and
adds the `WorldGenerator` trait impl to replace it. This is the
equivalent of #386 for the guest C generator.
The generated C code is largely the same, except that the entire world
is represented in one header file instead of per-interface header files
as before. Additionally a tiny amount of "type sharing" is now done
where all interfaces share the same string type (namespaced by the
world name). More type sharing should come with a more first-class
implementation of worlds.
There was quite a lot of code movement within the generator as I got it
working again, but at the surface level very little has changed and it
should largely be the same as before.1 parent b6df951 commit 9d7b320
21 files changed
Lines changed: 1277 additions & 1304 deletions
File tree
- crates
- bindgen-core/src
- gen-guest-c
- src
- tests
- gen-host-js/src
- test-helpers
- macros
- src
- wit-bindgen-demo/src
- src/bin
- tests/runtime
- flavorful
- lists
- many_arguments
- numbers
- records
- smoke
- strings
- variants
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
564 | 564 | | |
565 | 565 | | |
566 | 566 | | |
| 567 | + | |
567 | 568 | | |
568 | 569 | | |
569 | 570 | | |
| |||
576 | 577 | | |
577 | 578 | | |
578 | 579 | | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
579 | 584 | | |
580 | 585 | | |
581 | 586 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
8 | 7 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
18 | 11 | | |
19 | 12 | | |
20 | | - | |
| 13 | + | |
21 | 14 | | |
22 | 15 | | |
23 | 16 | | |
| |||
31 | 24 | | |
32 | 25 | | |
33 | 26 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
39 | 35 | | |
40 | 36 | | |
41 | 37 | | |
42 | | - | |
| 38 | + | |
43 | 39 | | |
44 | 40 | | |
45 | 41 | | |
46 | 42 | | |
47 | 43 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 44 | + | |
56 | 45 | | |
57 | 46 | | |
58 | 47 | | |
59 | | - | |
| 48 | + | |
60 | 49 | | |
61 | 50 | | |
62 | 51 | | |
| |||
69 | 58 | | |
70 | 59 | | |
71 | 60 | | |
72 | | - | |
| 61 | + | |
73 | 62 | | |
74 | 63 | | |
75 | 64 | | |
| |||
0 commit comments