Skip to content

Commit 29689f7

Browse files
authored
Merge pull request #16 from dhil/wasmfx-merge
Merge with upstream
2 parents 40d8ff7 + e611325 commit 29689f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1487
-732
lines changed

Cargo.lock

Lines changed: 194 additions & 163 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ indexmap = "2.0.0"
3030
prettyplease = "0.2.20"
3131
syn = { version = "2.0", features = ["printing"] }
3232

33-
wasmparser = { git = "https://github.com/wasmfx/wasmfx-tools", tag = "v1.209.0" }
34-
wasm-metadata = { git = "https://github.com/wasmfx/wasmfx-tools", tag = "v1.209.0" }
35-
wasm-encoder = { git = "https://github.com/wasmfx/wasmfx-tools", tag = "v1.209.0" }
36-
wit-parser = { git = "https://github.com/wasmfx/wasmfx-tools", tag = "v1.209.0" }
37-
wit-component = { git = "https://github.com/wasmfx/wasmfx-tools", tag = "v1.209.0" }
33+
wasmparser = { git = "https://github.com/wasmfx/wasmfx-tools", tag = "v1.211.1" }
34+
wasm-metadata = { git = "https://github.com/wasmfx/wasmfx-tools", tag = "v1.211.1" }
35+
wasm-encoder = { git = "https://github.com/wasmfx/wasmfx-tools", tag = "v1.211.1" }
36+
wit-parser = { git = "https://github.com/wasmfx/wasmfx-tools", tag = "v1.211.1" }
37+
wit-component = { git = "https://github.com/wasmfx/wasmfx-tools", tag = "v1.211.1" }
3838

3939
wit-bindgen-core = { path = 'crates/core', version = '0.26.0' }
4040
wit-bindgen-c = { path = 'crates/c', version = '0.26.0' }
@@ -81,8 +81,8 @@ csharp-mono = ['csharp']
8181

8282
[dev-dependencies]
8383
heck = { workspace = true }
84-
wasmtime = { version = "20.0.0", features = ['component-model'] }
85-
wasmtime-wasi = { version = "20.0.0" }
84+
wasmtime = { version = "21.0.0", features = ['component-model'] }
85+
wasmtime-wasi = { version = "21.0.0" }
8686
test-artifacts = { path = 'crates/test-rust-wasm/artifacts' }
8787
wit-parser = { workspace = true }
8888
wasmparser = { workspace = true }

crates/c/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl WorldGenerator for C {
176176
name: &WorldKey,
177177
id: InterfaceId,
178178
_files: &mut Files,
179-
) {
179+
) -> Result<()> {
180180
let wasm_import_module = resolve.name_world_key(name);
181181
let mut gen = self.interface(resolve, true, Some(&wasm_import_module));
182182
gen.interface = Some((id, name));
@@ -192,6 +192,8 @@ impl WorldGenerator for C {
192192
}
193193

194194
gen.gen.src.append(&gen.src);
195+
196+
Ok(())
195197
}
196198

197199
fn import_funcs(

crates/c/tests/codegen.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use heck::*;
33
use std::env;
44
use std::path::{Path, PathBuf};
55
use std::process::Command;
6-
use wit_parser::{Resolve, UnresolvedPackage};
6+
use wit_parser::{Resolve, UnresolvedPackageGroup};
77

88
macro_rules! codegen_test {
99
($id:ident $name:tt $test:tt) => {
@@ -94,8 +94,8 @@ fn rename_option() -> Result<()> {
9494
opts.rename.push(("c".to_string(), "rename3".to_string()));
9595

9696
let mut resolve = Resolve::default();
97-
let pkg = resolve.push(UnresolvedPackage::parse(
98-
"input.wit".as_ref(),
97+
let pkgs = resolve.push_group(UnresolvedPackageGroup::parse(
98+
"input.wit",
9999
r#"
100100
package foo:bar;
101101
@@ -118,7 +118,7 @@ fn rename_option() -> Result<()> {
118118
}
119119
"#,
120120
)?)?;
121-
let world = resolve.select_world(pkg, None)?;
121+
let world = resolve.select_world(&pkgs, None)?;
122122
let mut files = Default::default();
123123
opts.build().generate(&resolve, world, &mut files)?;
124124
for (file, contents) in files.iter() {

crates/core/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ pub trait WorldGenerator {
3737
for (name, import) in world.imports.iter() {
3838
match import {
3939
WorldItem::Function(f) => funcs.push((unwrap_name(name), f)),
40-
WorldItem::Interface { id, .. } => self.import_interface(resolve, name, *id, files),
40+
WorldItem::Interface { id, .. } => {
41+
self.import_interface(resolve, name, *id, files)?
42+
}
4143
WorldItem::Type(id) => types.push((unwrap_name(name), *id)),
4244
}
4345
}
@@ -91,7 +93,7 @@ pub trait WorldGenerator {
9193
name: &WorldKey,
9294
iface: InterfaceId,
9395
files: &mut Files,
94-
);
96+
) -> Result<()>;
9597

9698
/// Called before any exported interfaces are generated.
9799
fn pre_export_interface(&mut self, resolve: &Resolve, files: &mut Files) -> Result<()> {

crates/csharp/src/RepTable.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ internal int Add(T v) {
2222
if (firstVacant.HasValue) {
2323
rep = firstVacant.Value;
2424
firstVacant = ((Vacant) list[rep]).next;
25-
list[rep] = v;
25+
list[rep] = v!;
2626
} else {
2727
rep = list.Count;
28-
list.Add(v);
28+
list.Add(v!);
2929
}
3030
return rep;
3131
}

0 commit comments

Comments
 (0)